[Solved] Two lines intersection point

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Two lines intersection point

Post by onekk »

jfc4120 wrote: Fri Feb 03, 2023 11:54 pm @edwilliams16 works great. I will test more.
If you are sure that lines are intersecting, you could use directly:

Code: Select all

obj.intersect(obj2, tol)
By memory but as usual:

Code: Select all

help(Part.Shape.intersect)
Will give you more hint.

I use it very frequently in code and is very handy, but has not "infinite" options.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
jfc4120
Posts: 448
Joined: Sat Jul 02, 2022 11:16 pm

Re: [Solved] Two lines intersection point

Post by jfc4120 »

@onekk I punched it in and got:

Code: Select all

>>> help(Part.Shape.intersect)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
AttributeError: type object 'Part.Shape' has no attribute 'intersect'
>>> 
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: [Solved] Two lines intersection point

Post by onekk »

jfc4120 wrote: Sat Feb 04, 2023 6:18 pm ...
Sorry.

But you have been warned, don't trust on my memory. :lol:

Let me check now that I have a computer:

Code: Select all

help(Part.LineSegment.intersect)

Code: Select all

help(Part.Circle.intersect)
Help on method_descriptor:

intersect(...)
    Returns all intersection points and curve segments between the curve and the curve/surface.
    
                    arguments: curve/surface (for the intersection), precision (float)
but also:

Code: Select all

.intersect2D
.intersectCC
.intersectCS
Tolerance could play a relevant role between fails and success, usually I use 0.0001 in mm that is a reasonable "machining precision" but sometimes, even 0.001.

As example:
20230205-intersect.py
(1.02 KiB) Downloaded 13 times
Regards

Carlo D.



Hope it helps.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
jfc4120
Posts: 448
Joined: Sat Jul 02, 2022 11:16 pm

Re: [Solved] Two lines intersection point

Post by jfc4120 »

@onekk thanks I will give it a try.
Post Reply