Support "Assemble them all" trajectory generation from CAD
This commit is contained in:
parent
47773be8d4
commit
a38c3bec5a
42 changed files with 537 additions and 119 deletions
34
cg/freecad/Frames/model/connected_part_model.py
Normal file
34
cg/freecad/Frames/model/connected_part_model.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
import BOPTools.JoinFeatures
|
||||
import FreeCAD as App
|
||||
import uuid
|
||||
|
||||
|
||||
class ConnectedPartModel:
|
||||
name = None
|
||||
id = None
|
||||
solid = None
|
||||
|
||||
def __init__(self, part) -> None:
|
||||
try:
|
||||
self.id ='part' + str(uuid.uuid4())
|
||||
j = BOPTools.JoinFeatures.makeConnect(name=self.id)
|
||||
if (type(part) is list):
|
||||
j.Objects = part
|
||||
else:
|
||||
j.Objects = [part]
|
||||
j.Proxy.execute(j)
|
||||
j.purgeTouched()
|
||||
self.solid = j
|
||||
App.ActiveDocument.recompute()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
pass
|
||||
|
||||
def remove(self):
|
||||
try:
|
||||
App.ActiveDocument.removeObject(self.solid.Label)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue