Добавлен опциональный алгоритм тесселяции
This commit is contained in:
parent
839ce36c70
commit
23edfea360
2 changed files with 18 additions and 9 deletions
|
@ -61,8 +61,10 @@ render = '_render'
|
||||||
|
|
||||||
|
|
||||||
def obj_importer(filename,
|
def obj_importer(filename,
|
||||||
linear_deflection,
|
tesselation_method="Standard",
|
||||||
angular_deflection,
|
linear_deflection=0.1,
|
||||||
|
angular_deflection=30.0,
|
||||||
|
max_edge_length=1,
|
||||||
update=False,
|
update=False,
|
||||||
scene_placement=True,
|
scene_placement=True,
|
||||||
skiphidden=True,
|
skiphidden=True,
|
||||||
|
@ -124,11 +126,16 @@ def obj_importer(filename,
|
||||||
shape = obj.Shape.copy()
|
shape = obj.Shape.copy()
|
||||||
shape.Placement = obj.Placement.inverse().multiply(shape.Placement)
|
shape.Placement = obj.Placement.inverse().multiply(shape.Placement)
|
||||||
meshfromshape = doc.addObject('Mesh::Feature','Mesh')
|
meshfromshape = doc.addObject('Mesh::Feature','Mesh')
|
||||||
meshfromshape.Mesh = MeshPart.meshFromShape(
|
if tesselation_method == "Mefisto":
|
||||||
Shape=shape,
|
meshfromshape.Mesh = MeshPart.meshFromShape(
|
||||||
LinearDeflection=linear_deflection,
|
Shape=shape,
|
||||||
AngularDeflection=math.radians(angular_deflection),
|
LinearDeflection=linear_deflection,
|
||||||
Relative=False)
|
AngularDeflection=math.radians(angular_deflection),
|
||||||
|
Relative=False)
|
||||||
|
else:
|
||||||
|
meshfromshape.Mesh = MeshPart.meshFromShape(
|
||||||
|
Shape=shape,
|
||||||
|
MaxLength=mefisto_max_length)
|
||||||
t = meshfromshape.Mesh.Topology
|
t = meshfromshape.Mesh.Topology
|
||||||
verts = [[v.x,v.y,v.z] for v in t[0]]
|
verts = [[v.x,v.y,v.z] for v in t[0]]
|
||||||
faces = t[1]
|
faces = t[1]
|
||||||
|
|
|
@ -72,10 +72,12 @@ def freecad_asset_pipeline(fcstd_path,
|
||||||
remove_collections()
|
remove_collections()
|
||||||
cleanup_orphan_data()
|
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,
|
objs_for_render = obj_importer(fcstd_path,
|
||||||
|
tesselation_method,
|
||||||
linear_deflection,
|
linear_deflection,
|
||||||
angular_deflection)
|
angular_deflection,
|
||||||
|
max_edge_length)
|
||||||
|
|
||||||
# restructuring hierarchy by lcs points
|
# restructuring hierarchy by lcs points
|
||||||
lcs_objects = restruct_hierarchy()
|
lcs_objects = restruct_hierarchy()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue