Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all articles
Browse latest Browse all 783

Searching for title blocks in a drawing and checking the cells. Can it be done?

$
0
0

Hello everyone,

I have written something to search out title blocks (in 8.5 and 10) and then I try to check which ones it is storing by using getcell to get the first cell in the title block and print it. It doesn't seem to be accessible though, which is weird. Is it because it doesn't see a titleblock as a table or am I doing something wrong. Here is my code. Please help if you can.

Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Drawings
Imports NXOpenUI
Imports NXOpen.Utilities
Imports NXOpen.Annotations
 
Module NXJournal
Sub Main (ByVal args() As String)
    Dim theSession As Session = Session.GetSession()
    Dim theUISession As UI = UI.GetUI
    Dim theUfSession As UFSession = UFSession.GetUFSession()
    Dim workPart As Part = theSession.Parts.Work
    Dim lw As ListingWindow = theSession.ListingWindow
    Dim tmpTitleBlock As NXOpen.Tag = NXOpen.Tag.Null
    Dim tmpTitleBlockObj as displayableObject
    Dim myTitleBlocks As New List(Of Tag)
    Dim NxType As Integer
    Dim NxSubtype As Integer
 
    Do
        theUfSession.Obj.CycleObjsInPart(workPart.Tag, UFConstants.UF_tabular_note_type, tmpTitleBlock)
        If tmpTitleBlock <> NXOpen.Tag.Null Then
            theUfSession.Obj.AskTypeAndSubtype(tmpTitleBlock, NxType, NxSubtype)
            If NxSubtype = UFConstants.UF_draft_title_block_subtype
                try
                tmpTitleBlockObj = NXOpen.Utilities.NXObjectManager.Get(tmpTitleBlock)
                Dim cellText As String = ""
                cellText = GetCell(tmpTitleBlock, 0, 0)
                If workPart.Layers.GetState(tmpTitleBlockObj.Layer) <> Layer.State.Hidden Then                      
                    lw.WriteLine("The table being stored Contains " & cellText)
                    myTitleBlocks.Add(tmpTitleBlock)                       
                End If
                catch nxexc as nxexception
                    ‘msgbox(nxexc.message)
                end try
            End If
        End If
    Loop Until tmpTitleBlock = NXOpen.Tag.Null
End Sub
End Module

Viewing all articles
Browse latest Browse all 783

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>