OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16131 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: 3129ae4296e40ed20e7b3d460b86e6969acbe1c3
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Russian/Russia (ru_RU)
So i made a BSpline in Draft WB, snapped to the imported, 3d scanned, mesh. But immediately has a problem - not all points is sellectable, so i cannot move them to edit curve.
Ok, i started to look why. Quickly get into the DraftTool.py, and found the "action(self,arg)" method(elif arg["Type"] == "SoMouseButtonEvent" part of it), all mouse clicks go into there. added alot of prints, to check out what is going on. That gave me following results
1) Curve goes under mesh itself, so even if "Preselected" on the bottom show, for example "EditNode12", click on that place return object name"untitled", not sure what it is. Not sure how to fix that.
2) Curve line is visible, "Preselected" on the bottom show, for example "EditNode12", but clicking there return object called "Edge1", seems to be that line name. In other part of DW code there is a special actin takend about that - if user clicked on a line then nearest EditNode is searched, but not in point edit/add/delete modes. I will try to add similar code and see if it help.
I would like to ask,
1) is there a way to select point to edit not by clicks but from a list, like a "Elements" list in sketch editor.
2) Maybe ther is some code i can drop in console together with Node number i want to edit, to enter mouse movement edit
3) Or atlest, how to get that "Preselected" object, and not ask what was clicked thru
Code: Select all
p = FreeCADGui.ActiveDocument.ActiveView.getCursorPos()
info = FreeCADGui.ActiveDocument.ActiveView.getObjectInfo(p)
here is the code i edited
Code: Select all
elif arg["Type"] == "SoMouseButtonEvent":
if (arg["State"] == "DOWN") and (arg["Button"] == "BUTTON1"):
self.ui.redraw()
print("SoMouseButtonEvent")
if self.editing == None:
print("self.editing == None")
p = FreeCADGui.ActiveDocument.ActiveView.getCursorPos()
info = FreeCADGui.ActiveDocument.ActiveView.getObjectInfo(p)
if info:
if info["Object"] != self.obj.Name:
print(info["Object"])
return
if self.ui.addButton.isChecked() \
and Draft.getType(self.obj) == "Wire" \
and 'Edge' in info["Component"]:
self.addPointOnEdge(FreeCAD.Vector(info["x"],info["y"],info["z"]), int(info["Component"][4:]))
print("1")
elif self.ui.addButton.isChecked():
print("2")
if self.point:
pt = self.point
if "x" in info:
# prefer "real" 3D location over working-plane-driven one if possible
pt = FreeCAD.Vector(info["x"],info["y"],info["z"])
self.addPoint(pt,info)
elif self.ui.delButton.isChecked():
print("3")
if 'EditNode' in info["Component"]:
self.delPoint(int(info["Component"][8:]))
# don't do tan/sym on DWire/BSpline!
elif ((Draft.getType(self.obj) == "BezCurve") and
(self.ui.sharpButton.isChecked())):
print("4")
if 'EditNode' in info["Component"]:
self.smoothBezPoint(int(info["Component"][8:]), info, 'Sharp')
elif ((Draft.getType(self.obj) == "BezCurve") and
(self.ui.tangentButton.isChecked())):
print("5")
if 'EditNode' in info["Component"]:
self.smoothBezPoint(int(info["Component"][8:]), info, 'Tangent')
elif ((Draft.getType(self.obj) == "BezCurve") and
(self.ui.symmetricButton.isChecked())):
print("6")
if 'EditNode' in info["Component"]:
self.smoothBezPoint(int(info["Component"][8:]), info, 'Symmetric')
elif 'EditNode' in info["Component"]:
print("EditNode ", info["Component"])
self.ui.pointUi()
self.ui.isRelative.show()
self.editing = int(info["Component"][8:])
self.trackers[self.editing].off()
if hasattr(self.obj.ViewObject,"Selectable"):
self.obj.ViewObject.Selectable = False
self.node.append(self.trackers[self.editing].get())
FreeCADGui.Snapper.setSelectMode(False)
else:
print("total else")
print("info component: ", info["Component"])
else:
print("not even a info!")
else:
print("self.editing != None -> else")
self.trackers[self.editing].on()
#if hasattr(self.obj.ViewObject,"Selectable"):
# self.obj.ViewObject.Selectable = True
FreeCADGui.Snapper.setSelectMode(True)
self.numericInput(self.trackers[self.editing].get())