Edge on a surface

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
OsWeldo
Posts: 13
Joined: Fri Apr 09, 2021 2:03 pm

Edge on a surface

Post by OsWeldo »

Hey guys,

I was wondering if there is a built-in function that allows me to check if an edge lies on a surface.

Best Regards.
Osweldo
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Edge on a surface

Post by openBrain »

Is that planar edge/surface or curved ones ?
OsWeldo
Posts: 13
Joined: Fri Apr 09, 2021 2:03 pm

Re: Edge on a surface

Post by OsWeldo »

openBrain wrote: Tue Apr 20, 2021 9:35 am Is that planar edge/surface or curved ones ?
Both actually.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Edge on a surface

Post by openBrain »

OsWeldo wrote: Tue Apr 20, 2021 9:58 am Both actually.
OK. Hopefully other more skilled forumers will weigh in, but IMO the curved case isn't so easy to handle... Did you have a search into OpenCasCade API ?
OsWeldo
Posts: 13
Joined: Fri Apr 09, 2021 2:03 pm

Re: Edge on a surface

Post by OsWeldo »

openBrain wrote: Tue Apr 20, 2021 10:03 am
OsWeldo wrote: Tue Apr 20, 2021 9:58 am Both actually.
OK. Hopefully other more skilled forumers will weigh in, but IMO the curved case isn't so easy to handle... Did you have a search into OpenCasCade API ?
I haven't, I'm actually not acquainted with OpenCasCade API, but I'll search! Thank you!
User avatar
Chris_G
Veteran
Posts: 2602
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Edge on a surface

Post by Chris_G »

OsWeldo wrote: Tue Apr 20, 2021 9:30 am I was wondering if there is a built-in function that allows me to check if an edge lies on a surface.
About the wording : you are mixing topology ("edge") with geometry ("surface")
You can check if an edge has a Curve2D representation on a face :

Code: Select all

aFace.curveOnSurface(anEdge)
will return a curve2D, and first / last parameters, or nothing.
But this is not a perfect test.
It may return nothing (if edge and face have no "historic" relation), although the edge may effectively lie on the face.
We're lacking some more information on the context.
alberich
Posts: 77
Joined: Thu Aug 17, 2017 2:09 pm
Location: Texas

Re: Edge on a surface

Post by alberich »

OsWeldo wrote: Tue Apr 20, 2021 9:30 am I was wondering if there is a built-in function that allows me to check if an edge lies on a surface.
For clarification, do you want to know (a) if the edge is part of/belongs to a surface; that is if the edge is part of what defines the surface

or

(b) if the edge of, say, object1 contacts a surface of, say, object2?
OsWeldo
Posts: 13
Joined: Fri Apr 09, 2021 2:03 pm

Re: Edge on a surface

Post by OsWeldo »

Chris_G wrote: Tue Apr 20, 2021 10:14 am
OsWeldo wrote: Tue Apr 20, 2021 9:30 am I was wondering if there is a built-in function that allows me to check if an edge lies on a surface.
About the wording : you are mixing topology ("edge") with geometry ("surface")
You can check if an edge has a Curve2D representation on a face :

Code: Select all

aFace.curveOnSurface(anEdge)
will return a curve2D, and first / last parameters, or nothing.
But this is not a perfect test.
It may return nothing (if edge and face have no "historic" relation), although the edge may effectively lie on the face.
We're lacking some more information on the context.
It was in fact what happened, it returned nothing, because the lines are projected on the surface.
I'll leave a picture so you can analyze.
Attachments
Sem Título.png
Sem Título.png (52.8 KiB) Viewed 885 times
OsWeldo
Posts: 13
Joined: Fri Apr 09, 2021 2:03 pm

Re: Edge on a surface

Post by OsWeldo »

alberich wrote: Tue Apr 20, 2021 10:16 am
OsWeldo wrote: Tue Apr 20, 2021 9:30 am I was wondering if there is a built-in function that allows me to check if an edge lies on a surface.
For clarification, do you want to know (a) if the edge is part of/belongs to a surface; that is if the edge is part of what defines the surface

or

(b) if the edge of, say, object1 contacts a surface of, say, object2?
I want to know just if contacts, so (b)!
chrisb
Veteran
Posts: 54313
Joined: Tue Mar 17, 2015 9:14 am

Re: Edge on a surface

Post by chrisb »

I was pondering how I would do it manually. For a test I created a non solid cylinder and sketches of the same diameter. I then made a boolean common and checked the result with CheckGeometry.

I investigated the following cases:

- Sketch on surface: CheckGeometry is ok and shows a length for the resulting wire
- Sektch and surface are disjoint: CheckGeometry shows an invalid compound
- Sektch and surface are tangent: CheckGeometry shows an invalid compound
- Sektch and surface have two points in common: CheckGeometry shows an invalid compound, I expect the same result for one intersection point

So Boolean common could be a way for your check. However, seeing the now and then occurring coplanar issues I would not really guarantee for it.
Attachments
sketchOnSurface.FCStd
(10.49 KiB) Downloaded 25 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply