diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index c6fd4713ca..0947750031 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -448,13 +448,18 @@ def makeWire(pointslist,closed=False,placement=None,face=True,support=None): true (and wire is closed), the wire will appear filled. Instead of a pointslist, you can also pass a Part Wire.''' from draftlibs import fcgeo + import Part if not isinstance(pointslist,list): + e = pointslist.Wires[0].Edges + pointslist = Part.Wire(fcgeo.sortEdges(e)) nlist = [] for v in pointslist.Vertexes: nlist.append(v.Point) if fcgeo.isReallyClosed(pointslist): - nlist.append(pointslist.Vertexes[0].Point) + closed = True pointslist = nlist + print pointslist + print closed if placement: typecheck([(placement,FreeCAD.Placement)], "makeWire") if len(pointslist) == 2: fname = "Line" else: fname = "Wire" diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index b9588c342b..649f8db2b6 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -2359,10 +2359,11 @@ class Upgrade(Modifier): faces.append(f) for f in faces: if not curves: + msg(translate("draft", "Found a closed wire: making a Draft wire\n")) newob = Draft.makeWire(f.Wire,closed=True) else: # if there are curved segments, we do a non-parametric face - msg(translate("draft", "Found closed wires: making faces\n")) + msg(translate("draft", "Found a closed wire with curves: making a face\n")) newob = self.doc.addObject("Part::Feature","Face") newob.Shape = f Draft.formatObject(newob,lastob) @@ -3096,10 +3097,10 @@ class Edit(Modifier): if hasattr(self.obj.ViewObject,"Selectable"): self.selectstate = self.obj.ViewObject.Selectable self.obj.ViewObject.Selectable = False - if not Draft.getType(self.obj) in ["Wire","BSpline"]: - self.ui.setEditButtons(False) - else: + if Draft.getType(self.obj) in ["Wire","BSpline"]: self.ui.setEditButtons(True) + else: + self.ui.setEditButtons(False) self.editing = None self.editpoints = [] self.pl = None @@ -3137,13 +3138,13 @@ class Edit(Modifier): for ep in range(len(self.editpoints)): self.trackers.append(editTracker(self.editpoints[ep],self.obj.Name, ep,self.obj.ViewObject.LineColor)) - self.constraintrack = lineTracker(dotted=True) - self.call = self.view.addEventCallback("SoEvent",self.action) - self.running = True - plane.save() - if "Shape" in self.obj.PropertiesList: - plane.alignToFace(self.obj.Shape) - self.planetrack.set(self.editpoints[0]) + self.constraintrack = lineTracker(dotted=True) + self.call = self.view.addEventCallback("SoEvent",self.action) + self.running = True + plane.save() + if "Shape" in self.obj.PropertiesList: + plane.alignToFace(self.obj.Shape) + self.planetrack.set(self.editpoints[0]) else: msg(translate("draft", "This object type is not editable\n"),'warning') self.finish() @@ -3188,27 +3189,27 @@ class Edit(Modifier): elif arg["Type"] == "SoMouseButtonEvent": if (arg["State"] == "DOWN") and (arg["Button"] == "BUTTON1"): if self.editing == None: - snapped = self.view.getObjectInfo((arg["Position"][0],arg["Position"][1])) - if snapped: - if snapped['Object'] == self.obj.Name: + sel = FreeCADGui.Selection.getSelectionEx() + if sel: + sel = sel[0] + if sel.ObjectName == self.obj.Name: if self.ui.addButton.isChecked(): point,ctrlPoint = getPoint(self,arg) self.pos = arg["Position"] self.addPoint(point) elif self.ui.delButton.isChecked(): - if 'EditNode' in snapped['Component']: - self.delPoint(int(snapped['Component'][8:])) - elif 'EditNode' in snapped['Component']: + if 'EditNode' in sel.SubElementNames[0]: + self.delPoint(int(sel.SubElementNames[0][8:])) + elif 'EditNode' in sel.SubElementNames[0]: self.ui.pointUi() self.ui.isRelative.show() - self.editing = int(snapped['Component'][8:]) + self.editing = int(sel.SubElementNames[0][8:]) self.trackers[self.editing].off() if hasattr(self.obj.ViewObject,"Selectable"): self.obj.ViewObject.Selectable = False if "Points" in self.obj.PropertiesList: self.node.append(self.obj.Points[self.editing]) else: - print "finishing edit" self.trackers[self.editing].on() if hasattr(self.obj.ViewObject,"Selectable"): self.obj.ViewObject.Selectable = True