Geometrical computation on topological structures

Hello,

I'm trying to project a streight line on a shell.
The problem is, that the closest thing i found is: projecting a line on a surface by extruding the line to a plane, and intersecting the plane with the surface.
As you know, a shell is a topological being, that is made of faces, which are usually built from surfaces (am i right?)

So:
1. Is there a nice way to intersect two shells, or project a line on a shell?
2. Alternatively, is there a way to simulate a shell as a mathematic surface (in order to use the intersecting tool im familiar with)?
3. Is there a way to explore a shell, and construct back the surfaces it is made of? Will it be reasonable then to find many intersections with all those surfaces, and build back the total intersection curve or wire?
4. Does open cascade have a functionality of lofted surfaces? (such as in solidworks and other cad softwares)

I appreciate any comment.
Thanks,
moshe.

Ankit Surti's picture

1. Is there a nice way to intersect two shells, or project a line on a shell?
A. For projecting a line (topologically a TopoDS_Edge) on a TopoDS_Shell, yes, you can use BRepOffsetAPI_NormalProjection. However, it doesn't work too nice if your shell has B-Spline surfaces. In such cases, a better way would be to use your method of extruding the line to a plane and finding its intersection with the shell. However, it seems that for this, you are using GeomAPI_IntSS. My suggestion, use BRepAlgoAPI_Section.

2. Alternatively, is there a way to simulate a shell as a mathematic surface (in order to use the intersecting tool im familiar with)?
A. I don't know how to do this.

3. Is there a way to explore a shell, and construct back the surfaces it is made of? Will it be reasonable then to find many intersections with all those surfaces, and build back the total intersection curve or wire?
A. Yes, you can run TopExp_Explorer on the TopoDS_Shell and extract its TopoDS_Faces. But for the intersections, I think answer to Q.1 above is good enough.

4. Does open cascade have a functionality of lofted surfaces? (such as in solidworks and other cad softwares)
A. Yes. Try using BRepOffsetAPI_ThruSections.

moshe1234's picture

Thanks for taking the time and answering all my questions.
I have few additional questions regarding your answers:

1.A. If I use BRepAlgoAPI_Section to cut the shell with my plane, How can i then make length calculations on the wire of the intersection? (is there a way to interpolate a bspline that represents the wire?)

4.A. In solidworks there is a lofting tool that enables you to make a loft through 2 sections or more and use a guide that defines the path that the surface have to go throug when it passes from one section to the next. I know i can simulate such a guide by using lots of sections, but then i whould end up with a shell made up of many surfaces, wereas in sollidworks the loft gives me a single surface (for each two sections).
Do you know anything that can give such results?

Cheers,
moshe.

Ankit Surti's picture

1.A. If I use BRepAlgoAPI_Section to cut the shell with my plane, How can i then make length calculations on the wire of the intersection? (is there a way to interpolate a bspline that represents the wire?)
A. Well, actually, BRepAlgoAPI_Section doesn't truly give a wire as the intersection but a set of disordered edges which you need to manually connect into a wire/wires (if required). For finding the length, I haven't tried that yet (since was never required in my case). But I feel that you can find the lengths of individual edges in a wire and then simply sum them up.

4.A. In solidworks there is a lofting tool that enables you to make a loft through 2 sections or more and use a guide that defines the path that the surface have to go throug when it passes from one section to the next. I know i can simulate such a guide by using lots of sections, but then i whould end up with a shell made up of many surfaces, wereas in sollidworks the loft gives me a single surface (for each two sections).
Do you know anything that can give such results?
A. As far as I know, the guide path is optional while lofting in Solidworks. The key thing is to select the appropriate vertices in each section. The guide path is automatically generated using continuity constraints. In OpenCASCADE, I haven't tried BRepOffsetAPI_ThruSections but had mentioned it just as an answer to your query. From what it seems, OpenCASCADE doesn't give you a control over the continuity but gives two options: Ruled surface vs. Smooth surface. I think you are looking for this smooth surface option. Here's the description of the constructor:

BRepOffsetAPI_ThruSections
(const Standard_Boolean isSolid = Standard_False,
const Standard_Boolean ruled = Standard_False,
const Standard_Real pres3d = 1.0e-06);

Purpose
Initializes an algorithm for building a shell or a solid passing through a set of wires, where:
- isSolid is set to true if the construction algorithm is required to build a solid or to false if it is required to build a shell (the default value),
- ruled is set to true if the faces generated between the edges of two consecutive wires are ruled surfaces or to false (the default value) if they are smoothed out by approximation,
- pres3d defines the precision criterion used by the approximation algorithm; the default value is 1.0e-6.

P.S.: If this doesn't solve your query, then I am sorry since I cannot elaborate more on this as I haven't found the need to try it!