Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations JAE on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

ask for drawingviews partname

Status
Not open for further replies.

lklo

Industrial
Joined
Nov 24, 2010
Messages
226
Location
DK
Hi -

I am right now doing some programming of a NXOpen program (VB) that will cycle through all views in all sheets in a NX drawing part.

My problem is that I am not able to figure out , how to ask for the views "drawing member view" part name.

(I mean - let's say if I manual on a view make > Properties > (tab) General > Information >.
Then - in NX Information window there will be listed a lot of information about the current view..
Some off these informations is:
Drawing Member View Display Settings
What I need is the Part Name from this information.)

My intension with my program is to "change displayed part" and "make workpart" , if a view is a FlatPattern - to the FlatPattern's member PartName.
I have no problems with finding the FlatPattern views - and I can also easily change displayed part, if I was able to ask the FlatPattern view's member as PartName.

Maybe one here on the board can be helpful ,to give me a hint...

Lklo



 
You can get to the part name by using a view builder object.

Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim theUfSession As UFSession = UFSession.GetUFSession()
        If IsNothing(theSession.Parts.BaseWork) Then
            'active part required
            Return
        End If

        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Const undoMarkName As String = "NXJ journal"
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, undoMarkName)

        For Each temp As Drawings.DraftingView In workPart.DrawingSheets.CurrentDrawingSheet.GetDraftingViews

            lw.WriteLine("name: " & temp.Name)
            lw.WriteLine("type: " & temp.GetType.ToString)

            If TypeOf (temp) Is Drawings.BaseView Then

                Dim baseViewBuilder1 As Drawings.BaseViewBuilder
                baseViewBuilder1 = workPart.DraftingViews.CreateBaseViewBuilder(temp)
                Dim prtView As String = baseViewBuilder1.Style.ViewStyleBase.PartName
                baseViewBuilder1.Destroy()
                lw.WriteLine("from part: " & prtView)

            End If

        Next


        lw.Close()

    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

www.nxjournaling.com
 
hi cowski -

As usual - you are always good for a competent response.
Your solution can be used in my program.

But in the meantime - I found (in UF_DRAW.h) a userfunction command > > extern UFUNEXPORT int UF_DRAW_get_view_model_view_part in line 2057.

I am almost sure this also can be used as a wrapper function:
ufs.Draw.GetViewModelViewPart(input view as tag , output partname as string)....

But anyway - thank you for your response.

Lklo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top