Draft Edit improvements

A forum dedicated to the Draft, Arch and BIM workbenches development.
paullee
Posts: 2661
Joined: Wed May 04, 2016 3:58 pm

Re: Draft Edit improvements

Postby paullee » Sun Jan 05, 2020 12:17 am

Looks great !
User avatar
Pauvres_honteux
Posts: 365
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Draft Edit improvements

Postby Pauvres_honteux » Mon Jan 06, 2020 9:03 am

Ooohh! Direct 3D editing, fancy!
May I add the feature request to double click on the object which then starts the editing? Then you can get rid of that side menu once and for all !
Or replace that side menu with a pop-up window for a finer keyboard control.
carlopav
Posts: 1566
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft Edit improvements

Postby carlopav » Mon Jan 06, 2020 9:26 am

Pauvres_honteux wrote:
Mon Jan 06, 2020 9:03 am
Ooohh! Direct 3D editing, fancy!
Just a small attempt in that direction, the tool have almost always been there, I'm just giving some love in the last year, expecially thanks to @looo work on pivy graphics.
May I add the feature request to double click on the object which then starts the editing? Then you can get rid of that side menu once and for all !
Or replace that side menu with a pop-up window for a finer keyboard control.
At the moment, you can start editing Draft objects by double clicking on them in the document tree, by using the toolbar button, or by pressing "D,E" (form within draft and arch wbs).
For other objects we just have a preliminary support for some Part objects like line, and cube.

Double clicking on the 3d view is ATM used for selecting the whole object.

It would be nice to have a global system to set and display editpoints for enabled object all around FreeCAD.
follow my experiments on BIM modelling for architecture design
User avatar
Pauvres_honteux
Posts: 365
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Draft Edit improvements

Postby Pauvres_honteux » Mon Jan 06, 2020 9:35 am

carlopav wrote:
Mon Jan 06, 2020 9:26 am
Double clicking on the 3d view is ATM used for selecting the whole object.
It would be nice to have a global system to set and display editpoints for enabled object all around FreeCAD.
Move versus edit objects
carlopav
Posts: 1566
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft Edit improvements

Postby carlopav » Mon Jan 06, 2020 6:31 pm

yorik wrote: ping
vocx wrote: ping
In the splitting mood of Draft Edit (something i already posted a lot about):
what if every Draft Object contains a function:
_obj.get_edit_points(self, obj) returns the list of editpoints, used to create and to update trackers and to display preview ghost.
and
_obj.update_by_edit_point(self, obj, node_idx, v) update the object.

so Draft Edit can just call:
editpoints = obj.Proxy.get_edit_points(obj)
and
obj.Proxy.update_by_edit_point(obj, node_idx, v)

@vocx, I can split it like this before or after the Draft main splitting task, according to your needs. And i'd like to start from bezier curve, since it's a lot of code.

In this way every developer that wants to provide Draft Edit support for his workbench custom objects, can just add this two methods.
Draft Edit will just contain the code for other objects like Part ones.
follow my experiments on BIM modelling for architecture design
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft Edit improvements

Postby vocx » Tue Jan 07, 2020 5:08 am

carlopav wrote:
Mon Jan 06, 2020 6:31 pm
...

@vocx, I can split it like this before or after the Draft main splitting task, according to your needs. And i'd like to start from bezier curve, since it's a lot of code.

In this way every developer that wants to provide Draft Edit support for his workbench custom objects, can just add this two methods.
Draft Edit will just contain the code for other objects like Part ones.
Oh man, I haven't taken a look at Draft Edit because I'm so busy looking into the other things, and documentation, and well, stuff.

But it sounds good. This is probably the way to do it. To start, I would suggest not adding the code to the object classes in Draft.py, but to externalize the editing code to a separate module that is imported from DraftEdit.py. Why? Well, Draft.py is already pretty big, we should try to find ways to shave code off this file. This is what I'm doing with my pull requests #2829 to #2832.

Something like this.

Code: Select all

# in a new module draftedit/edit_circle.py
def get_edit_points(obj):

def update_by_edit_point(obj, node_idx, v):

# Does it have to be methods of a class? I don't know, you tell me!
Then in DraftEdit.py

Code: Select all

import draftedit.edit_circle

editpoints = draftedit.edit_circle.get_edit_points(obj)
draftedit.edit_circle.update_by_edit_point(obj, node_idx, v)
By the way, the "splitting of the main objects from the main Draft.py" is very difficult, I think I will look into the Gui Commands first, that is, those defined in the DraftTools.py file.
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
Posts: 1566
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft Edit improvements

Postby carlopav » Fri Apr 10, 2020 9:59 am

To not lose your old list of desires yorik and have it at the end of the topic :)
yorik wrote:
Sat Apr 06, 2019 7:39 pm
- Be able to work on just any kind of shape-based FreeCAD object
- Be able to work on multiple objects at a same time
- Make a better and reliable way to click edit points
- Be able to recognize and sort the internal geometry of objects (which edge belongs to what face, what is an arc, what is a line, etc)
- For objects of a known parametric type, ex. Draft objects, it would allow to store the changes parametrically, for others it would just edit the shape
- Be able to work on just any kind of shape-based FreeCAD object
- Be able to work on multiple objects at a same time
- Make a better and reliable way to click edit points
- Be able to recognize and sort the internal geometry of objects (which edge belongs to what face, what is an arc, what is a line, etc)
- For objects of a known parametric type, ex. Draft objects, it would allow to store the changes parametrically, for others it would just edit the shape

I striked the things that are working at the moment, perhaps I can go back to the others (in the future) since I'm starting to understand more how Part works.
follow my experiments on BIM modelling for architecture design
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft Edit improvements

Postby vocx » Fri Apr 10, 2020 4:30 pm

carlopav wrote:
Fri Apr 10, 2020 9:59 am
...
- For objects of a known parametric type, ex. Draft objects, it would allow to store the changes parametrically, for others it would just edit the shape
By the way, I noticed the Draft Ellipse can't be edited. Why is this? Can't this just be edited like a rectangle? When it is created, a rectangle tracker is shown, so I think the same could be done when editing.
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
Posts: 1566
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft Edit improvements

Postby carlopav » Fri Apr 10, 2020 4:34 pm

vocx wrote:
Fri Apr 10, 2020 4:30 pm
By the way, I noticed the Draft Ellipse can't be edited. Why is this? Can't this just be edited like a rectangle?
Yes, of course, but maybe it's more intuitive to display a center points and the 4 quadrants (or just 2 radius).
Isn't it?
I was planning to split it into many module as you suggested, so we can have:
gui_edit
gui_edit_rectangle
gui_edit_wall
etc...
What do you think? any preference for naming?
follow my experiments on BIM modelling for architecture design
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Draft Edit improvements

Postby vocx » Fri Apr 10, 2020 4:48 pm

carlopav wrote:
Fri Apr 10, 2020 4:34 pm
...
What do you think? any preference for naming?
Okay, in that case maybe creating a subdirectory would make sense.

Code: Select all

draftguitools/
    gui_edit/
        __init__.py
        edit_rectangle.py
        edit_ellipse.py
        ...
Since these classes aren't saved in the document, we can pretty much rename them as we want to see what works best.

And about the ellipse. It all depends on how you create it. If you create it as a rectangle, then you should be able to edit it as a rectangle. If you define a new Gui Command to create the ellipse with the semi-major and semi-minor axes, then you should be able to edit it like this as well.
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.