class TpFcObject(): ''' Description ''' def __init__(self, obj): ''' call self.setProperties ''' self.setProperties(obj) obj.ViewObject.Proxy=0 return None def setProperties(self, fp): ''' Add self.properties ''' fp.Proxy = self if not hasattr(fp,"SourceObject"): fp.addProperty("App::PropertyLink","SourceObject","xxx","yyy") if not hasattr(fp,"output1"): fp.addProperty('Part::PropertyPartShape', 'output1', 'vert_faces', "xxx"),8) if not hasattr(fp,"output2"): fp.addProperty('Part::PropertyPartShape', 'output2', 'hor_faces', "xxx"),8) def execute(self, fp): ''' Features to Run (extract codes from your exsiting library)''' # algorithm to find the external vertical faces ...etc. inputShape = fp.SourceObject.Shape ... fp.output1 = output1 fp.output2 = output2 ... fp.Shape = (can chose to 'display' which output, e.g. depends on a switch) # make a FreeCAD 'document object' tpObj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","TpObj") # 'apply' the class / create an TpFcObject 'instance' passing the 'document object' to it tpObjInstance = TpFcObject(tpObj) # pass the selected obj to the Topologic Object for execution tpObj.SourceObject = Gui.Selection.getSelection()[0]