Snapper : Line intersection with face

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
User avatar
petit_chat_noir
Posts: 87
Joined: Wed Oct 02, 2019 6:45 pm

Snapper : Line intersection with face

Post by petit_chat_noir »

Hello,
I haven't found anything about instersection between line/vector and a face.
Does anybody know if it exist ??
How to do ?
I would like to use it in a python macro.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Snapper : Line intersection with face

Post by openBrain »

Hi,

Maybe you can use the IntCS class of OCC.
UR_
Veteran
Posts: 1355
Joined: Tue Jan 03, 2017 8:42 pm

Re: Snapper : Line intersection with face

Post by UR_ »

Perhaps like this:

Code: Select all

doc = App.getDocument("demo")

line = doc.getObject("Line")
cyl = doc.getObject("Cylinder")


intersection = cyl.Shape.section(line.Shape)

print (intersection.Vertexes[0].Point)
print (intersection.Vertexes[1].Point)


demo.FCStd
(9.6 KiB) Downloaded 17 times
intersection.FCMacro
(234 Bytes) Downloaded 16 times
Screenshot 001.png
Screenshot 001.png (27.21 KiB) Viewed 421 times
User avatar
petit_chat_noir
Posts: 87
Joined: Wed Oct 02, 2019 6:45 pm

Re: Snapper : Line intersection with face

Post by petit_chat_noir »

Yes good news, thanks all ! :P
Post Reply