Macro: Version 3: helper tools to improve TechDraw documents

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
ngocminhdao88
Posts: 73
Joined: Wed Nov 11, 2020 10:43 am

Re: Macro: Version 3: helper tools to improve TechDraw documents

Post by ngocminhdao88 »

edi wrote: Sat Mar 06, 2021 8:43 am @ngocminhdao88: If I open your attached file taper-buchse.FCStd there is a very long model tree in the combo-view, having many items with red !.
I can't see anything in the 3D-View, and there is no Techdraw Page in the model tree.

To use the macro TechDrawTools you need an opened TechDraw Page, because the macros task is to extend a Techdraw drawing.

Techdraw views are connected automatic to there origin if they are top, bottom, left or right views. This can be seen as a ProjGroup in the model tree. But if you create a section view, it is unfortunately not connected to its origin. That is the reason, why I created the 'Position section tool'.
Hi edi,

i forgot to post my FreeCAD system. I am using FreeCAD from realthunder, maybe that caused the issue. About the projection views, yeah i should use this function more :)

OS: Ubuntu 20.04.2 LTS (i3/i3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 2021.0301.23964 +3306 (Git) AppImage
Build type: Release
Branch: LinkStage3
Hash: 32f78691fae500e494879493abc2b74cff9585d3
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.1
OCC version: 7.4.0
Locale: English/United States (en_US)
User avatar
chennes
Veteran
Posts: 3884
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Macro: Version 3: helper tools to improve TechDraw documents

Post by chennes »

This is really beautiful work, kudos to @edi for the great feature. I think this would be a very nice addition to the TD workbench, and I think from a technical standpoint that is completely possible. I imagine the plan would be for it to still exist as a sort of standalone tool, just activated via a command in the TD menu and/or toolbar?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: Macro: Version 3: helper tools to improve TechDraw documents

Post by aapo »

chennes wrote: Sat Mar 06, 2021 4:30 pm This is really beautiful work, kudos to @edi for the great feature. I think this would be a very nice addition to the TD workbench, and I think from a technical standpoint that is completely possible.
I fully agree with this, well done @edi!

I imagine the plan would be for it to still exist as a sort of standalone tool, just activated via a command in the TD menu and/or toolbar?
I like this kind of thinking. As a matter of fact, I'd like someone to re-write some of the UI side of TechDraw with Python, because (a) the current c++ implementation would need serious refactoring anyway, and (b) it'd be much easier to get UI developers to add stuff to TechDraw and fix UI bugs, if it'd be written in Python. However, it'd need a stable API on the c++ side, as some of the stuff should probably be just initiated from the Python side, and actually done on the c++ side (like Qt drawing of objects, dragging, etc). But I believe the UI buttons etc could well be done with Python, which would then command the positioning and creation of c++ written primitives (like Dimensions, CosmeticLines, Views, etc).

That way it'd possible to develop (some of) the new UI tools with Python, but the heavy plumbing like adding different Section View modes would, unfortunately, still need c++. As a first step to "Pythonize" the workbench UI, it'd indeed be nice to add this macro. The only thing that worries me a bit is keeping the c++ side of the TD object API stable, but I guess that's going to have to happen anyways.
edi
Posts: 481
Joined: Fri Jan 17, 2020 1:32 pm

Re: Macro: Version 3: helper tools to improve TechDraw documents

Post by edi »

chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: Macro: Version 3: helper tools to improve TechDraw documents

Post by chrisb »

:thumbsup:
Nice to see it immediately availble in AddonManager.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
ngocminhdao88
Posts: 73
Joined: Wed Nov 11, 2020 10:43 am

Re: Macro: Version 3: helper tools to improve TechDraw documents

Post by ngocminhdao88 »

Hi,

is there a way to draw a bolt circle for just two circles (⌀4,5)?
Image

I also want to draw a center line for slot. Is there a way to do it in TechDraw?
Image
Image
(source soliddna)
domad
Veteran
Posts: 2053
Joined: Mon Jun 22, 2020 12:16 pm

Re: Macro: Version 3: helper tools to improve TechDraw documents

Post by domad »

ngocminhdao88 wrote: Sun Mar 21, 2021 9:22 pm Hi,
.......
is there a way to draw a bolt circle for just two circles (⌀4,5)?
.......
I also want to draw a center line for slot. Is there a way to do it in TechDraw?
Hello ngocminhdao88
This, together with the macro, could solve (almost) all problems
https://forum.freecadweb.org/viewtopic.php?f=35&t=54499
the wiki
https://wiki.freecadweb.org/Advanced_TechDraw_Tutorial
also the axonometry dimensioning
https://forum.freecadweb.org/viewtopic.php?f=28&t=53848
ngocminhdao88
Posts: 73
Joined: Wed Nov 11, 2020 10:43 am

Re: Macro: Version 3: helper tools to improve TechDraw documents

Post by ngocminhdao88 »

Hi domad,

i see what you did there. You cloned the 3d object, modified it to fit the view (cut it in half or so) and created a sketch for cosmetic lines.

This method is powerful but time-consuming. But it will give me, what i want.

Thank you :D
edi
Posts: 481
Joined: Fri Jan 17, 2020 1:32 pm

Re: Macro: Version 3: helper tools to improve TechDraw documents

Post by edi »

@ngocminhdao88: Thanks for your suggestion. Find attached a short macro helping you to solve your problems.
TechDrawCosmeticArc.FCMacro
(1.91 KiB) Downloaded 86 times
TechDraw07.png
TechDraw07.png (14.56 KiB) Viewed 2802 times
The macro creates an arc of circle, using a cosmetic line.
Workflow:
- Open a TechDraw drawing.
- Select three vertexes: center - start - end
- Start the macro

Consider the following:
- The start point defines the radius
- The arc is allways plotted in math. positive sense (counterclockwise)

Hints:
- create a bolt circle with two circles by calling the macro twice, creating two half circles.
- create a vertex at the center of an existing arc by first drawing two centerlines, then creating their intersection.

This macro will be added to the next Version of TechDrawTools.FCMacro as a new tool.
ngocminhdao88
Posts: 73
Joined: Wed Nov 11, 2020 10:43 am

Re: Macro: Version 3: helper tools to improve TechDraw documents

Post by ngocminhdao88 »

Hi edi,

i am trying to follow your hints but could not create center lines for two arcs at the end of a curved slot like you did.

For the slanted slot, how can i create the arc's center lines, so that align with the center line of the slot? I was using Inkscape to draw those red lines for sake of demonstration.

Image
Post Reply