×
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

View Information to String

View Information to String

View Information to String

(OP)
HI,

I need a journal to get a drafting view information(Ctrl +I) text to string (VB) to perform a check...How to get that... I am using NX 7.5..

RE: View Information to String

You could use the Information.DisplayObjectDetails() method, send the output to a file, and then parse the file. But most (if not all) of that information can be obtained directly through the drafting view object's properties and methods.

An example of using .DisplayObjectDetails() can be found in thread:
thread561-386198: Deleting unused Planes
See the post dated: 11 May 15 20:08

www.nxjournaling.com

RE: View Information to String

(OP)
Thanks Cowski,

My Intention is to check that whether the view have Solid section curve or not (Drafting curve Type). If they Don't have I need to change the view label as VIEW "X" else it should be SECTION "X", I have found a method to get to the Viewlabelparms for editing the label prefix but unable to segregate the views, that they are projected from outside (using section method) or they are truly sectioned. The only difference I found is the true section views have the "solid section Line" other one is not (If I am not wrong).

RE: View Information to String

Below is one method to tell if anything in the "section" view is actually sectioned or not.

CODE

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 lw As ListingWindow = theSession.ListingWindow

    Sub Main()

        If IsNothing(theSession.Parts.BaseWork) Then
            'active part required
            Return
        End If

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

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

        For Each tempView As Drawings.DraftingView In workPart.DraftingViews
            If TypeOf (tempView) Is Drawings.SectionView Then
                If IsSectioned(tempView) Then
                    lw.WriteLine(tempView.Name & " is sectioned")
                Else
                    lw.WriteLine(tempView.Name & " is NOT sectioned")
                End If
            End If

        Next

        lw.Close()

    End Sub

    Function IsSectioned(ByVal sectionView As Drawings.SectionView) As Boolean

        Dim sxSolidTags() As Tag
        Dim numSxSolids As Integer
        theUfSession.Draw.AskSxsolidsOfSxview(sectionView.Tag, Nothing, numSxSolids, sxSolidTags)

        'lw.WriteLine("num section solids: " & numSxSolids.ToString)

        Return numSxSolids > 0

    End Function

    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: View Information to String

(OP)
Thanks Cowski...

I got this approach earlier but I have used some wrong references (I guess), It didn't worked for me..... Thanks for giving the correct code... I will update once it is verfied...2thumbsup

RE: View Information to String

(OP)
Hi Cowski,

I am unable to tag the view label for the temp view which u have highlighted a small help will be helpful...

For Each tempView As Drawings.DraftingView In workPart.DraftingViews

If TypeOf (tempView) Is Drawings.SectionView Then

Dim Tag1 As NXOpen.Tag = ' Need to tag the tempview label
Dim Labelparms1 As UFDraw.ViewLabelParms = Nothing
ufs.Draw.AskViewLabelParms(Tag1, Labelparms1)
If IsSectioned(tempView) Then
Labelparms1.view_label_prefix = "SECTION"
Else
Labelparms1.view_label_prefix = "VIEW"
End If
ufs.Draw.SetViewLabelParms(Tag1, Labelparms1)

End If
Next

RE: View Information to String

CODE

Dim viewLabelTag As Tag
ufs.Draw.AskViewLabel(tempView.Tag, viewLabelTag)

Dim validViewParms As Integer = -1

Dim Labelparms1 As UFDraw.ViewLabelParms = Nothing
validViewParms = ufs.Draw.AskViewLabelParms(viewLabelTag, Labelparms1) 

www.nxjournaling.com

RE: View Information to String

(OP)
Thanks Cowski... It worked like a charm...bigsmile

For Each tempView As Drawings.DraftingView In workPart.DraftingViews

If TypeOf (tempView) Is Drawings.SectionView Then

Dim viewLabelTag As Tag
ufs.Draw.AskViewLabel(tempView.Tag, viewLabelTag)
Dim Tag1 As NXOpen.Tag = viewLabelTag ' Need to tag the tempview label
Dim Labelparms1 As UFDraw.ViewLabelParms = Nothing
ufs.Draw.AskViewLabelParms(Tag1, Labelparms1)
If IsSectioned(tempView) Then
Labelparms1.view_label_prefix = "SECTION"
Else
Labelparms1.view_label_prefix = "VIEW"
Labelparms1.scale_label = False
End If
ufs.Draw.SetViewLabelParms(Tag1, Labelparms1)

End If
Next

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