Except my macro doesn't know how to raise the PD Attach dialog during feature creation, like a PD primitive does. Also, the thread feature generates "getEditDialog() not implemented" error when dbl-clicked.
Is the PD attachment dialog (used when adding a PD geo. primitive) exposed to Python coders? And if not, can it be?
I can't find info anywhere on the getEditDialog error. Nor could I produce results by trying to implement that in my object class and my VP class (method isn't called). Is there a method for setting the EditDialog for my FeatureAdditivePython object, so that when it's dbl-clicked, it raises the PD attach dialog?
There's over 450 lines of code, so I'll only show the part related to packaging my feature:
Code: Select all
### Tail End of my PDThreadShaft.execute() Method, threadbody contains the result of Part.fuse(x) or Part.common(x) ###
if hasattr(fp, "BaseFeature") and fp.BaseFeature != None: # Implied Active PDBody when invoked.
threadbody.transformShape(fp.Placement.toMatrix(), True) # now threadbody moved twice; basef moved once
full_shape = fp.BaseFeature.Shape.fuse(threadbody,0.001) # fuse fails if tolerance <= 0.0008 (or if removeSplitter() applied first)
full_shape.transformShape(fp.Placement.inverse().toMatrix(), True) # now fused shape put back
fp.Shape = Part.makeSolid(full_shape).removeSplitter()
else: # no base feature
fp.Shape = Part.makeSolid(threadbody).removeSplitter()
#It is the shape used for copying in pattern features
if fp.TypeId != "Part::FeaturePython":
threadbody.transformShape(fp.Placement.inverse().toMatrix(), True)
fp.AddSubShape = Part.makeSolid(threadbody)
### Main Method ###
activebody = FreeCADGui.ActiveDocument.ActiveView.getActiveObject("pdbody")
if activebody:
# Store shape in new PartDesign::FeatureAdditivePython object
FreeCAD.ActiveDocument.openTransaction("Make Thread Shaft")
a = FreeCAD.ActiveDocument.addObject("PartDesign::FeatureAdditivePython", "ThreadExt", None, None, False)
FreeCAD.ActiveDocument.commitTransaction()
PDThreadShaft(a, speclist) # Build Thread object
PDThreadShaftVP(a.ViewObject) # Build View Provider
activebody.addObject(a)
# a.MapMode = 'FlatFace'
# a.Support = [(FreeCAD.ActiveDocument.getObject('XY_Plane001'),'')]
else:
FreeCAD.ActiveDocument.openTransaction("Make Thread Shaft")
a = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "ThreadExt", None, None, False)
FreeCAD.ActiveDocument.commitTransaction()
PDThreadShaft(a, speclist) # Build Thread object
PDThreadShaftVP(a.ViewObject) # Build View Provider
a.setEditorMode('Placement', 0) #non-readonly non-hidden