From 23edfea360428ffe3a5556a747e7704372a046c4 Mon Sep 17 00:00:00 2001 From: Igor Brylyov Date: Sat, 1 Jul 2023 14:52:09 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BE=D0=BF=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D0=B0=D0=BB=D0=B3=D0=BE=D1=80=D0=B8=D1=82?= =?UTF-8?q?=D0=BC=20=D1=82=D0=B5=D1=81=D1=81=D0=B5=D0=BB=D1=8F=D1=86=D0=B8?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cg/blender/import_fcstd/import_cad_objects.py | 21 ++++++++++++------- cg/pipeline/freecad_to_asset.py | 6 ++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/cg/blender/import_fcstd/import_cad_objects.py b/cg/blender/import_fcstd/import_cad_objects.py index c997f8c..6088851 100644 --- a/cg/blender/import_fcstd/import_cad_objects.py +++ b/cg/blender/import_fcstd/import_cad_objects.py @@ -61,8 +61,10 @@ render = '_render' def obj_importer(filename, - linear_deflection, - angular_deflection, + tesselation_method="Standard", + linear_deflection=0.1, + angular_deflection=30.0, + max_edge_length=1, update=False, scene_placement=True, skiphidden=True, @@ -124,11 +126,16 @@ def obj_importer(filename, shape = obj.Shape.copy() shape.Placement = obj.Placement.inverse().multiply(shape.Placement) meshfromshape = doc.addObject('Mesh::Feature','Mesh') - meshfromshape.Mesh = MeshPart.meshFromShape( - Shape=shape, - LinearDeflection=linear_deflection, - AngularDeflection=math.radians(angular_deflection), - Relative=False) + if tesselation_method == "Mefisto": + meshfromshape.Mesh = MeshPart.meshFromShape( + Shape=shape, + LinearDeflection=linear_deflection, + AngularDeflection=math.radians(angular_deflection), + Relative=False) + else: + meshfromshape.Mesh = MeshPart.meshFromShape( + Shape=shape, + MaxLength=mefisto_max_length) t = meshfromshape.Mesh.Topology verts = [[v.x,v.y,v.z] for v in t[0]] faces = t[1] diff --git a/cg/pipeline/freecad_to_asset.py b/cg/pipeline/freecad_to_asset.py index d55e484..3734113 100644 --- a/cg/pipeline/freecad_to_asset.py +++ b/cg/pipeline/freecad_to_asset.py @@ -72,10 +72,12 @@ def freecad_asset_pipeline(fcstd_path, remove_collections() cleanup_orphan_data() - # import objects + # import objects, tesselation method can be "Standard" by default with linear/angular deflection parameters and Mefisto with max edge length parameter objs_for_render = obj_importer(fcstd_path, + tesselation_method, linear_deflection, - angular_deflection) + angular_deflection, + max_edge_length) # restructuring hierarchy by lcs points lcs_objects = restruct_hierarchy()