Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

View Information to String 1

Status
Not open for further replies.

Altojoe

New member
Mar 16, 2013
23
0
0
IN
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..
 
Replies continue below

Recommended for you

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
See the post dated: 11 May 15 20:08

www.nxjournaling.com
 
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).
 
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
 
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]
 
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

[highlight #EF2929]Dim Tag1 As NXOpen.Tag = ' Need to tag the tempview label[/highlight]
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
 
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
 
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
 
Status
Not open for further replies.
Back
Top