×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

ask for drawingviews partname

ask for drawingviews partname

ask for drawingviews partname

(OP)
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



RE: ask for drawingviews partname

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

RE: ask for drawingviews partname

(OP)
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

RE: ask for drawingviews partname

Yes, that would be even easier. My quick search missed that one.

www.nxjournaling.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources