TechDraw ordinate dimensioning

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
wandererfan
Veteran
Posts: 6265
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: TechDraw ordinate dimensioning

Post by wandererfan »

kemes wrote: Thu Mar 24, 2022 1:17 pm @wandererfan I would like to contribute to the development of this function. I don't have any prior experience in FC dev. Where would you suggest to look at to get things rolling? A similar function etc?
That's great! There is always more work than there are workers.

You could start with these files:
src/Mod/TechDraw/App/DrawViewDimension.cpp is the dimension DocumentObject
src/Mod/TechDraw/Gui/QGIViewDimension.cpp does the drawing.
src/Mod/TechDraw/Gui/CommandCreateDims.cpp handles the buttons and commands.
src/Mod/TechDraw/Gui/ViewProviderDimension.cpp bridges the App side to the Gui side.

You might want to look at Gui/CommandExtensionDims.cpp which has functions for chain dimensions, etc.

The biggest hurdle to overcome is that the existing dimensions all refer to 1 edge or 2 vertices and have a single value. Ordinate dimensions are going to need to refer to n vertices and produce n-1 values.

Feel free to come back with questions.

PS. were you thinking about doing this in C++ or Python? If you choose Python, we'll have to expose more of the inner workings of Dimensions to Python. Probably not a bad thing in the long run.
User avatar
kemes
Posts: 63
Joined: Wed Mar 02, 2022 8:05 am

Re: TechDraw ordinate dimensioning

Post by kemes »

wandererfan wrote: Thu Mar 24, 2022 1:43 pm That's great! There is always more work than there are workers.

You could start with these files:
src/Mod/TechDraw/App/DrawViewDimension.cpp is the dimension DocumentObject
src/Mod/TechDraw/Gui/QGIViewDimension.cpp does the drawing.
src/Mod/TechDraw/Gui/CommandCreateDims.cpp handles the buttons and commands.
src/Mod/TechDraw/Gui/ViewProviderDimension.cpp bridges the App side to the Gui side.

You might want to look at Gui/CommandExtensionDims.cpp which has functions for chain dimensions, etc.

The biggest hurdle to overcome is that the existing dimensions all refer to 1 edge or 2 vertices and have a single value. Ordinate dimensions are going to need to refer to n vertices and produce n-1 values.

Feel free to come back with questions.

PS. were you thinking about doing this in C++ or Python? If you choose Python, we'll have to expose more of the inner workings of Dimensions to Python. Probably not a bad thing in the long run.
Thanks for the intro. I will have a look into these files. I don't have any prior experience in C++ but definitely would want to learn it. My experience lies in C (embedded systems), Python and Web related technologies.

I'll next try to understand the current content (the files you mentioned) and I'll get back to you afterwards. I'll probably need guidance on defining the flow, in which order should things be done. I have a lot to learn.
User avatar
kemes
Posts: 63
Joined: Wed Mar 02, 2022 8:05 am

Re: TechDraw ordinate dimensioning

Post by kemes »

Last edited by kemes on Sun Apr 03, 2022 8:43 pm, edited 1 time in total.
User avatar
kemes
Posts: 63
Joined: Wed Mar 02, 2022 8:05 am

Re: TechDraw ordinate dimensioning

Post by kemes »

Started easy by adding the icons for Vert and Horiz Ordinate Dimensions -functions. Next would be adding them to the toolbar. Baby steps :lol:

commit fede3f8c5faa04816f23fa5835cc3b56972eabd8
Attachments
icons.png
icons.png (21.43 KiB) Viewed 2370 times
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: TechDraw ordinate dimensioning

Post by Kunda1 »

@kemes, do you mind creating a new git branch on your fork (so you're not committing changes to the 'master' branch). So when you make a PR you're doing it from your own branch against master.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
kemes
Posts: 63
Joined: Wed Mar 02, 2022 8:05 am

Re: TechDraw ordinate dimensioning

Post by kemes »

Kunda1 wrote: Sun Apr 03, 2022 8:33 pm @kemes, do you mind creating a new git branch on your fork (so you're not committing changes to the 'master' branch). So when you make a PR you're doing it from your own branch against master.
I was about to ask about this. Thanks for the guidance, will create a new branch.
Last edited by kemes on Sun Apr 03, 2022 8:39 pm, edited 1 time in total.
User avatar
kemes
Posts: 63
Joined: Wed Mar 02, 2022 8:05 am

Re: TechDraw ordinate dimensioning

Post by kemes »

Created a branch called techdraw_ordinate_dimensions
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: TechDraw ordinate dimensioning

Post by Kunda1 »

Well played 8-)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
wandererfan
Veteran
Posts: 6265
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: TechDraw ordinate dimensioning

Post by wandererfan »

kemes wrote: Sun Apr 03, 2022 8:16 pm Started easy by adding the icons for Vert and Horiz Ordinate Dimensions -functions. Next would be adding them to the toolbar. Baby steps :lol:
Good place to start, nothing wrong with baby steps. You could probably make a "do nothing" command that would put your new icons onto the toolbar as a next step. See CommandExtensionDims.cpp and Workbench.cpp.

Very minor detail, but the icons look like they were saved as "Inkscape svg". A better choice is to save as "plain svg".
User avatar
kemes
Posts: 63
Joined: Wed Mar 02, 2022 8:05 am

Re: TechDraw ordinate dimensioning

Post by kemes »

wandererfan wrote: Tue Apr 05, 2022 1:19 pm Good place to start, nothing wrong with baby steps. You could probably make a "do nothing" command that would put your new icons onto the toolbar as a next step. See CommandExtensionDims.cpp and Workbench.cpp.
Thank you for the tips!

wandererfan wrote: Tue Apr 05, 2022 1:19 pm
Very minor detail, but the icons look like they were saved as "Inkscape svg". A better choice is to save as "plain svg".
All the icons from the TechDrawTools (now used in TechDraw) seems to be Inkscape svg. I followed this.
Post Reply