# File format for swept profile with changing normal

I have to create a file describing a 3d surface with the following properties:

• a circular arc cross section is swept along a closed 2d curve spine defined with equations
• the normal direction of the arc is not always tangential to the spine, the direction is defined with an equation
• the surface should be analytic (defined by equations), but a tesselated surface is also acceptable (with an external script I can derive the x,y,z coords of the vertexes for a tesselated surface)
• the file will be modified by an external script (python), so it should be editable with text editor
• the file should be opened by Creo(Proe), Catia and NX

The question:
Which is the best file format for making this feature?

What I tried:

• step: buying the ISO standard is unavoidable, as I cannot figure out on my own how the definition works
• vrml: only tesselated seems to be feasible
• x3d: same as vrml, as it has a sweep (extrusion) feature, but the normal direction is the same as the local spine direction, and Proe does not seem to open it

The egg-shaped curve is the trajectory, the arc is the curve to be swept along it. The plane of the arc is close to parallel to the plane "Top", but this angle varies between 0-30 degrees

• "the normal direction of the arc is not always tangential to the spine". I'm not quite sure what this means in 3d. Is it equivalent to "the plane in which the arc lies is not always perpendicular to the closed curve"? – trichoplax Aug 26 '16 at 12:17
• Is "spine" a specific term here, or should this say "spline"? – trichoplax Aug 26 '16 at 12:20
• Indeed, it is equivalent. The "spine" is not necessarily a spline, it can be an array of points connected with straight lines. Some software calls the spine curve trajectory. – Tawhiri Aug 27 '16 at 19:22
• Even tough i have explained how to do this in comments does not mean that this is a forum for telling you how to operate your CAD application. – joojaa Aug 29 '16 at 16:27
• Obviously not. I guess I got the answer, though not the one I was hoping for. Again, thanks for the help. – Tawhiri Aug 30 '16 at 4:05

Well realistically your choices are either IGES or STEP. IGES is slightly simpler but you will not successfully write either format without buying the standard (which in case of step is actually so many pages that by the time you have read them a year has passed, and lots of money is wasted on paper). You could also use one of the nonstandard kernel internal formats like Parasolid as its also commonly supported. Most other formats are polygon data so not suitable.

I would explore an alternative option to writing your own exporter, buy a commercial or take a free CAD kernel and let the kernel (open CASCADE) do the exporting for you.

On the other hand this is not hard to do inside your CAD application. Which you will need anyway to verify the result. Most CAD applications have a COM API's (don't know about NX most likely, but both creo and catia do have this) so you can edit, even do the generation from a text editor via python if you so wish. This is by far the least amount of effort (and it's usually less work to set up than using just the kernel).

Image 1: Swept with spine angle $60 \cos(4 t)+110$ and polar trajectory with $r = \cos(4 t)+3$ in Creo. All input from program injection.

So the approach depends on why you want to do what you do. And what your budget/time constraint is.

PS: NURBS (the underlying format of CAD data) solutions are not necessarily analytic, but parametric fits to analytical solutions. Sometimes these are exact sometimes not so exact as not all functions can be fitted to rational spline (though many can). Even when they can fitting is a more general solution.

• One of the reasons I want to do this outside of cad softwares is that this feature is not that simple to create with them. a) On your image above the shape of the cross-section is changing, but the plane of the sketch is perpendicular to the local trajectory. b) The surface can self-intersect, what is often a problem – Tawhiri Aug 29 '16 at 9:51
• @Tawhiri a) No the cross section is always the same its just oriented to the sweep path. The plane pf the sketch is not allways perpendicular it is changing with the funclion 60cos(4t)+110. b) is hard to avoid if you put arbitrary functions in place. So the function either selfintersects or does not. But yes that can be counteracted by making a rail sweep along and not thinking in terms of across. – joojaa Aug 29 '16 at 10:05
• @Tawhiri oh and what CAD are you using? What your proposing is actually very simple in Creo which is what i use mostly. Admittedly the tool used is not one that many users know how to use but still very easy to do. – joojaa Aug 29 '16 at 12:27
• Right now Catia V5R24 and Creo 2.0 is available. What is your method? I have a cuple of years experience with both, but I cant figure it out how to vary the angle of the sketch plane. – Tawhiri Aug 29 '16 at 13:06
• When you use sweep you must enable variable sections then inside the sketch add a relation to your dimension. In this relation you can write a function along curve by using the variable trajpar which is from 0 to 1 along the swept curve. Likewise you can make curves out fo equations with the datum (additional dropdown) -> curve -> curve from equation command. Also if you want to adjust the top down trajectory direction then you can define an additional curve for the sweep. Its all there but very few people ever use these tools. – joojaa Aug 29 '16 at 13:13

Here is what I finally did, maybe somebody finds it useful.

I wrote a script with Excel VBA what does the following:

1. gets the coordinates of n discrete points on the trajectory
2. gets k points of the circular cross-section at each n, in a horizontal plane
3. applies a rotation on these cross-sections (moves all points)
4. creates (n-1)*(k-1) facets (assigns 4 corner points to each)
5. exports the points and the facets to a vrml file

The result:

• The script might have been easier in python, but I chose Excel VBA
because this way I don't have to deal with the GUI.

• The format is vrml, because a) most software handles it b) the definition is available (mostly) and simple

• prepare the file by script instead of a CAD software: in my experience they can't build this surface reliably enough. The features will be super-sensitive to the input parameters, they will tend to crash after small changes

There are a couple of issues remaining:

• Catia can't open the result, possibly because the vertex normals are not defined in the wrl file. This feature of the vrml is not really documented. Opening and saving it with Creo solves the issue, as it adds the normals automatically. Creo and NX are ok.
• Can't convert the result to quilt in Creo, hence sectioning, measuring, etc is problematic

Any suggestions with the issues above are most welcome.

• You can not reliably work with polygon data in CAD applications. Why dont you use VBA to make the n discrete points directly in creo sketch and then sweep that? Note this is not what you asked. PS why dont you share a dummy formula and i can add instructions int the chat how to properly do this shape. PS this is not within scope of this forum. – joojaa Sep 2 '16 at 10:28