Hello guys! I'm trying to write some code that, given an edge in the geometry, will create a linear pattern of points on the edge and subsequently print out the coordinates of all the points in that pattern to a text file.
So far, I've managed to create a circular pattern (the geometries that I am interested in are cylindrical) using PatternGeometryBuilder with a seed point that was generated using CreateQuadrantPoint which refers to the same edge. I can see the points in the pattern in NX Modelling but now I'm not sure how to actually extract the coordinates of those points.
I've tried several methods to no success; the closest I've got is to use GetCommittedObjects after the pattern has been committed, for example:
NXObject commitpattern = PatternGeometryBuilder1.Commit();
NXObject commitedobjects = PatternGeometryBuilder1.GetCommittedObjects();
foreach (Point currentPoint in commitedobjects)
However, no coordinates were printed in the listing window. I would be grateful if anyone could help me with this!
*I should mention that there is another way to get these coordinates using mesh points in Advanced Simulation. These mesh points can also be created in a pattern on an edge and getting the coordinates of these points is significantly more straightforward because of the MeshPointCollection class. However for reasons which have no relevance to the question, I would much prefer just doing everything in Modelling.
Look at this example on the solution center.
The example you have linked does help with the coordinate printing, but my problem is more towards how do I get the points that belong to a pattern geometry. Thanks anyway!
Looks like GetCommittedObjects is not returning the point objects. Cast the nxobject returned from PatternGeometryBuilder.Commit() to a Feature and use Feature.GetEntities() to get the points.