Draft: AutoGroup system
This commit is contained in:
@@ -244,7 +244,9 @@ Building creation aborted.\n" )
|
||||
ss += "]"
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Building"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.doCommand("Arch.makeBuilding("+ss+")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeBuilding("+ss+")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
@@ -1290,9 +1290,11 @@ class _CommandComponent:
|
||||
if sel:
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Component"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.Control.closeDialog()
|
||||
for o in sel:
|
||||
FreeCADGui.doCommand("Arch.makeComponent(FreeCAD.ActiveDocument."+o.Name+")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeComponent(FreeCAD.ActiveDocument."+o.Name+")")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
@@ -1313,9 +1315,11 @@ class _CommandCloneComponent:
|
||||
if sel:
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Component"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.Control.closeDialog()
|
||||
for o in sel:
|
||||
FreeCADGui.doCommand("Arch.cloneComponent(FreeCAD.ActiveDocument."+o.Name+")")
|
||||
FreeCADGui.doCommand("obj = Arch.cloneComponent(FreeCAD.ActiveDocument."+o.Name+")")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
@@ -192,7 +192,9 @@ class _CommandEquipment:
|
||||
base = s[0].Name
|
||||
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Equipment")))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.doCommand("Arch.makeEquipment(FreeCAD.ActiveDocument." + base + ")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeEquipment(FreeCAD.ActiveDocument." + base + ")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
# get diffuse color info from base object
|
||||
|
||||
@@ -103,7 +103,9 @@ Floor creation aborted.\n" )
|
||||
ss += "]"
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Floor"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.doCommand("Arch.makeFloor("+ss+")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeFloor("+ss+")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
@@ -84,7 +84,9 @@ class _CommandFrame:
|
||||
if len(s) == 2:
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Frame"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.doCommand("Arch.makeFrame(FreeCAD.ActiveDocument."+s[0].Name+",FreeCAD.ActiveDocument."+s[1].Name+")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeFrame(FreeCAD.ActiveDocument."+s[0].Name+",FreeCAD.ActiveDocument."+s[1].Name+")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
@@ -151,8 +151,10 @@ class CommandPanel:
|
||||
return
|
||||
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Panel")))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.addModule("Draft")
|
||||
for obj in sel:
|
||||
FreeCADGui.doCommand("Arch.makePanel(FreeCAD.ActiveDocument." + obj.Name + ",thickness=" + str(self.Thickness) + ")")
|
||||
FreeCADGui.doCommand("obj = Arch.makePanel(FreeCAD.ActiveDocument." + obj.Name + ",thickness=" + str(self.Thickness) + ")")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return
|
||||
|
||||
@@ -117,12 +117,16 @@ class _CommandPipe:
|
||||
if len(obj.Shape.Wires) == 1:
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Pipe"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.doCommand("Arch.makePipe(FreeCAD.ActiveDocument."+obj.Name+")")
|
||||
FreeCADGui.doCommand("obj = Arch.makePipe(FreeCAD.ActiveDocument."+obj.Name+")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
else:
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Pipe"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.doCommand("Arch.makePipe()")
|
||||
FreeCADGui.doCommand("obj = Arch.makePipe()")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
@@ -159,7 +163,9 @@ class _CommandPipeConnector:
|
||||
o += "]"
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Connector"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.doCommand("Arch.makePipeConnector("+o+")")
|
||||
FreeCADGui.doCommand("obj = Arch.makePipeConnector("+o+")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
@@ -139,7 +139,9 @@ class _CommandRoof:
|
||||
idx = int(sel.SubElementNames[0][4:])
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Roof"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.doCommand("Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+","+str(idx)+")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+","+str(idx)+")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return
|
||||
@@ -147,7 +149,9 @@ class _CommandRoof:
|
||||
if obj.Shape.Wires:
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Roof"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.doCommand("Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeRoof(FreeCAD.ActiveDocument."+obj.Name+")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return
|
||||
|
||||
@@ -290,7 +290,9 @@ Site creation aborted." )
|
||||
ss += "]"
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Site"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.doCommand("Arch.makeSite("+ss+")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeSite("+ss+")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
@@ -229,9 +229,11 @@ class _CommandSpace:
|
||||
if sel:
|
||||
FreeCADGui.Control.closeDialog()
|
||||
if len(sel) == 1:
|
||||
FreeCADGui.doCommand("Arch.makeSpace(FreeCADGui.Selection.getSelection())")
|
||||
FreeCADGui.doCommand("obj = Arch.makeSpace(FreeCADGui.Selection.getSelection())")
|
||||
else:
|
||||
FreeCADGui.doCommand("Arch.makeSpace(FreeCADGui.Selection.getSelectionEx())")
|
||||
FreeCADGui.doCommand("obj = Arch.makeSpace(FreeCADGui.Selection.getSelectionEx())")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
else:
|
||||
|
||||
@@ -91,9 +91,11 @@ class _CommandStairs:
|
||||
FreeCADGui.addModule("Arch")
|
||||
if len(FreeCADGui.Selection.getSelection()) == 1:
|
||||
n = FreeCADGui.Selection.getSelection()[0].Name
|
||||
FreeCADGui.doCommand("Arch.makeStairs(baseobj=FreeCAD.ActiveDocument."+n+")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeStairs(baseobj=FreeCAD.ActiveDocument."+n+")")
|
||||
else:
|
||||
FreeCADGui.doCommand("Arch.makeStairs(steps="+str(p.GetInt("StairsSteps",17))+")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeStairs(steps="+str(p.GetInt("StairsSteps",17))+")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
@@ -155,9 +155,11 @@ class _CommandStructure:
|
||||
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Structural System")))
|
||||
FreeCADGui.addModule("Arch")
|
||||
if st:
|
||||
FreeCADGui.doCommand("Arch.makeStructuralSystem(" + ArchCommands.getStringList(st) + "," + ArchCommands.getStringList(ax) + ")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeStructuralSystem(" + ArchCommands.getStringList(st) + "," + ArchCommands.getStringList(ax) + ")")
|
||||
else:
|
||||
FreeCADGui.doCommand("Arch.makeStructuralSystem(axes=" + ArchCommands.getStringList(ax) + ")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeStructuralSystem(axes=" + ArchCommands.getStringList(ax) + ")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return
|
||||
@@ -165,7 +167,9 @@ class _CommandStructure:
|
||||
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Structure")))
|
||||
FreeCADGui.addModule("Arch")
|
||||
for obj in sel:
|
||||
FreeCADGui.doCommand("Arch.makeStructure(FreeCAD.ActiveDocument." + obj.Name + ")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeStructure(FreeCAD.ActiveDocument." + obj.Name + ")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return
|
||||
@@ -226,6 +230,8 @@ class _CommandStructure:
|
||||
FreeCADGui.doCommand('s = Arch.makeStructure(length='+str(self.Length)+',width='+str(self.Width)+',height='+str(self.Height)+')')
|
||||
FreeCADGui.doCommand('s.Placement.Base = '+DraftVecUtils.toString(point))
|
||||
FreeCADGui.doCommand('s.Placement.Rotation=s.Placement.Rotation.multiply(FreeCAD.DraftWorkingPlane.getRotation().Rotation)')
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(s)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
if self.continueCmd:
|
||||
|
||||
@@ -198,12 +198,14 @@ class _CommandWall:
|
||||
if selobj.HasSubObjects:
|
||||
if "Face" in selobj.SubElementNames[0]:
|
||||
idx = int(selobj.SubElementNames[0][4:])
|
||||
FreeCADGui.doCommand("Arch.makeWall(FreeCAD.ActiveDocument."+selobj.Object.Name+",face="+str(idx)+")")
|
||||
FreeCADGui.doCommand("obj = Arch.makeWall(FreeCAD.ActiveDocument."+selobj.Object.Name+",face="+str(idx)+")")
|
||||
spacedone = True
|
||||
if not spacedone:
|
||||
FreeCADGui.doCommand('Arch.makeWall(FreeCAD.ActiveDocument.'+selobj.Object.Name+')')
|
||||
FreeCADGui.doCommand('obj = Arch.makeWall(FreeCAD.ActiveDocument.'+selobj.Object.Name+')')
|
||||
else:
|
||||
FreeCADGui.doCommand('Arch.makeWall(FreeCAD.ActiveDocument.'+selobj.Object.Name+')')
|
||||
FreeCADGui.doCommand('obj = Arch.makeWall(FreeCAD.ActiveDocument.'+selobj.Object.Name+')')
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
done = True
|
||||
@@ -273,6 +275,8 @@ class _CommandWall:
|
||||
FreeCADGui.doCommand('base.addGeometry(trace)')
|
||||
FreeCADGui.doCommand('wall = Arch.makeWall(base,width='+str(self.Width)+',height='+str(self.Height)+',align="'+str(self.Align)+'")')
|
||||
FreeCADGui.doCommand('wall.Normal = FreeCAD.DraftWorkingPlane.axis')
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(wall)")
|
||||
|
||||
def update(self,point,info):
|
||||
"this function is called by the Snapper when the mouse is moved"
|
||||
|
||||
@@ -57,7 +57,7 @@ class ArchWorkbench(Workbench):
|
||||
"Draft_Clone"]
|
||||
self.draftextratools = ["Draft_WireToBSpline","Draft_AddPoint","Draft_DelPoint","Draft_ShapeString",
|
||||
"Draft_PathArray","Draft_Mirror","Draft_Stretch"]
|
||||
self.draftcontexttools = ["Draft_ApplyStyle","Draft_ToggleDisplayMode","Draft_AddToGroup",
|
||||
self.draftcontexttools = ["Draft_ApplyStyle","Draft_ToggleDisplayMode","Draft_AddToGroup","Draft_AutoGroup",
|
||||
"Draft_SelectGroup","Draft_SelectPlane",
|
||||
"Draft_ShowSnapBar","Draft_ToggleGrid","Draft_UndoLine",
|
||||
"Draft_FinishLine","Draft_CloseLine"]
|
||||
|
||||
Reference in New Issue
Block a user