Arch: Fixed bug that builds a structure on top of another structure

This commit is contained in:
Yorik van Havre 2013-10-08 16:31:02 -03:00
parent 1e860356e7
commit dceed60c98

View File

@ -352,32 +352,34 @@ class _CommandStructure:
self.continueCmd = False self.continueCmd = False
sel = FreeCADGui.Selection.getSelection() sel = FreeCADGui.Selection.getSelection()
if sel: if sel:
# direct creation if Draft.getType(sel[0]) != "Structure":
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Structure"))) # direct creation
FreeCADGui.doCommand("import Arch") FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Structure")))
# if selection contains structs and axes, make a system FreeCADGui.doCommand("import Arch")
st = Draft.getObjectsOfType(sel,"Structure") # if selection contains structs and axes, make a system
ax = Draft.getObjectsOfType(sel,"Axis") st = Draft.getObjectsOfType(sel,"Structure")
if st and ax: ax = Draft.getObjectsOfType(sel,"Axis")
FreeCADGui.doCommand("Arch.makeStructuralSystem(" + ArchCommands.getStringList(st) + "," + ArchCommands.getStringList(ax) + ")") if st and ax:
else: FreeCADGui.doCommand("Arch.makeStructuralSystem(" + ArchCommands.getStringList(st) + "," + ArchCommands.getStringList(ax) + ")")
# else, do normal structs else:
for obj in sel: # else, do normal structs
FreeCADGui.doCommand("Arch.makeStructure(FreeCAD.ActiveDocument." + obj.Name + ")") for obj in sel:
FreeCAD.ActiveDocument.commitTransaction() FreeCADGui.doCommand("Arch.makeStructure(FreeCAD.ActiveDocument." + obj.Name + ")")
FreeCAD.ActiveDocument.recompute() FreeCAD.ActiveDocument.commitTransaction()
else: FreeCAD.ActiveDocument.recompute()
# interactive mode return
if hasattr(FreeCAD,"DraftWorkingPlane"):
FreeCAD.DraftWorkingPlane.setup() # interactive mode
import DraftTrackers if hasattr(FreeCAD,"DraftWorkingPlane"):
self.points = [] FreeCAD.DraftWorkingPlane.setup()
self.tracker = DraftTrackers.boxTracker() import DraftTrackers
self.tracker.width(self.Width) self.points = []
self.tracker.height(self.Height) self.tracker = DraftTrackers.boxTracker()
self.tracker.length(self.Length) self.tracker.width(self.Width)
self.tracker.on() self.tracker.height(self.Height)
FreeCADGui.Snapper.getPoint(callback=self.getPoint,movecallback=self.update,extradlg=self.taskbox()) self.tracker.length(self.Length)
self.tracker.on()
FreeCADGui.Snapper.getPoint(callback=self.getPoint,movecallback=self.update,extradlg=self.taskbox())
def getPoint(self,point=None,obj=None): def getPoint(self,point=None,obj=None):
"this function is called by the snapper when it has a 3D point" "this function is called by the snapper when it has a 3D point"