def Activated(self): sel = FreeCADGui.Selection.getSelection() p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") link = p.GetBool("FreeLinking",False) floorobj = [] warning = False for obj in sel : if not Draft.getType(obj) in ["Site", "Building"] : floorobj.append(obj) else : if link == True : floorobj.append(obj) else: warning = True if warning : message = translate( "Arch" , "You can put anything but Site, Building, Floor object in a Floor object.\n\ Floor object are not allowed to accept Site or Building object.\n\ Site, Building and Floor objects will be removed from the selection.\n\ You can change that in the preferences.\n" ) ArchCommands.printMessage( message ) if sel and len(floorobj) == 0: message = translate( "Arch" , "There is no valid object in the selection.\n\ Floor creation aborted.\n" ) ArchCommands.printMessage( message ) else : ss = "[ " for o in floorobj: ss += "FreeCAD.ActiveDocument." + o.Name + ", " ss += "]" FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Floor")) FreeCADGui.addModule("Arch") FreeCADGui.doCommand("Arch.makeFloor("+ss+")") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute()
def Activated(self): sel = FreeCADGui.Selection.getSelection() p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") link = p.GetBool("FreeLinking",False) siteobj = [] warning = False for obj in sel : if Draft.getType(obj) == "Building": siteobj.append(obj) else : if link == True : siteobj.append(obj) else: warning = True if warning : message = translate( "Arch" , "Please select only Building objects or nothing!\n\ Site are not allowed to accept other object than Building.\n\ Other objects will be removed from the selection.\n\ You can change that in the preferences." ) ArchCommands.printMessage( message ) if sel and len(siteobj) == 0: message = translate( "Arch" , "There is no valid object in the selection.\n\ Site creation aborted." ) ArchCommands.printMessage( message ) else : ss = "[ " for o in siteobj: ss += "FreeCAD.ActiveDocument." + o.Name + ", " ss += "]" FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Site")) FreeCADGui.addModule("Arch") FreeCADGui.doCommand("Arch.makeSite("+ss+")") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute()
def Activated(self): sel = FreeCADGui.Selection.getSelection() p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") link = p.GetBool("FreeLinking",False) buildingobj = [] warning = False for obj in sel : if not Draft.getType(obj) in ["Site", "Building"] : buildingobj.append(obj) else : if link == True : buildingobj.append(obj) else: warning = True if warning : message = translate( "Arch" , "You can put anything but Site and Building object in a Building object.\n\ Building object are not allowed to accept Site and Building object.\n\ Site and Building objects will be removed from the selection.\n\ You can change that in the preferences.\n" ) ArchCommands.printMessage( message ) if sel and len(buildingobj) == 0: message = translate( "Arch" , "There is no valid object in the selection.\n\ Building creation aborted.\n" ) ArchCommands.printMessage( message ) else : ss = "[ " for o in buildingobj: ss += "FreeCAD.ActiveDocument." + o.Name + ", " ss += "]" FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Building")) FreeCADGui.addModule("Arch") FreeCADGui.doCommand("Arch.makeBuilding("+ss+")") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute()
def Activated(self): sel = FreeCADGui.Selection.getSelectionEx() beam = sel[0].Object beam = 'FreeCAD.ActiveDocument.' + beam.Name structure = sel[0].Object.Base structure = 'FreeCAD.ActiveDocument.' + structure.Name face = sel[1].Object, sel[1].SubElementNames[0] face = '[FreeCAD.ActiveDocument.' + face[0].Name + ',"' + face[1] + '"]' if beam and face: FreeCAD.ActiveDocument.openTransaction( str(translate("Timber", "Create Cut Machining"))) FreeCADGui.addModule("Timber") FreeCADGui.addModule("ArchComponent") FreeCADGui.doCommand('m = Timber.makeTimberMachiningCut(' + structure + ' , ' + face + ')') FreeCADGui.doCommand('ArchComponent.addToComponent(' + beam + ' , ' + 'm, "Subtractions")') FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() else: ArchCommands.printMessage( translate( "Timber", "TimberMachiningcut need a reference plane and a beam to cut" )) print( translate( "Timber", "TimberMachiningcut need a reference plane and a beam to cut" ))
def Activated(self): """Executed when Arch Floor is called. Create a floor from the objects selected by the user, if any. Exclude objects that appear higher in the object hierarchy, such as sites or buildings. If free linking is enabled in the Arch preferences, allow higher hierarchy objects to be part of floors. """ sel = FreeCADGui.Selection.getSelection() p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") link = p.GetBool("FreeLinking", False) floorobj = [] warning = False for obj in sel: if not Draft.getType(obj) in ["Site", "Building"]: floorobj.append(obj) else: if link == True: floorobj.append(obj) else: warning = True if warning: message = translate( "Arch", "You can put anything but the following objects: Site, Building, and Floor - in a Floor object.\n\ Floor object is not allowed to accept Site, Building, or Floor objects.\n\ Site, Building, and Floor objects will be removed from the selection.\n\ You can change that in the preferences.") + "\n" ArchCommands.printMessage(message) if sel and len(floorobj) == 0: message = translate( "Arch", "There is no valid object in the selection.\n\ Floor creation aborted.") + "\n" ArchCommands.printMessage(message) else: ss = "[ " for o in floorobj: ss += "FreeCAD.ActiveDocument." + o.Name + ", " ss += "]" FreeCAD.ActiveDocument.openTransaction( translate("Arch", "Create Floor")) FreeCADGui.addModule("Arch") FreeCADGui.doCommand("obj = Arch.makeFloor(" + ss + ")") FreeCADGui.addModule("Draft") FreeCADGui.doCommand("Draft.autogroup(obj)") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute()
def Activated(self): sel = FreeCADGui.Selection.getSelectionEx() beam = sel[0].Object beam = 'FreeCAD.ActiveDocument.' + beam.Name structure = sel[0].Object.Base structure = 'FreeCAD.ActiveDocument.' + structure.Name face = sel[1].Object, sel[1].SubElementNames[0] face = '[FreeCAD.ActiveDocument.' + face[0].Name + ',"' + face[1] + '"]' if beam and face : FreeCAD.ActiveDocument.openTransaction(str(translate("Timber","Create Cut Machining"))) FreeCADGui.addModule("Timber") FreeCADGui.addModule("ArchComponent") FreeCADGui.doCommand('m = Timber.makeTimberMachiningCut(' + structure + ' , ' + face + ')') FreeCADGui.doCommand('ArchComponent.addToComponent(' + beam + ' , ' + 'm, "Subtractions")') FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() else : ArchCommands.printMessage(translate("Timber","TimberMachiningcut need a reference plane and a beam to cut")) print(translate("Timber","TimberMachiningcut need a reference plane and a beam to cut"))