Веб интерфейс для корректировки работы ASP, его интеграция с алгоритмами генерации
This commit is contained in:
parent
23edfea360
commit
c1e4b0e0f0
57 changed files with 2969 additions and 290 deletions
30
cad_generation/model/simple_copy_part_model.py
Normal file
30
cad_generation/model/simple_copy_part_model.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import FreeCAD as App
|
||||
import Part
|
||||
|
||||
|
||||
class SimpleCopyPartModel:
|
||||
id = None
|
||||
copyLink = None
|
||||
label = None
|
||||
part = None
|
||||
|
||||
def getPart(self):
|
||||
return self.part
|
||||
|
||||
def __init__(self, part) -> None:
|
||||
try:
|
||||
from random import randrange
|
||||
self.id = str(randrange(1000000))
|
||||
childObj = part
|
||||
__shape = Part.getShape(
|
||||
childObj, '', needSubElement=False, refine=False)
|
||||
obj = App.ActiveDocument.addObject('Part::Feature', self.id)
|
||||
obj.Shape = __shape
|
||||
self.part = obj
|
||||
self.label = obj.Label
|
||||
App.ActiveDocument.recompute()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
def remove(self):
|
||||
App.ActiveDocument.removeObject(self.label)
|
Loading…
Add table
Add a link
Reference in a new issue