Bisector line - my first macro

Discussions about the development of the TechDraw workbench
User avatar
wandererfan
Posts: 4078
Joined: Tue Nov 06, 2012 5:42 pm

Re: Bisector line - my first macro

Postby wandererfan » Fri Jul 03, 2020 12:04 am

Stq_Niko wrote:
Thu Jul 02, 2020 12:41 pm
How TechDraw manages to render views from the 3D objects ?
So, I think TechDraw use OCC to do the job, and I understand that OCC names view elements (edges, points, etc ...) arbitrarily, and then there is no way to link an element from the view to a 3D object element.
But, in a view where multi 3D objects are rendered, is there a way to know from which 3D object comes from edges, points, surface ?
We use the OCC Hidden Line Removal functions to project the shapes and identify the visible vs hidden lines. The lines come to us as one big pile. If there is more than one object in the Source property then there is no easy way to match an edge in the drawing back to the original object.
Stq_Niko
Posts: 22
Joined: Fri Jun 14, 2019 7:07 pm
Location: France

Re: Bisector line - my first macro

Postby Stq_Niko » Wed Jul 08, 2020 5:21 pm

Hi,

I installed the last FreeCAD Development builds (0.19.21857) and did some testing
The Y axis inversion still present but occurs in a different way.
Before :
After MakeCosmeticLine(), CosmeticEdge.Start and CosmeticEdge.End was OK
After CosmeticEdge Start and End modification --> Y axis reversed

Now :
After MakeCosmeticLine(), CosmeticEdge.Start and CosmeticEdge.End --> Y axis reversed
After CosmeticEdge Start and End modification Y sign does not change (so OK)

See picture below :

Capture.PNG
Capture.PNG (37.56 KiB) Viewed 525 times
User avatar
wandererfan
Posts: 4078
Joined: Tue Nov 06, 2012 5:42 pm

Re: Bisector line - my first macro

Postby wandererfan » Sun Jul 12, 2020 1:26 pm

Stq_Niko wrote:
Wed Jul 08, 2020 5:21 pm
The Y axis inversion still present but occurs in a different way.
Please try again after git commit 0ab224b46e.
Stq_Niko
Posts: 22
Joined: Fri Jun 14, 2019 7:07 pm
Location: France

Re: Bisector line - my first macro

Postby Stq_Niko » Sun Jul 12, 2020 3:43 pm

Great, thank !

At the moment I did 3 macros :
Capture_toolbar.PNG
Capture_toolbar.PNG (2.45 KiB) Viewed 444 times

1) Make a bisector from 2 edges
2) Extend or reduce a cosmetic Edge
3) Make a cosmetic vertex from the intersection of 2 Edges

If I can, I would like to add :
1) draw a circle from 3 points
2) draw a circle from 2 points (center + 1 point)
3) draw a circle from 1 point and a radius
Stq_Niko
Posts: 22
Joined: Fri Jun 14, 2019 7:07 pm
Location: France

Re: Bisector line - my first macro

Postby Stq_Niko » Tue Jul 14, 2020 9:33 pm

Hi,

I just tested the last build I found, and things just seem to work fine
Thanks again to Wandererfan

For people who are interested I have included a zip file with my first macros for Techdraw
It is a little thing but if it can be usefull ...
You need to install by yourself the macros and icons (I don't know if these is a way to automatize the installation)

So :
Bisector :
Bisector.PNG
Bisector.PNG (2.51 KiB) Viewed 393 times
Select 2 edges and run the macro. Center line style and color will be used to draw the bisector line

Extend :
Extend.PNG
Extend.PNG (1.39 KiB) Viewed 393 times
Select a cosmetic edge and run the macro :
Panel.PNG
Panel.PNG (8.5 KiB) Viewed 393 times
Enter a value for the Start point (marked by a red circle on the view) and end point, then click on "OK" to execute one time and exit or use "Apply" to do the action more than one time

Intersection :
Intersection.PNG
Intersection.PNG (1.6 KiB) Viewed 393 times
Select 2 edges and run the macro. A cosmetic Vertex will be created at the intersection point

Circles :
Circle.PNG
Circle.PNG (3.62 KiB) Viewed 393 times
- If only one vertex is selected you will be prompted to enter the radius for the circle
- If 2 vertexes are selected : The first one is the center and the distance between the 2 vertexes will be used as the radius
- if 3 vertexes are selected : The circle will pass by this 3 vertexes and a vertex will be created for the circle center
Center line style and color is used to draw the circle
Stq_Niko
Posts: 22
Joined: Fri Jun 14, 2019 7:07 pm
Location: France

Re: Bisector line - my first macro

Postby Stq_Niko » Tue Jul 14, 2020 9:37 pm

Ah !!

This the zip file with macros and icons
to put in the FreeCAD macro folder
Attachments
Bisector.zip
(19.27 KiB) Downloaded 22 times
chrisb
Posts: 27203
Joined: Tue Mar 17, 2015 9:14 am

Re: Bisector line - my first macro

Postby chrisb » Sun Sep 13, 2020 11:40 pm

Thanks for these macros!
Stq_Niko wrote:
Tue Jul 14, 2020 9:33 pm
Circles :
...
Center line style and color is used to draw the circle
I almost gave up, because I couldn't see anything. With the default settings I simply see nothing because no line style is set at all. Perhaps it is possible to use a dashed line of no style is set at all?
Stq_Niko
Posts: 22
Joined: Fri Jun 14, 2019 7:07 pm
Location: France

Re: Bisector line - my first macro

Postby Stq_Niko » Tue Sep 15, 2020 8:06 pm

Hi chrisb,

The line style is link with the style set in the TechDraw preferences
I don't know if this choise is good or not ...

anyway, I assume you found it because I saw your answer in the thread "How to add auxiliary circle"

At the moment I still work on it.
I 'd like to add parallel line and integrate these macros in a better way
(but I spend a lot time in the Python and FreeCad docs)

Sugestions are welcome
chrisb
Posts: 27203
Joined: Tue Mar 17, 2015 9:14 am

Re: Bisector line - my first macro

Postby chrisb » Tue Sep 22, 2020 11:05 pm

It would be great to have an arc too, see e.g. https://forum.freecadweb.org/viewtopic. ... 76#p432976.
It would further be great, if the files could be organized differently, e.g. in a common subdirectory. While I really would like to see these additions in master, it would already be an improvement if they were available in the AddonManager.
User avatar
Pauvres_honteux
Posts: 339
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Bisector line - my first macro

Postby Pauvres_honteux » Wed Sep 23, 2020 12:41 pm

FYI:
I referenced this topic here:
Pauvres_honteux wrote:
Wed Sep 23, 2020 12:37 pm
Here's a guy who created a macro for extending lines.