def newProfile(prop): ''' Auxiliary function to create profiles ''' if prop['stype']=='C': profile=makeCircle(float(prop['H'])) else: profile=ArchProfile.makeProfile([0,'SECTION',prop['SSize']+'-000',prop['stype'],float(prop['W']),float(prop['H']),float(prop['ta']),float(prop['tf'])]) return profile
def newProfile(prop): ''' Auxiliary function to create profiles with ArchProfiles ''' if prop['stype']=='C': profile=makeCircle(float(prop['H'])) else: profile=ArchProfile.makeProfile([0,'SECTION',prop['SSize']+'-000',prop['stype'],float(prop['W']),float(prop['H']),float(prop['ta']),float(prop['tf'])]) return profile
def insert(self): # insert the section result=FreeCAD.ActiveDocument.findObjects("App::DocumentObjectGroup","Profiles_set") if result: group= result[0] else: group=FreeCAD.activeDocument().addObject("App::DocumentObjectGroup","Profiles_set") if self.sizeList.selectedItems(): prop=self.sectDictList[self.sizeList.currentRow()] if prop['stype']=='C': s=makeCircle(float(prop['H'])) else: s=ArchProfile.makeProfile([0,'SECTION',prop['SSize']+'-000',prop['stype'],float(prop['W']),float(prop['H']),float(prop['ta']),float(prop['tf'])]) group.addObject(s) FreeCAD.activeDocument().recompute()
__url__ = "http://www.freecadweb.org" # Make some strings picked by the translator #if FreeCAD.GuiUp: # QtCore.QT_TRANSLATE_NOOP("Arch","Wood") # QtCore.QT_TRANSLATE_NOOP("Arch","Steel") # Possible roles for structural elements Roles = [ "Beam", "Column", "Slab", "Wall", "Curtain Wall", "Roof", "Foundation", "Pile", "Tendon" ] #Reads preset profiles and categorizes them Categories = [None] Presets = ArchProfile.readPresets() for pre in Presets[1:]: if pre[1] not in Categories: Categories.append(pre[1]) def makeStructure(baseobj=None, length=None, width=None, height=None, name="Structure"): '''makeStructure([obj],[length],[width],[heigth],[swap]): creates a structure element based on the given profile object and the given extrusion height. If no base object is given, you can also specify length and width for a cubic object.''' p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
from DraftTools import translate else: def translate(ctxt,txt): return txt __title__="FreeCAD Structure" __author__ = "Yorik van Havre" __url__ = "http://www.freecadweb.org" # Possible roles for structural elements Roles = ["Beam","Column","Slab","Wall","Curtain Wall","Roof","Foundation","Pile","Tendon"] #Reads preset profiles and categorizes them Categories=[] Presets=ArchProfile.readPresets() for pre in Presets: if pre[1] not in Categories: Categories.append(pre[1]) def makeStructure(baseobj=None,length=None,width=None,height=None,name="Structure"): '''makeStructure([obj],[length],[width],[heigth],[swap]): creates a structure element based on the given profile object and the given extrusion height. If no base object is given, you can also specify length and width for a cubic object.''' p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) obj.Label = translate("Arch",name) _Structure(obj) if FreeCAD.GuiUp:
def plot(self): sectionType = self.section_prop[SECTIONTYPE] # IPE sectionSize = self.section_prop[SECTIONSIZE] # 22 baseSection = sectionProp[sectionType][sectionSize] # IPE22 SECTION baseSectionType = base_section_type[sectionType] # H, U bf = baseSection.bf_equivalentI d = baseSection.d_equivalentI tf = baseSection.tf_equivalentI tw = baseSection.tw_equivalentI if sectionType == 'UNP': bf, d, tf, tw = d, bf, tw, tf dist = self.section_prop[DIST] * 10 doc = App.getDocument("current_section") group = doc.addObject("App::DocumentObjectGroup", "Profiles_set") s1 = ArchProfile.makeProfile([ 0, sectionType, sectionType + '_000', baseSectionType, bf, d, tw, tf ]) gui = Gui.ActiveDocument gui.getObject(s1.Label).LineColor = (1.0, 0.0, 0.0) obj = doc.getObjectsByLabel(s1.Label)[0] doc.recompute() if sectionType == 'UNP': Draft.rotate(doc.UNP_000, 90) group.addObject(s1) deltax = baseSection.bf + dist if self.section_prop[ISSOUBLE]: Draft.move(obj, App.Vector(deltax, 0, 0)) s2 = Draft.move(obj, App.Vector(-deltax, 0, 0), copy=True) s3 = Draft.move(obj, App.Vector(-2 * deltax, 0, 0), copy=True) group.addObjects([s2, s3]) if self.section_prop[ISDOUBLE]: Draft.move(obj, App.Vector(deltax / 2, 0, 0)) s2 = Draft.rotate(obj, 180, center=App.Vector(0, 0, 0), copy=True) group.addObject(s2) if self.section_prop[ISTBPLATE]: y = obj.Shape.OuterWire.BoundBox.YMax + self.section_prop[TH] / 2 p3 = App.Vector(0, y, 0) width = self.section_prop[LH] height = self.section_prop[TH] plt = ArchProfile.makeProfile( [0, 'PlateT', 'PlateT' + '_000', 'R', width, height]) gui.getObject(plt.Label).LineColor = (0.0, 0.0, 1.0) Draft.move(doc.PlateT_000, p3) plb = Draft.rotate(doc.PlateT_000, 180, center=App.Vector(0, 0, 0), copy=True) group.addObjects([plt, plb]) if self.section_prop[ISLRPLATE]: width = self.section_prop[LV] height = self.section_prop[TV] x = obj.Shape.OuterWire.BoundBox.XMax + height / 2 p5 = App.Vector(x, 0, 0) plr = ArchProfile.makeProfile( [0, 'PlateR', 'PlateR' + '_000', 'R', height, width]) gui.getObject(plr.Label).LineColor = (0.0, 1.0, 0.0) Draft.move(doc.PlateR_000, p5) pll = Draft.rotate(doc.PlateR_000, 180, center=App.Vector(0, 0, 0), copy=True) group.addObjects([plr, pll]) if self.section_prop[ISWEBPLATE]: width = self.section_prop[LW] height = self.section_prop[TW] x = obj.Shape.BoundBox.Center.x + (obj.WebThickness.Value + height) / 2 p6 = App.Vector(x, 0, 0) plwr = ArchProfile.makeProfile( [0, 'PlateWR', 'PlateWR' + '_000', 'R', height, width]) gui.getObject(plwr.Label).LineColor = (0.0, 1.0, 0.0) Draft.move(doc.PlateWR_000, p6) plwl = Draft.rotate(doc.PlateWR_000, 180, center=App.Vector(0, 0, 0), copy=True) group.addObjects([plwr, plwl]) Gui.runCommand("Std_DrawStyle", 3) # Wireframe doc.recompute()