Showing results for 
Search instead for 
Did you mean: 

Get type of a point in NXOpen




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:Smiley Tongueoint 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,




Re: Get type of a point in NXOpen

#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[0]) +" and type is " +str(type(poles[0]))) #assign X,Y,Z coordinates to a numpy array point_array=np.array((poles[0].X, poles[0].Y, poles[0].Z))

Re: Get type of a point in NXOpen

Honored Contributor
Honored Contributor

"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.

Re: Get type of a point in NXOpen

Siemens Creator Siemens Creator
Siemens Creator

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.

Dave Figurski

GSS / Siemens Industry Sector

Re: Get type of a point in NXOpen


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.


Thank you.




Re: Get type of a point in NXOpen

Thank you Dave for your reply.

I think, the points I am working with are not created as point feature. They are actually the points that are created on the fly. Like creating block, we selected 'Point on Face'.

But yes, your suggestion is also opening a way which can make my work, like creating temporary feature and editing it to get the information needed.


Re: Get type of a point in NXOpen

Honored Contributor
Honored Contributor

Here is some code that might get you started:


'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.Visible, "NXJ point parents")


        For Each tempPt As Point In theSession.Parts.Work.Points
            lw.WriteLine("Point Tag: " & tempPt.Tag.ToString)
            GetSmartParents(tempPt, 2)


    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

            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)



            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

Re: Get type of a point in NXOpen

Hi cowski1,

Your are awesome.

I tries using this and found it very helpful. Obviously, I had to change something for fit my requirement, but yes, it solved my problem.

Thank you very much cowski1.