Draw two lines with given angle and distance between endpoints.

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
MauiWarrior
Posts: 71
Joined: Wed Apr 07, 2021 7:10 pm

Draw two lines with given angle and distance between endpoints.

Post by MauiWarrior »

Hi All,

In Draft workbench I would like to draw two lines with matching left points forming 60 degree angle and the other two points 3 mm apart. I did it in attached document, but I had to compute everything manually (using tan) and simply entered dimension.
Is there way to do it simpler (without manual computations)?



OS: Windows 10 Version 1809
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/United States (en_US)
Attachments
one saw tooth.FCStd
two lines at an angle
(7.2 KiB) Downloaded 22 times
drmacro
Veteran
Posts: 9000
Joined: Sun Mar 02, 2014 4:35 pm

Re: Draw two lines with given angle and distance between endpoints.

Post by drmacro »

And this is why folks don't use draft.

This is a trivial exercise in Sketcher. Twelve mouse clicks and 30 seconds:
Snip macro screenshot-c12cc2.png
Snip macro screenshot-c12cc2.png (50.14 KiB) Viewed 863 times
Two more mouse clicks and it makes a Draft Wire if desired.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
MauiWarrior
Posts: 71
Joined: Wed Apr 07, 2021 7:10 pm

Re: Draw two lines with given angle and distance between endpoints.

Post by MauiWarrior »

Thank you!
(you slightly changed my sketch, two points coincide and the other two are 3 mm apart)

Sketcher does not have either linear pattern or array. How would I go about repeating this this pattern?
Bance
Veteran
Posts: 4264
Joined: Wed Feb 11, 2015 3:00 pm
Location: London

Re: Draw two lines with given angle and distance between endpoints.

Post by Bance »

Sketcher does have array. Image

And if you make cols =1 it's linear.

But I told before that ain't the best way to do it! 8-)
MauiWarrior
Posts: 71
Joined: Wed Apr 07, 2021 7:10 pm

Re: Draw two lines with given angle and distance between endpoints.

Post by MauiWarrior »

Awesome, that is what I was looking for. Thank you!
Bance
Veteran
Posts: 4264
Joined: Wed Feb 11, 2015 3:00 pm
Location: London

Re: Draw two lines with given angle and distance between endpoints.

Post by Bance »

If you ask good questions you get good answers. :lol:
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: Draw two lines with given angle and distance between endpoints.

Post by heda »

sketcher is the way to go for these things.
to the literate question if it is possible in draft,
sure it is, just make some "construction" lines used to trim things,
they are just normal lines which I changed color on.

the angled lines are made with the length/angle option
construction lines are made in zero, and then moved
then it is just to trim the angled lines to the construction lines
draftlines.png
draftlines.png (12.65 KiB) Viewed 823 times
or use the power of placement.
- make one horizontal line, say 10 mm
- duplicate so that you have 4 in total
- take the first one and change placement angle to 30 degrees, and the second one to -30
- move one line up 1.5 mm and one down 1.5 mm with placement
- make the trims...

using placement is probably about the same speed as sketcher if one is used to it.
MauiWarrior
Posts: 71
Joined: Wed Apr 07, 2021 7:10 pm

Re: Draw two lines with given angle and distance between endpoints.

Post by MauiWarrior »

@heda, thank you! I need to learn how to use construction lines.
mario52
Veteran
Posts: 4696
Joined: Wed May 16, 2012 2:13 pm

Re: Draw two lines with given angle and distance between endpoints.

Post by mario52 »

Hi

here little macro Macro_Line_Length (with Draft)

paste the complete macro in FreeCAD console python and type

ex:

Code: Select all

line_length(x1 = 0, y1 = 0, z1 = 0, length = 10, angle = 45)
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
MauiWarrior
Posts: 71
Joined: Wed Apr 07, 2021 7:10 pm

Re: Draw two lines with given angle and distance between endpoints.

Post by MauiWarrior »

@mario52 thank you! It will be my first experience with Python and FreeCAD
Post Reply