New tool: Draft_Arc_3Points, Draft_CubicBezCurve, Draft_Edit_Improved

A forum dedicated to the Draft, Arch and BIM workbenches development.
vocx
Posts: 727
Joined: Thu Oct 18, 2018 9:18 pm

New tool: Draft_Arc_3Points, Draft_CubicBezCurve, Draft_Edit_Improved

Postby vocx » Sun May 12, 2019 8:41 pm

I think there was no announcement of the Draft Arc 3Points tool. It just came into existence by itself from BIM. Nice.

The Draft CubicBezCurve tool was designed by carlopav to behave like the Bezier tool in Inkscape; see Bezier curve tool bug. Currently its icon is the same as the original Draft BezCurve. I took the liberty of adding a new icon, to make it clear this is a 3rd degree Bezier. This is in the wiki already, but it isn't in the FreeCAD repository. Can Yorik add the new icon? Is it ugly? Any other suggestions?

The Draft Edit Improved tool is being developed by carlopav as well, in order to edit nodes; see Draft Edit improvements. I'm still not entirely sure how this tool is supposed to work. As it is in development I believe it currently behaves strangely. Please add the necessary information to the wiki.

Is this tool supposed to replace the normal Draft Edit tool? Or is it supposed to be used alongside it? I also took the liberty of adding a new icon for it on the wiki; I just added a "plus" sign to indicate it is "improved".

----

When the 3rd degree Bezier tool was added, a Draft BezierTools command was also added to serve as a container. This works okay.

Code: Select all

class CommandBezierGroup:
    def GetCommands(self):
        return tuple(['Draft_BezCurve','Draft_CubicBezCurve'])
    def GetResources(self):
        return { 'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_BezierTools",'Bezier tools'),
                 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_BezierTools",'Bezier tools')
               }
    def IsActive(self):
        return not FreeCAD.ActiveDocument is None
FreeCADGui.addCommand('Draft_BezCurve',BezCurve())
FreeCADGui.addCommand('Draft_CubicBezCurve',CubicBezCurve())
FreeCADGui.addCommand('Draft_BezierTools', CommandBezierGroup())
However, with the Draft Arc 3Points tool, there is also a Draft ArcTools container. This doesn't seem to work, and I don't know why.
FreeCAD_Draft_no_group.png
FreeCAD_Draft_no_group.png (18.2 KiB) Viewed 274 times

Code: Select all

class CommandArcGroup:
    def GetCommands(self):
        return tuple(['Draft_Arc','Draft_Arc_3Points'])
    def GetResources(self):
        return { 'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_ArcTools",'Arc tools'),
                 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_ArcTools",'Arc tools')
               }
    def IsActive(self):
        return not FreeCAD.ActiveDocument is None
FreeCADGui.addCommand('Draft_Arc',Arc())
FreeCADGui.addCommand('Draft_Arc_3Points',Draft_Arc_3Points())
FreeCADGui.addCommand('Draft_ArcTools', CommandArcGroup())
Attachments
Draft_Edit_Improved.svg
(19.83 KiB) Downloaded 3 times
Draft_CubicBezCurve.svg
(21.42 KiB) Downloaded 4 times
User avatar
yorik
Site Admin
Posts: 11395
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: New tool: Draft_Arc_3Points, Draft_CubicBezCurve, Draft_Edit_Improved

Postby yorik » Mon May 13, 2019 10:31 pm

Thanks for updating the docs! I forgot obviously :oops:

Your code seems correct... Do you change the entries in IntitGui.py (Draft_Arc -> Draft_ArcTools) too?
vocx
Posts: 727
Joined: Thu Oct 18, 2018 9:18 pm

Re: New tool: Draft_Arc_3Points, Draft_CubicBezCurve, Draft_Edit_Improved

Postby vocx » Mon May 13, 2019 10:45 pm

yorik wrote:
Mon May 13, 2019 10:31 pm
Thanks for updating the docs! I forgot obviously :oops:

Your code seems correct... Do you change the entries in IntitGui.py (Draft_Arc -> Draft_ArcTools) too?
Ha, that's not my code. It's carlopav's, I guess.

And about the Arc tools in InitGui.py, eh... I guess that's your code, no? Unless you intentionally didn't want to put the arc tools in a group.

By the way, I noticed that the Arch Workbench doesn't have the new Draft tools in its toolbar, right? I believe Arch's InitGui.py should be manually updated as well. Isn't there a way to automatically import that code from Draft's InitGui.py? This would be better to avoid repeating the same code in two different places.
Last edited by vocx on Tue May 14, 2019 7:10 am, edited 3 times in total.
carlopav
Posts: 195
Joined: Mon Dec 31, 2018 1:49 pm

Re: New tool: Draft_Arc_3Points, Draft_CubicBezCurve, Draft_Edit_Improved

Postby carlopav » Tue May 14, 2019 6:58 am

My fault! fixed with: https://github.com/FreeCAD/FreeCAD/pull/2171

About the three tools youu mentioned, sorry for not replying earlier :oops:

Draft 3points arc: added by Yorik, I tried to fix a small problem we have when creating a draft arc instead of a part arc. Still working on that.
Draft CubicBezier: still need some improvements since I noticed two problems on actual implementation:
  • several faults when using snap with it and sometimes not adding points as I wish
Draft Edit (improved is just used in the forum topic) I wish to keep the existing tool with some improvements i'm experimenting.

Thanks for the icons! I'll try to insert them ASAP!
And thanks for the wiki too!
User avatar
yorik
Site Admin
Posts: 11395
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: New tool: Draft_Arc_3Points, Draft_CubicBezCurve, Draft_Edit_Improved

Postby yorik » Tue May 14, 2019 2:22 pm

vocx wrote:
Mon May 13, 2019 10:45 pm
By the way, I noticed that the Arch Workbench doesn't have the new Draft tools in its toolbar, right? I believe Arch's InitGui.py should be manually updated as well. Isn't there a way to automatically import that code from Draft's InitGui.py? This would be better to avoid repeating the same code in two different places.
I'm actually thinking of removing the Draft tools from Arch entirely... This is becoming the job of the BIM WB actually, to gather tools from other WBs. This wouldkeep Arch more bare-minimal and easier to maintain..
carlopav
Posts: 195
Joined: Mon Dec 31, 2018 1:49 pm

Re: New tool: Draft_Arc_3Points, Draft_CubicBezCurve, Draft_Edit_Improved

Postby carlopav » Wed May 15, 2019 7:30 am

yorik wrote:
Tue May 14, 2019 2:22 pm
I'm actually thinking of removing the Draft tools from Arch entirely... This is becoming the job of the BIM WB actually, to gather tools from other WBs. This wouldkeep Arch more bare-minimal and easier to maintain..
+1
any plan to make bim a default wb?
User avatar
yorik
Site Admin
Posts: 11395
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: New tool: Draft_Arc_3Points, Draft_CubicBezCurve, Draft_Edit_Improved

Postby yorik » Wed May 15, 2019 9:33 pm

carlopav wrote:
Wed May 15, 2019 7:30 am
+1
any plan to make bim a default wb?
Well the idea basically was that being outside, it would be easier for someone to look at the code and want to modify it... However, so far that hasn't brought so great results :D

Maybe at the end we will rejoin it all in one, grand, unified workbench :) But let's keep the experience going for now...