I have a part which contains some points.
My requirement is that I want to create same type of the point at the same location.
I want to know 'How these points were created', I mean, I want to do something, if the point is created as 'Point on face' and something different if the point is created as 'Point on edge'.
As NXOpen:oint have different methods to create it which have all options, like, input as face, edge etc, but I could not figure out how to know 'Which method was used to create this point'.
Thanks in Advance,
Solved! Go to Solution.
#in python you can just use the "type" method
for i in range(len(spline_list)): spline = workPart.Splines.FindObject(str(spline_list[i])) self.theLw.WriteLine("List of 3D points is "+str(spline.Get3DPoles())) self.theLw.WriteLine("") #returns a list of points on the spline poles=spline.Get3DPoles() self.theLw.WriteLine("First 3D point on the spline is "+str(poles) +" and type is " +str(type(poles))) #assign X,Y,Z coordinates to a numpy array point_array=np.array((poles.X, poles.Y, poles.Z))
"I have a part which contains some points.
My requirement is that I want to create same type of the point at the same location."
If a point already exists at that location, why create a duplicate?
Now on to your question:
If the original point was created as an unassociative point, there is no feasible way to determine how it was created (that information will not be saved with an unassociative point).
If it is an associative point, you can query the "smart object" parents of the point. So if it was created as a point on surface, that surface will be one of the point's parent objects. The point's creation method isn't directly saved with the point, you will need to infer it based on the smart object parents.
Within NX the EDIT PARAMETERS of a smart point does retain the defining data.
These points are created using CreatePointFeatureBuilder (at least when I used INSERT => DATUM/POINT => POINT application).
You can try coding to get the point feature and try to edit it. Maybe the defining parameters are identifiable in that structure.
Thank you cowski1 for your reply.
Yes, the point is Associative. I think, your suggestion of getting a parent of the point and deciding the type of method to recreate that point should work.
I am just worried bout the U-V scalar required for recreating that point, as that information too is not saved with the point. Do I need to calculate based on the Face Geometry. If so, do you know is there any method which will assist me in this.
By then, I will try implementing your approch of finding parent and deciding creation method.
Here is some code that might get you started:
'NXJournaling.com 'August 31, 2016 'report the smart object parents of all the points in the work part. Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Module Module1 Dim theSession As Session = Session.GetSession() Dim theUfSession As UFSession = UFSession.GetUFSession() Dim theUI As UI = UI.GetUI() Dim lw As ListingWindow = theSession.ListingWindow Sub Main() Dim markId1 As Session.UndoMarkId markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visi
ble, "NXJ point parents") lw.Open() For Each tempPt As Point In theSession.Parts.Work.Points lw.WriteLine("Point Tag: " & tempPt.Tag.ToString) GetSmartParents(tempPt, 2) lw.WriteLine("") Next lw.Close() End Sub Sub GetSmartParents(ByRef theSmartObject As NXObject, ByVal indent As Integer) Dim numParents As Integer Dim theParentTags() As Tag = Nothing Dim isSmart As Boolean = False Try theUfSession.So.IsSo(theSmartObject.Tag, isSmart) If isSmart Then theUfSession.So.AskParents(theSmartObject.Tag, UFConstants.UF_SO_ASK_ALL_PARENTS, numParents, theParentTags) lw.WriteLine(New String(" "c, indent) & "number of parents: " & numParents.ToString) For Each tempTag As Tag In theParentTags Dim objParent As TaggedObject = Utilities.NXObjectManager.Get(tempTag) lw.WriteLine(New String(" "c, indent) & "parent type: " & objParent.GetType.ToString) lw.WriteLine(New String(" "c, indent) & "parent tag: " & objParent.Tag.ToString) If TypeOf (objParent) Is Scalar Then Dim theScalar As Scalar = objParent lw.WriteLine(New String(" "c, indent) & "dimensionality: " & theScalar.Dimensionality.ToString) lw.WriteLine(New String(" "c, indent) & "value: " & theScalar.Value.ToString) End If If TypeOf (objParent) Is Offset Then Dim theOffset As Offset = objParent lw.WriteLine(New String(" "c, indent) & "vector: " & theOffset.Vector.ToString) End If GetSmartParents(objParent, indent + 2) Next lw.WriteLine("") End If Catch ex As NXException lw.WriteLine("error: " & ex.ErrorCode) lw.WriteLine(" " & ex.Message) End Try End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image immediately after execution within NX GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately End Function End Module