Draft BSpline - cant sellect point to edit

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
l3VGV
Posts: 47
Joined: Sat Oct 12, 2019 11:04 am

Draft BSpline - cant sellect point to edit

Post by l3VGV »

Hello. info first, right?

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)
and get reliable selection



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())


Image
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft BSpline - cant sellect point to edit

Post by carlopav »

l3VGV wrote: Sat Jan 25, 2020 3:51 pm
Hello and welcome to the forum. Draft Edit undergone a severe rearrangement, and many problems have already been fixed. I suggest you to try the 0.19 development version https://github.com/FreeCAD/FreeCAD/rele ... g/0.19_pre. (Try also "ALT+click" or "E" over a node to display editing options)
follow my experiments on BIM modelling for architecture design
l3VGV
Posts: 47
Joined: Sat Oct 12, 2019 11:04 am

Re: Draft BSpline - cant sellect point to edit

Post by l3VGV »

Thank you, 0.19 pre is able to work with points more reliable, no list tho, but all of them are selectable. But, mesh under them became so brigth yellow its intolerable.

Image
l3VGV
Posts: 47
Joined: Sat Oct 12, 2019 11:04 am

Re: Draft BSpline - cant sellect point to edit

Post by l3VGV »

carlopav wrote: Sat Jan 25, 2020 4:55 pm (Try also "ALT+click" or "E" over a node to display editing options)

That not doing anything. in 0.18
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft BSpline - cant sellect point to edit

Post by carlopav »

l3VGV wrote: Sat Jan 25, 2020 6:20 pm That not doing anything. in 0.18
Yup, it's a new feature of 0.19. Perhaps you can try disable preselection to avoid yellowish color of the mesh.
What are you trying to achieve?
l3VGV wrote: Sat Jan 25, 2020 6:09 pm no list tho
I didn't get this point.
follow my experiments on BIM modelling for architecture design
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft BSpline - cant sellect point to edit

Post by vocx »

carlopav wrote: Sat Jan 25, 2020 8:54 pm Yup, it's a new feature of 0.19. Perhaps you can try disable preselection to avoid yellowish color of the mesh.
Std_SelBoundingBox
I didn't get this point.
He means something that shows each point in the spline.

The points can be extracted from the Python console.

Code: Select all

App.ActiveDocument.BSpline.Points
[Vector (-46.38777857223375, -42.58202762192004, 0.0), Vector (-40.25145721435547, 5.343329429626465, 0.0), Vector (-0.6628562808036804, 17.902612686157227, 0.0), Vector (41.712005615234375, -35.03428649902344, 0.0), Vector (75.8059416101089, 26.901287247759793, 0.0)]
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
l3VGV
Posts: 47
Joined: Sat Oct 12, 2019 11:04 am

Re: Draft BSpline - cant sellect point to edit

Post by l3VGV »

carlopav wrote: Sat Jan 25, 2020 8:54 pm Perhaps you can try disable preselection to avoid yellowish color of the mesh.
What are you trying to achieve?
Disabling preselection helped with solid bodies, but mesh is getting yellow anyway. I found that if drawing style changed to flat lines, then only lines get yellow and that is not so terribly bright.

Im trying to reconstruct very curved body from a 3d scanned mesh. One idea was to make a surface from Bspline, and then pad it. No luck yet, such surface became curved in a very unexpected way. Seems i have to guess my control points more carefully.

best result yet
Image



in the end i want to edit that new body to 3d print it. Ive tryed to convert mesh to solid and then Embed one object into another, but after slicing all my mounting holes was gone. Meh.
carlopav wrote: Sat Jan 25, 2020 8:54 pm
l3VGV wrote: Sat Jan 25, 2020 6:09 pm no list tho
I didn't get this point.
As vocx said, i was thinking maybe if selection from 3d view is imposible to build some kind of mod, with a list of all points like elements list in sketch editor. That is not necessary now.
I have selection working but editing points with mouse is not easy anyway.
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft BSpline - cant sellect point to edit

Post by carlopav »

Probably you could move the draft working plane and constrain new created points to that plane with snap, so they will be planar and more easily usable as loft profile.
But I'm not sure Draft is the right tool to do that, probably better to also to have a look at Sketcher and Curves WBs.
follow my experiments on BIM modelling for architecture design
l3VGV
Posts: 47
Joined: Sat Oct 12, 2019 11:04 am

Re: Draft BSpline - cant sellect point to edit

Post by l3VGV »

Thank you for advice.

It seems i have to reevaluate my strategies.

I made a surface from B spline(FreeCad 0.19). Then extruded it. And now im trying to combine that body with another one, fuse it togeter. No luck at all

this is 2 parts i want to combine
Image

But, non of operation succeed - booleans, Fuse. Nether

Usualy i get total garbage like

Image

or

Image


Boolean operations seems to fail if body more complex then a cube with a hole.

Uh. Fusing with solid gave beter visual result, but fail to slice.
Well, all this is off topic anyway.
Post Reply