def __init__(self, obj, PSize="", dims=BushingMod.Dimensions()): """Create a bushing.""" # Run parent __init__ and define common attributes super(Bushing, self).__init__(obj) obj.PType = "OSE_Bushing" obj.PRating = "BushingFittingFromAnyCatalog" obj.PSize = PSize # What is it for? # Define specific attributes and set their values. obj.addProperty("App::PropertyLength", "L", "Bushing", "Bushing length").L = dims.L obj.addProperty("App::PropertyLength", "N", "Bushing", "N").N = dims.N obj.addProperty("App::PropertyLength", "POD", "Bushing", "Large pipe outer diameter.").POD = dims.POD obj.addProperty("App::PropertyLength", "POD1", "Bushing", "Small pipe outer diameter.").POD1 = dims.POD1 obj.addProperty("App::PropertyLength", "PThk1", "Bushing", "Small pipe thickness.").PThk1 = dims.PThk1 obj.addProperty("App::PropertyVectorList", "Ports", "Bushing", "Ports relative positions.").Ports = self.getPorts(obj) obj.addProperty("App::PropertyVectorList", "PortRotationAngles", "Bushing", "Ports rotation angles.").PortRotationAngles = self.getPortRotationAngles(obj) obj.addProperty("App::PropertyString", "PartNumber", "Bushing", "Part number").PartNumber = "" # Make Ports read only. obj.setEditorMode("Ports", 1) obj.setEditorMode("PortRotationAngles", 1)
def createNewPart(self, document, table, partName, outputType): builder = Bushing.BushingFromTable(self.params.document, self.params.table) part = builder.create(partName, outputType) if outputType == Piping.OUTPUT_TYPE_FLAMINGO: self.moveFlamingoPartToSelection(document, part) return part
def extractDimensions(cls, obj): dims = BushingMod.Dimensions() dims.L = obj.L dims.N = obj.N dims.POD = obj.POD dims.POD1 = obj.POD1 dims.PThk1 = obj.PThk1 return dims
def __init__(self, document): self.dims = BushingMod.Dimensions() self.pos = FreeCAD.Vector(0, 0, 0) # Define default initial position. self.document = document