Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

IsDynamicSectionVisible question ...

I receive a messge:

 

IsDynamicSectionVisible is not declared - when running this small test code.

 

Am I missing something in my "Imports"  - or am I using the IsDynamicSectionVisible property in the wrong context?

 

Thanks,

Steve A.

 

NX8.5 Native MS-Windows

 


Option Strict Off Imports System Imports NXOpen Module NXJournal Sub Main (ByVal args() As String) Dim theSession As Session = Session.GetSession() Dim workPart As Part = theSession.Parts.Work Dim displayPart As Part = theSession.Parts.Display Dim dynamicSection1 As Display.DynamicSection = CType(workPart.DynamicSections.FindObject("Section 1"), Display.DynamicSection) Dim myBoolTest As Boolean = IsDynamicSectionVisible(dynamicSection1) If myBoolTest Then workPart.ModelingViews.WorkView.SetDynamicSectionVisible(dynamicSection1, False) Else workPart.ModelingViews.WorkView.SetDynamicSectionVisible(dynamicSection1, True) End IF End Sub End Module
SteveA
DRT Mfg. Co. Inc.
www.drtusa.com
Win7x64 NX8.5.3.3
2 REPLIES
Solution
Solution
Accepted by topic author SteveA
‎04-22-2016 01:18 PM

Re: IsDynamicSectionVisible question ...

 

IsDynamicSectionVisible() is a method on the ModelingView class, so you will need to call it off of a ModelingView object.

 

Try something like this:

 

Dim myBoolTest As Boolean = workPart.ModelingViews.WorkView.IsDynamicSectionVisible(dynamicSection1)

Re: IsDynamicSectionVisible question ...

[ Edited ]

That's it. Thanks Steve.

 

I'm not always able - given a known method/property name - to easily use the API help to find the full context of how to use it.

 

Steve A.

 

I now also removed the Dim'd Boolean variable and just put the function call in-line:

 

Option Strict Off

Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String) 

 Dim theSession As Session = Session.GetSession()
 Dim workPart As Part = theSession.Parts.Work

 Dim displayPart As Part = theSession.Parts.Display

 Dim dynamicSection1 As Display.DynamicSection = CType(workPart.DynamicSections.FindObject("Section 1"), Display.DynamicSection)

 If workPart.ModelingViews.WorkView.IsDynamicSectionVisible(dynamicSection1) Then

     workPart.ModelingViews.WorkView.SetDynamicSectionVisible(dynamicSection1, False)

   Else

     workPart.ModelingViews.WorkView.SetDynamicSectionVisible(dynamicSection1, True)

 End IF


End Sub
End Module
SteveA
DRT Mfg. Co. Inc.
www.drtusa.com
Win7x64 NX8.5.3.3