diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index 14a9a3f80..379730903 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -97,6 +97,9 @@ class _CommandStructure: import DraftTrackers self.points = [] self.tracker = DraftTrackers.boxTracker() + self.tracker.width(self.Width) + self.tracker.height(self.Height) + self.tracker.length(self.Length) self.tracker.on() FreeCADGui.Snapper.getPoint(callback=self.getPoint,movecallback=self.update,extradlg=self.taskbox()) diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index 91d3f26f6..9fd625b82 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -136,6 +136,7 @@ class _CommandWall: self.Width = 0.1 self.Height = 1 self.Align = "Center" + self.Length = None self.continueCmd = False p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") self.JOIN_WALLS = p.GetBool("joinWallSketches") @@ -223,12 +224,24 @@ class _CommandWall: else: dv = DraftVecUtils.neg(dv) self.tracker.update([b.add(dv),point.add(dv)]) + if self.Length: + self.Length.setValue(bv.Length) def taskbox(self): "sets up a taskbox widget" w = QtGui.QWidget() w.setWindowTitle(str(translate("Arch","Wall options"))) lay0 = QtGui.QVBoxLayout(w) + + lay5 = QtGui.QHBoxLayout() + lay0.addLayout(lay5) + label5 = QtGui.QLabel(str(translate("Arch","Length"))) + lay5.addWidget(label5) + self.Length = QtGui.QDoubleSpinBox() + self.Length.setDecimals(2) + self.Length.setValue(0.00) + lay5.addWidget(self.Length) + lay1 = QtGui.QHBoxLayout() lay0.addLayout(lay1) label1 = QtGui.QLabel(str(translate("Arch","Width"))) @@ -237,6 +250,7 @@ class _CommandWall: value1.setDecimals(2) value1.setValue(self.Width) lay1.addWidget(value1) + lay2 = QtGui.QHBoxLayout() lay0.addLayout(lay2) label2 = QtGui.QLabel(str(translate("Arch","Height"))) @@ -245,6 +259,7 @@ class _CommandWall: value2.setDecimals(2) value2.setValue(self.Height) lay2.addWidget(value2) + lay3 = QtGui.QHBoxLayout() lay0.addLayout(lay3) label3 = QtGui.QLabel(str(translate("Arch","Alignment"))) @@ -254,6 +269,7 @@ class _CommandWall: value3.addItems(items) value3.setCurrentIndex(items.index(self.Align)) lay3.addWidget(value3) + value4 = QtGui.QCheckBox(str(translate("Arch","Continue"))) lay0.addWidget(value4) QtCore.QObject.connect(value1,QtCore.SIGNAL("valueChanged(double)"),self.setWidth) diff --git a/src/Mod/Draft/DraftSnap.py b/src/Mod/Draft/DraftSnap.py index 24d6cdb08..685bce591 100644 --- a/src/Mod/Draft/DraftSnap.py +++ b/src/Mod/Draft/DraftSnap.py @@ -242,6 +242,7 @@ class Snapper: comp = self.snapInfo['Component'] if (Draft.getType(obj) == "Wall") and not oldActive: + # special snapping for wall: only to its base shape (except when CTRL is pressed) edges = [] for o in [obj]+obj.Additions: if Draft.getType(o) == "Wall": @@ -253,6 +254,19 @@ class Snapper: snaps.extend(self.snapToPerpendicular(edge,lastpoint)) snaps.extend(self.snapToIntersection(edge)) snaps.extend(self.snapToElines(edge,eline)) + + elif (Draft.getType(obj) == "Structure") and not oldActive: + # special snapping for struct: only to its base point (except when CTRL is pressed) + if obj.Base: + for edge in o.Base.Shape.Edges: + snaps.extend(self.snapToEndpoints(edge)) + snaps.extend(self.snapToMidpoint(edge)) + snaps.extend(self.snapToPerpendicular(edge,lastpoint)) + snaps.extend(self.snapToIntersection(edge)) + snaps.extend(self.snapToElines(edge,eline)) + else: + b = obj.Placement.Base + snaps.append([b,'endpoint',b]) elif obj.isDerivedFrom("Part::Feature"): if (not self.maxEdges) or (len(obj.Edges) <= self.maxEdges): @@ -341,9 +355,8 @@ class Snapper: # set the arch point tracking if self.lastArchPoint: self.setArchDims(self.lastArchPoint,fp) - if Draft.getType(obj) == "Wall": - if self.lastArchPoint != fp: - self.lastArchPoint = fp + if Draft.getType(obj) in ["Wall","Structure"]: + self.lastArchPoint = winner[2] else: self.lastArchPoint = None @@ -734,6 +747,7 @@ class Snapper: if Draft.getParam("hideSnapBar"): self.toolbar.hide() self.mask = None + self.lastArchPoint = None def constrain(self,point,basepoint=None,axis=None): '''constrain(point,basepoint=None,axis=None: Returns a diff --git a/src/Mod/Draft/DraftTrackers.py b/src/Mod/Draft/DraftTrackers.py index 89b4d9935..f672cad5b 100644 --- a/src/Mod/Draft/DraftTrackers.py +++ b/src/Mod/Draft/DraftTrackers.py @@ -805,7 +805,13 @@ class archDimTracker(Tracker): self.dimnode.param1.setValue(.5) p1 = Vector(self.dimnode.pnts.getValues()[0].getValue()) p2 = Vector(self.dimnode.pnts.getValues()[-1].getValue()) - self.Distance = p2.sub(p1).Length + m = self.dimnode.datumtype.getValue() + if m == 2: + self.Distance = (DraftVecUtils.project(p2.sub(p1),Vector(1,0,0))).Length + elif m == 3: + self.Distance = (DraftVecUtils.project(p2.sub(p1),Vector(0,1,0))).Length + else: + self.Distance = (p2.sub(p1)).Length if not text: text = Draft.getParam("dimPrecision") text = "%."+str(text)+"f"