i am using FreeCAD to create a statistical shape in python 3.8.5. In the course of the programm i create several shapes and save those into a list. In the end i try to fuse the shapes by using:
creating Shapes:
Code: Select all
for i in range()
for j in range()
P1, P2, P3 = find_vertices(cross_sec_area[i][j],strut_direction[i], triangle_start_position[i][j])
P1=App.Vector(np.asarray(P1,dtype=np.float64)) #get edges of triangle
P2=App.Vector(np.asarray(P2,dtype=np.float64)) #convert to FreeCAD Vector
P3=App.Vector(np.asarray(P3,dtype=np.float64))
tri_outline=Part.makePolygon([P1,P2,P3,P1]) #create triangle outline as wire
tri_face = Part.Face(tri_outline) #create triangle as surface
extrud_vec = App.Vector(np.asarray(strut_direction[i] * length[i] / a,dtype=np.float64))
strut_element = tri_face.extrude(extrud_vec) # extrude triangle along strut direction until next triangle starting point
if j == 0:
all_strut_element = Part.Shape(strut_element)
all_strut_element = all_strut_element.fuse(strut_element)
if all_strut_element.common(res_cylinder).Length > 0:
strut_element_list.append(all_strut_element)
Code: Select all
result2 = Part.Shape(strut_element_list[0])
result2 = result2.fuse(strut_element_list[1:])
Since there are a lot of elements in the list (up to 3000 ) where every element consists of several fuses itself (all in all up to 80.000) the fuse() command takes a very long time (right now 24h, still calculating).
I figured that the elements in the list have to be of ShapeType: Compound and to not fuse element wise to accelerate the fuse() command.
Is there anything else i can do to make this faster?
Thank you all!
Mischa