Draft Edit improvements

A forum dedicated to the Draft, Arch and BIM workbenches development.
paullee
Posts: 2150
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: 262
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: 809
Joined: Mon Dec 31, 2018 1:49 pm

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.
User avatar
Pauvres_honteux
Posts: 262
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: 809
Joined: Mon Dec 31, 2018 1:49 pm

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.
vocx
Posts: 3341
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.
To support the documentation effort, and code development, your donation is appreciated: paypal.