cancel
Showing results for 
Search instead for 
Did you mean: 

How to get datum point properties in Drawing View?

Pioneer
Pioneer

Hello all,

 

I have created few Datum points and few Sketch point in Modeling. And each point has a specific name.

After that, I have created one view in Drafting and I am trying to get properties of those points.

 

As an example, I want the name of those points. So I am getting the name of sketch points but not able to get the name of Datum points. 

Below is the code

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Annotations
Imports NXOpen.UI
Imports NXOpen.UF
Imports NXOpen.Annotations.DraftingNoteBuilder
Imports NXOpen.Drawings
Imports NXOpen.Annotations.PlaneBuilder
Imports NXOpen.Annotations.Annotation
Imports NXOpen.Utilities

Module Point

    Dim theSession As Session
    Dim workPart As Part
    Dim displayPart As Part
    Dim theUI As UI
    Dim dwgsheet As Drawings.DrawingSheet
    Dim Points As Point
    Dim theUfSession As UFSession
    Dim text2(0) As String

    Dim ActivateView As Boolean = False
    Sub Main(ByVal args() As String)

        theSession = Session.GetSession()
        workPart = theSession.Parts.Work
        displayPart = theSession.Parts.Display
        theUfSession = UFSession.GetUFSession
        theUI = UI.GetUI
        dwgsheet = workPart.DrawingSheets.CurrentDrawingSheet

        Dim View As Drawings.DraftingView
        Dim DispObjs() As DisplayableObject

    
        Dim tempPoint As Point
        Dim num3 As Double
        Dim numArray As Double()
        Dim numArray2 As Double()
        Dim str As String = Nothing
        Dim null As Tag = NXOpen.Tag.Null
        Dim tag2 As Tag = NXOpen.Tag.Null


        For Each View In dwgsheet.SheetDraftingViews
            If View.IsActiveForSketching = True Then
                '   View.Expand()
                Dim numSelectedObjects As Integer = theUI.SelectionManager.GetNumSelectedObjects
                DispObjs = View.AskVisibleObjects()

                For Each tempobj As DisplayableObject In DispObjs
                    If TypeOf tempobj Is Point Then
                        tempPoint = tempobj                                                                 
                           MsgBox(tempPoint.Name)
                        End If
                    End If
                Next
                ActivateView = True
            End If

        Next

        If ActivateView = False Then
            MsgBox("Please activate the view")
        End If

        GetUnloadOption("3")


    End Sub

  
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        '----Other unload options-------
        'Unloads the image immediately after execution within NX
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

    End Function

End Module

 

 

Please correct where I have to make changes to get the required result?.

1 REPLY

Re: How to get datum point properties in Drawing View?

Honored Contributor
Honored Contributor

The code, as posted, throws errors and won't run. I renamed the module from "Point" (which is an NXOpen class name) to "Module1" (as a temporary name) and deleted an extra "End If" that was hanging around. After making these changes the code ran. It reported the names of the point objects that were shown in the active sketch view. I suspect that you have renamed the point feature rather than the point object itself.