Assembly: Insert new part (#17922)
* Assembly: Joint Object : encapsulate the joint creation widget such that the task can be subclassed and ui customized by other commands. * Assembly: Insert New Part * Update src/Mod/Assembly/CommandInsertNewPart.py Co-authored-by: Kacper Donat <kadet1090@gmail.com> --------- Co-authored-by: Kacper Donat <kadet1090@gmail.com>
This commit is contained in:
@@ -1223,6 +1223,24 @@ def addVertexToReference(ref, vertex_name):
|
||||
return ref
|
||||
|
||||
|
||||
def createPart(partName, doc):
|
||||
if not doc:
|
||||
raise ValueError("No active document to add a part to.")
|
||||
|
||||
part = doc.addObject("App::Part", partName)
|
||||
body = part.newObject("PartDesign::Body", "Body")
|
||||
# Gui.ActiveDocument.ActiveView.setActiveObject('pdbody', body)
|
||||
sketch = body.newObject("Sketcher::SketchObject", "Sketch")
|
||||
sketch.MapMode = "FlatFace"
|
||||
sketch.AttachmentSupport = [(body.Origin.OriginFeatures[3], "")] # XY_Plane
|
||||
|
||||
# add a circle as a base shape for visualisation
|
||||
sketch.addGeometry(Part.Circle(App.Vector(0, 0), App.Vector(0, 0, 1), 5), False)
|
||||
doc.recompute()
|
||||
|
||||
return part, body
|
||||
|
||||
|
||||
def getLinkGroup(linkElement):
|
||||
if linkElement.TypeId == "App::LinkElement":
|
||||
for obj in linkElement.InList:
|
||||
|
||||
Reference in New Issue
Block a user