Добавлен опциональный алгоритм тесселяции

This commit is contained in:
Igor Brylyov 2023-07-01 14:52:09 +03:00
parent 839ce36c70
commit 23edfea360
2 changed files with 18 additions and 9 deletions

View file

@ -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]

View file

@ -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()