Thu, 10/16/2025 - 18:23
Forums:
Suppose I import the step file in the attached image. You can see I have two cylindrical faces selected. If I call the following code
Handle(Geom_CylindricalSurface) firstCylinder = ...
Handle(Geom_CylindricalSurface) secondCylinder = ...
gp_Ax1 axis1 = firstCylinder->Cylinder().Axis();
gp_Ax1 axis2 = secondCylinder->Cylinder().Axis();
gp_Pnt point1 = axis1.Location();
gp_Pnt point2 = axis2.Location();
Will point 1 always equal point 2 ? When I tested it against the step file (from the attached image) the two points it DID match. The two cylinders also had the same "vMin" and "vMax".
In what situation will the two cylinders "Location()" not match ? I suppose if they have different "vMin" and "vMax" ?? I guess im more wondering how is the .Location() calculated for cylindrical faces that are imported like the step file in the image.
Attachments:
Fri, 10/17/2025 - 09:59
gp_Cylinderlocation is not calculated from cylinder, it is how cylinder was defined in the first place.Whether they match or not will depend on how cylinders were modeled, hence you'll need to take various considerations depending on what you are trying to do with this information.
For instance, the following script defines two cylinders in Draw Harness:
These cylinders geometrically match to each other, but have different definition. You may see from the dump:
and for another cylinder:
This is only one of the ways to define the same cylinder differently in B-Rep.
Fri, 10/17/2025 - 21:29
Hello Sir,
Yes that makes sense perhaps maybe I did not explain my situation. I am not directly creating a
gp_Cylinderwith a constructor I am just getting aGeom_CylindricalSurfacefrom a imported step file selected face which then I get thegp_Cylinder. I then call theAxis()on both of the cylinders, I want to callIsCoaxialon them. The methodIsCoaxialchecks the distance between them usingLocation()I am wondering for imported step files how will this
Location()be calculated since I am not creatinggp_Cylinder()with a constructor. I am just selecting a face and then callingGeom_CylindricalSurfacethengp_Cylinder()... I am assuming however the cylinder was defined in the STEP file is howLocation()is calculated ?In the attached image (original post) if I call
IsCoaxialwith low tolerances on both of the cylinders it returnstrue(which is what I expect) but I want to figure out exactlyLocation()is calculated for imported step files to handle edge cases.I hope I explained my self correctly
Please let me know if I need to clarify :3
Mon, 10/20/2025 - 09:12
OCCT will read cylinder definition as it was written into STEP file by originating system. Hence, it could be defined in various ways. Cannot say which kind of input you would like to handle practically speaking, but in general case there might be a lot of deviations.
Mon, 10/20/2025 - 17:50
Thank you!