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!
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft Edit improvements

Post by carlopav »

Thanks guys, i'm happy you appreciate the improvements :)
Basically what I'd like from user point of view:
- make nodes easier to deal with: preview mouseover, pop up a context menu (on mouseover or rightclick) to allow handling options without having to use task panel (adding points, removing points, change bezcurve node options);
- extend editing to every draft and arch object (maybe also to other wb objects);
- supporting preview during editing for every supported object type;
- make the tool "always active", so when the user select only one object, editing nodes are displayed.

That's all but i'm very far from that, and i'm having a quite busy time at work atm. :roll:
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 »

- make nodes easier to deal with: preview mouseover, pop up a context menu (on mouseover or rightclick) to allow handling options without having to use task panel (adding points, removing points, change bezcurve node options);
This would be a great improvement. A lot of things that use the task panel could be moved to the context menu. Like you said add and remove points, but also commands such as move, stretch and rotate could be in the context menu. This is how a lot of programs function for example ArchiCAD and BricsCAD. Would it be difficult to make the context menu asociative so that the options you have change when you select a different type of object? So a context menu for a line and wall would be different.

We could already have something like a context menu with the Command panel plugin.
Screenshot from 2019-10-12 12-13-45.png
Screenshot from 2019-10-12 12-13-45.png (228.24 KiB) Viewed 1820 times
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft Edit improvements

Post by vocx »

ABeton wrote: Sat Oct 12, 2019 10:15 am ...Would it be difficult to make the context menu asociative so that the options you have change when you select a different type of object? So a context menu for a line and wall would be different....
It is already possible to add context menus.

https://github.com/FreeCAD/FreeCAD/blob ... #L147-L160

Code: Select all

    def ContextMenu(self, recipient):
        if recipient == "View":
            if FreeCAD.activeDraftCommand is None:
                if FreeCADGui.Selection.getSelection():
                    self.appendContextMenu("Draft", self.cmdList + self.modList)
                    self.appendContextMenu("Utilities", self.treecmdList)
                else:
                    self.appendContextMenu("Draft", self.cmdList)
            else:
                if FreeCAD.activeDraftCommand.featureName == "Line":
                    self.appendContextMenu("", self.lineList)
        else:
            if FreeCADGui.Selection.getSelection():
                self.appendContextMenu("Utilities", self.treecmdList)
However, this isn't very smart at the moment. Probably a bigger list of objects should be considered.
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.
ABeton
Posts: 150
Joined: Tue Sep 03, 2019 6:39 pm

Re: Draft Edit improvements

Post by ABeton »

vocx wrote: Sat Oct 12, 2019 3:14 pm It is already possible to add context menus.

https://github.com/FreeCAD/FreeCAD/blob ... #L147-L160

Code: Select all

    def ContextMenu(self, recipient):
        if recipient == "View":
            if FreeCAD.activeDraftCommand is None:
                if FreeCADGui.Selection.getSelection():
                    self.appendContextMenu("Draft", self.cmdList + self.modList)
                    self.appendContextMenu("Utilities", self.treecmdList)
                else:
                    self.appendContextMenu("Draft", self.cmdList)
            else:
                if FreeCAD.activeDraftCommand.featureName == "Line":
                    self.appendContextMenu("", self.lineList)
        else:
            if FreeCADGui.Selection.getSelection():
                self.appendContextMenu("Utilities", self.treecmdList)
However, this isn't very smart at the moment. Probably a bigger list of objects should be considered.
Oh great than. Does adding new context menus require some pro level of Python, or can a relative novice(like my self) do it?
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft Edit improvements

Post by carlopav »

I think you can try! It's relatively funny to put your hands on the code :) I already gave one try some months ago but didnt succed at first attempt, so i concentrated on other stuff (mind that that's the first project I'm contributing and i'm not a programmer at all). Keep asking if we can give you some help!
follow my experiments on BIM modelling for architecture design
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft Edit improvements

Post by vocx »

ABeton wrote: Sun Oct 13, 2019 12:16 pm Oh great than. Does adding new context menus require some pro level of Python, or can a relative novice(like my self) do it?
Python is an easy to learn programming language because it has a very clean structure. You can read the code and almost understand what it does at a glance. In many cases the best way of learning is by copying parts of the code, modifying them, and testing if they work as you want. This is possible to do even if you don't know all features of the language.

For example, in the snippet above, it seems to test the currently active Draft tool; if it finds a match it displays one menu, otherwise, it displays a different menu. Maybe you can try different things with different tools (square, circle, rectangle, line, etc.), and see how it works.

Code: Select all

if FreeCAD.activeDraftCommand is None:
...
else:
    if FreeCAD.activeDraftCommand.featureName == "Line":
        self.appendContextMenu("", self.lineList)
    # Test for other objects
    if FreeCAD.activeDraftCommand.featureName == "Circle":
        self.appendContextMenu("", self.circleList)
    if FreeCAD.activeDraftCommand.featureName == "Rectangle":
        self.appendContextMenu("", self.rectangleList)
    ...
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.
ABeton
Posts: 150
Joined: Tue Sep 03, 2019 6:39 pm

Re: Draft Edit improvements

Post by ABeton »

I think you can try! It's relatively funny to put your hands on the code :) I already gave one try some months ago but didnt succed at first attempt, so i concentrated on other stuff (mind that that's the first project I'm contributing and i'm not a programmer at all). Keep asking if we can give you some help!
Will do, thanks for the support :D I will try to concentrate on some simple things first and go from there.
Python is an easy to learn programming language because it has a very clean structure. You can read the code and almost understand what it does at a glance. In many cases the best way of learning is by copying parts of the code, modifying them, and testing if they work as you want. This is possible to do even if you don't know all features of the language.

For example, in the snippet above, it seems to test the currently active Draft tool; if it finds a match it displays one menu, otherwise, it displays a different menu. Maybe you can try different things with different tools (square, circle, rectangle, line, etc.), and see how it works.
I did some coding in Python couple of years ago, but I forgot a lot :P It really is simple to use and a logical language.

I have one more question. I am not sure what is the context menu. Is it the one in the picture bellow?
Screenshot from 2019-10-15 00-16-03.png
Screenshot from 2019-10-15 00-16-03.png (38.96 KiB) Viewed 1736 times
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft Edit improvements

Post by vocx »

ABeton wrote: Mon Oct 14, 2019 10:18 pm ...
I have one more question. I am not sure what is the context menu. Is it the one in the picture bellow?
That's what we call the task panel.

The context menu is exactly as you thought initially, a right click menu.
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.
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:26 pm
ABeton wrote: Mon Oct 14, 2019 10:18 pm ...
I have one more question. I am not sure what is the context menu. Is it the one in the picture bellow?
That's what we call the task panel.

The context menu is exactly as you thought initially, a right click menu.
Ok thanks :) , I will experiment with the context menu to see how much I can figure out.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft Edit improvements

Post by vocx »

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.
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.
Post Reply