Add CAD & CG assets generators

This commit is contained in:
Igor Brylyov 2024-04-27 15:45:41 +03:00
parent db7a44f479
commit cc723b1bb2
2 changed files with 34 additions and 6 deletions

View file

@ -137,9 +137,37 @@
megapose6d = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/megapose6d { inherit webdataset; };
spatialmath = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/spatialmath { inherit ansitable; };
rcg-pipeline = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/rcg-pipeline { bpy = bpy-lib; inherit rbsFrameworkSrc; };
rbs-workbench = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/freecad.robossembler { inherit freecad-py; inherit rbsFrameworkSrc; };
freecad-py = pkgs.python3Packages.toPythonModule (pkgs.callPackage ./pkgs/misc/freecad-lib { });
rbs-workbench = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/freecad.robossembler { inherit freecad-lib; inherit rbsFrameworkSrc; };
freecad-lib = pkgs.python3Packages.toPythonModule (pkgs.callPackage ./pkgs/misc/freecad-lib { });
bpy-lib = pkgs.python3Packages.toPythonModule bpy;
cad-gen =
let
cad_export_script = pkgs.writers.writePython3 "cad_export_script.py"
{ libraries = [ rbs-workbench ]; }
''
import FreeCAD as App
import freecad.robossembler.utils.freecad_exporters as rbs
import sys
path = sys.argv[4]
print(path)
doc = App.openDocument(path)
rbs.publish_project_database(doc)
App.closeDocument(doc.Name)
'';
in
pkgs.writeShellScriptBin "cad-gen"
''
export PYTHONPATH="${rbs-workbench}/${pkgs.python3.sitePackages}"
${pkgs.freecad}/bin/freecadcmd ${cad_export_script} -- --pass $1
'';
cg-gen = pkgs.writers.writePython3Bin "cg-gen"
{ libraries = [ rcg-pipeline ]; }
''
from rcg_pipeline import rcg_full_pipeline
import sys
rcg_full_pipeline(sys.argv[1])
'';
in
{
inherit pkgs;
@ -152,7 +180,7 @@
};
packages = {
inherit mayo pysdf fstl unified-planning test-script blender bpy bpy-wheel rcg-pipeline freecad-py bpy-lib;
inherit unified-planning test-script cad-gen cg-gen;
};
devShells.ci = pkgs.mkShell { buildInputs = [ pkgs.jq ]; };

View file

@ -6,7 +6,7 @@
, pythonImportsCheckHook
, config
, setuptools
, freecad-py
, freecad-lib
, pytestCheckHook
, toPythonModule
, python
@ -26,10 +26,10 @@ buildPythonPackage rec {
setuptools
];
buildInputs = [ freecad-py ];
buildInputs = [ freecad-lib ];
propagatedBuildInputs = [
freecad-py
freecad-lib
];
pythonImportsCheck = [ "freecad.robossembler" ];