How to set Mesh.Export deflection in pure console script

Need help, or want to share a macro? Post here!
ORE
Posts: 9
Joined: Fri Oct 19, 2018 2:41 pm

How to set Mesh.Export deflection in pure console script

Postby ORE » Tue Oct 23, 2018 7:41 pm

I am using the following for exporting shapes as meshes into .stl:

Code: Select all

mesh_Cyl_2 = App.ActiveDocument.addObject("Mesh::Feature","Mesh_Cyl_2")
mesh_Cyl_2.Mesh=MeshPart.meshFromShape(Shape=obj_Cyl_2.Shape.copy(False), LinearDeflection=0.5, AngularDeflection=0.05, Relative=False)

mesh_Cut_1 = App.ActiveDocument.addObject("Mesh::Feature","Mesh_Cut_1")
mesh_Cut_1.Mesh=MeshPart.meshFromShape(Shape=obj_Cut_1.Shape.copy(False), LinearDeflection=0.5, AngularDeflection=0.05, Relative=False)

__objs__=[]

__objs__.append(mesh_Cyl_2)
__objs__.append(mesh_Cut_1)

Mesh.export(__objs__,"myfile.stl")
While this works fine I would prefer to skip the mesh creation and leave that to Mesh.Export like so:

Code: Select all

__objs__=[]

__objs__.append(obj_Cyl_2) # Shape object
__objs__.append(obj_Cut_1) # Shape object

Mesh.export(__objs__,"myfile.stl")
This also works fine, BUT how can I set LinearDeflection and AngularDeflection for this in a pure console aplication?