Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:

1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
2. Need support? Ask a question to our Community Support category.
3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

# Why is the coordinate system of a cylindrical face centered at a random position ?

Member, Developers Posts: 445 ✭✭✭
When i select a cylindrical face, and then get its surface definition, I expect the resulting coordinate system to have its origin at one end of the selected face.

In this example, you can see this is not the case: the coordinate system origin is an an apparently random point along the axis:

When you build a cylinder by extruding a circle, the origin of the cylinder coordinate system is in the sketch plane. In this case, the cylinder was created by a revolve, and the coordinate system is not aligned with anything I can find-- it appears to be completely random.  More importantly, it is not at either end of the cylindrical face, as I expect.

I am aware that the underlying surface definition ( a cylinder ) is infinite, and that its origin would not _necessarily_ need to align with the face. But this way of working makes it very difficult to find a coordinate system that lies at the end of the face, as I'd like.

As an example, I normally expect the origin of the underlying line associated with an Edge to be located at one of the ends of the edge. If it is not, I always know that parameter = 0 and parameter = 1 will correspond to the end of the lines.  But neither of these are true with the result of evSurfaceDefintion for a cylindrical face. The resulting cys does not appear to be located at the end of the cylindrical face.

There are of course ways to compute the right location, but they both represent more work than it seems like it should be:

Approach A:

(1) get the face and get the coordinate system using evSurfaceDefintion
(2) compute evBoundingBox, with respect to the axis of the cylinder
(3) the center of the cylindrical surface is actually at the results of the bounding box Z boundaries.

Approach B:

(1) get the face and get the coordinate system using evSurfaceDefintion
(2) use evTangentPlanes with u,v=0,0 to compute a tangent plane at one end of the surface
(3) the center is the intersection of the normal of this plane and the axis of the cylinder coordinate ssytem

Both of these will work, but why can't the csys that's returned  be at one end or the other of the cylinder?

• Member, Developers Posts: 445 ✭✭✭
@kevin_o_toole_1

Thanks for the very complete answer.  Indeed, I ended up doing option A.

In terms of how to handle it, I think you have represented the pros and cons well.   I like your suggested strategy, except that I would not have the CylinderAlignment parameter be optional.  Requiring the caller to make a decision is essential to avoid the confusion that exists now, where you get a random/meaningless csys that appears to be stable in many cases ( it tricked me very well ! )