def __init__(self,obj): self.Type = "LatticeShapeString" #initialize accompanying Draft ShapeString foolObj = FoolFeatureDocumentObject() self.draft_shape_string = _ShapeString(foolObj) self.foolObj = foolObj #add Draft ShapeString's properties to document object in posession of our LatticeShapeString for (proptype, propname, group, hint) in foolObj.properties: if propname != "String": #we'll define our own string property obj.addProperty(proptype,propname,"Lattice ShapeString",hint) obj.addProperty("App::PropertyLink","ArrayLink","Lattice ShapeString","array to use for the shapestring") obj.addProperty("App::PropertyStringList","Strings","Lattice ShapeString","Strings to put at each placement.") obj.addProperty("App::PropertyEnumeration","XAlign","Lattice ShapeString","Horizontal alignment of individual strings") obj.XAlign = ['None','Left','Right','Middle'] obj.addProperty("App::PropertyEnumeration","YAlign","Lattice ShapeString","Vertical alignment of individual strings") obj.YAlign = ['None','Top','Bottom','Middle'] obj.addProperty("App::PropertyBool","AlignPrecisionBoundBox","Lattice ShapeString","Use precision bounding box for alignment. Warning: slow!") obj.addProperty("App::PropertyFile","FullPathToFont","Lattice ShapeString","Full path of font file that is actually being used.") obj.setEditorMode("FullPathToFont", 1) # set read-only obj.Proxy = self self.setDefaults(obj)
def makeFoolObj(self,obj): '''Makes an object that mimics a Part::FeaturePython, and makes a Draft ShapeString object on top of it. Both are added as attributes to self. This is needed to re-use Draft ShapeString''' if hasattr(self, "foolObj"): return foolObj = FoolFeatureDocumentObject() self.draft_shape_string = _ShapeString(foolObj) self.foolObj = foolObj