Draft Edit improvements

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
ABeton
Posts: 150
Joined: Tue Sep 03, 2019 6:39 pm

Re: Draft Edit improvements

Post by ABeton »

vocx wrote: Mon Oct 14, 2019 10:39 pm
ABeton wrote: Mon Oct 14, 2019 10:36 pm Ok thanks :) , I will experiment with the context menu to see how much I can figure out.
Also see carlo's thread where he precisely implemented a function in the context menu for the Arch SectionPlane, [feature request] Section Plane - Cut View Context menu.
I am reading trough the thread now trying to figure out what carlo did.
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft Edit improvements

Post by carlopav »

ABeton wrote: Tue Oct 15, 2019 12:28 pm
Probably adding a context menu for when the user right click on the editing node is way more complicated.
The edit command have its own selection mechanism that rely on coin3d soraypickaction. So when the user moves the mouse around or click somewhere on the screen, Draft Edit evaluate the event and look for a node in the mouse position.
I was thinkin to make something happen when user right click somewhere and a node is nearby, but i didnt investigate much further.
Did you have a look at draft edit? did you understand less or more how it works? i'm sorry cause it's still in developing and not much documented...
follow my experiments on BIM modelling for architecture design
ABeton
Posts: 150
Joined: Tue Sep 03, 2019 6:39 pm

Re: Draft Edit improvements

Post by ABeton »

carlopav wrote: Tue Oct 15, 2019 12:52 pm
ABeton wrote: Tue Oct 15, 2019 12:28 pm
Probably adding a context menu for when the user right click on the editing node is way more complicated.
The edit command have its own selection mechanism that rely on coin3d soraypickaction. So when the user moves the mouse around or click somewhere on the screen, Draft Edit evaluate the event and look for a node in the mouse position.
I was thinkin to make something happen when user right click somewhere and a node is nearby, but i didnt investigate much further.
Did you have a look at draft edit? did you understand less or more how it works? i'm sorry cause it's still in developing and not much documented...
I looked at Draft and Arch section a bit to see what are ViewProviders. I saw that you implemented a context menu for the Arch section so I wanted to see how you did it.

My idea was to have a context menu depend on the type of the object that is selected. So for example if a line is selected, I would like to have a context menu with commands like: edit, move, rotate, stretch and maybe a couple of more. And if I select a wall or something else I would have a different context menu with some other commands. Something similar to the context menu that is used in sketcher, but with only five or six commands avalible. So it would be something like "If line is selected when you right click somewhere in the viewport you get a coressponding context menu." Maybe this is what vocx had in mind when he answered before but I am not sure :P
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft Edit improvements

Post by carlopav »

ABeton wrote: Tue Oct 15, 2019 1:02 pm Ok I understand better now. So to do it in the 3D view i will have to use some different code, something like what vocx posted in the other thread.
I thinks so. This https://github.com/FreeCAD/FreeCAD/blob ... -L160looks like the main place to handle context menu on the view. Probably if FreeCAD.activeDraftCommand.featureName == "Edit": something could happen!
follow my experiments on BIM modelling for architecture design
ABeton
Posts: 150
Joined: Tue Sep 03, 2019 6:39 pm

Re: Draft Edit improvements

Post by ABeton »

My end goal would be to have something like this in freecad.
Screenshot from 2019-10-15 15-20-10.png
Screenshot from 2019-10-15 15-20-10.png (12.91 KiB) Viewed 1637 times
Screenshot from 2019-10-15 15-19-50.png
Screenshot from 2019-10-15 15-19-50.png (25.65 KiB) Viewed 1637 times

a combination of an icon context menu and a text context menu.
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft Edit improvements

Post by carlopav »

That's interesting, maybe you can act as lots of things in freecad were developed: start with something simple and then figure out how to make it better day by day. I think achieving a proper text content menu is ATM a good challenge!
follow my experiments on BIM modelling for architecture design
ABeton
Posts: 150
Joined: Tue Sep 03, 2019 6:39 pm

Re: Draft Edit improvements

Post by ABeton »

carlopav wrote: Tue Oct 15, 2019 3:36 pm That's interesting, maybe you can act as lots of things in freecad were developed: start with something simple and then figure out how to make it better day by day. I think achieving a proper text content menu is ATM a good challenge!
That was my plan start simple and go from there.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft Edit improvements

Post by vocx »

Hey carlo, I noticed this string in the code

Code: Select all

FreeCAD.Console.PrintMessage(str(self.obj.Name)+str(": editing node: n° ")+str(ep)+"\n")
Which displays like this

Code: Select all

Wire: editing node: n° 2
I would avoid using the degree symbol. It is probably ASCII, and it should work okay everywhere, but I personally think it's best to avoid abbreviations. Using more explicit words is better for translation. That particular string is already a string so it doesn't need to be inside str(). I'd also use obj.Label so it matches the name that the user sees in the tree view.

Code: Select all

Msg = FreeCAD.Console.PrintMessage

_msg = QT_TRANSLATE_NOOP("Draft", "editing node")
Msg("{0}: {1} {2}\n".format(self.obj.Label, _msg, ep))
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.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft Edit improvements

Post by vocx »

Hey Carlo, in this same thread in page 6, you show an animated Gif of editing simultaneously various elements.

However, in the code this seems to be limited by a variable

Code: Select all

self.maxObjects = 1
https://github.com/FreeCAD/FreeCAD/blob ... dit.py#L67

What's the purpose of this? Were you trying things and disabled the multi-object edit?
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.
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft Edit improvements

Post by carlopav »

Ok for the degree symbol, I'll try to avoid it.
Multi object editing should already work, BUT the taskpanel is ATM made to handle just one object settings: we can edit contemporary a wire and a bezcurve, but just the option for one of them will be displayed. So I limited it at least until I move editing options from taskpanel to context menu (the menu should get the object from the clicked node).
follow my experiments on BIM modelling for architecture design
Post Reply