Kenja824
Automotive
- Nov 5, 2014
- 949
I like having simple buttons to turn certain options that i use a lot, on and off. Edges Hidden by Edges, View Hidden Lines in a drafting view, etc...
All of these that I have working are all done in Drafting. I am trying to make one work the same way in Modeling for Silhouettes. This code will turn them on, but never turns them off.
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display
' ----------------------------------------------
' Menu: Preferences->Visualization...
' ----------------------------------------------
Dim currentMode1 As NXOpen.Preferences.SessionVisualizationHighEndRendering.MaterialEditorEditingMode = Nothing
currentMode1 = theSession.Preferences.HighEndRenderingVisualization.StudioMaterialEditorEditingMode
Dim displayAppearanceOptions1 As NXOpen.Preferences.ViewVisualizationVisual.DisplayAppearanceOptions = Nothing
displayAppearanceOptions1.RenderingStyle = NXOpen.Preferences.ViewVisualizationVisual.RenderingStyle.StaticWireframe
displayAppearanceOptions1.HiddenEdges = NXOpen.Preferences.ViewVisualizationVisual.HiddenEdges.Visible
[highlight #FCE94F]
if displayAppearanceOptions1.Silhouettes = True then
displayAppearanceOptions1.Silhouettes = False
elseif displayAppearanceOptions1.Silhouettes = False then
displayAppearanceOptions1.Silhouettes = True
End if [/highlight]
displayAppearanceOptions1.SmoothEdges = True
displayAppearanceOptions1.SmoothEdgeColor = 0
displayAppearanceOptions1.SmoothEdgeFont = NXOpen.Preferences.ViewVisualizationVisual.SmoothEdgeFont.Original
displayAppearanceOptions1.SmoothEdgeWidth = NXOpen.Preferences.ViewVisualizationVisual.SmoothEdgeWidth.Original
displayAppearanceOptions1.SmoothEdgeAngleTolerance = 0.19999999999999996
workPart.ModelingViews.WorkView.VisualizationVisualPreferences.DisplayAppearance = displayAppearanceOptions1
End Sub
End Module
All of these that I have working are all done in Drafting. I am trying to make one work the same way in Modeling for Silhouettes. This code will turn them on, but never turns them off.
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display
' ----------------------------------------------
' Menu: Preferences->Visualization...
' ----------------------------------------------
Dim currentMode1 As NXOpen.Preferences.SessionVisualizationHighEndRendering.MaterialEditorEditingMode = Nothing
currentMode1 = theSession.Preferences.HighEndRenderingVisualization.StudioMaterialEditorEditingMode
Dim displayAppearanceOptions1 As NXOpen.Preferences.ViewVisualizationVisual.DisplayAppearanceOptions = Nothing
displayAppearanceOptions1.RenderingStyle = NXOpen.Preferences.ViewVisualizationVisual.RenderingStyle.StaticWireframe
displayAppearanceOptions1.HiddenEdges = NXOpen.Preferences.ViewVisualizationVisual.HiddenEdges.Visible
[highlight #FCE94F]
if displayAppearanceOptions1.Silhouettes = True then
displayAppearanceOptions1.Silhouettes = False
elseif displayAppearanceOptions1.Silhouettes = False then
displayAppearanceOptions1.Silhouettes = True
End if [/highlight]
displayAppearanceOptions1.SmoothEdges = True
displayAppearanceOptions1.SmoothEdgeColor = 0
displayAppearanceOptions1.SmoothEdgeFont = NXOpen.Preferences.ViewVisualizationVisual.SmoothEdgeFont.Original
displayAppearanceOptions1.SmoothEdgeWidth = NXOpen.Preferences.ViewVisualizationVisual.SmoothEdgeWidth.Original
displayAppearanceOptions1.SmoothEdgeAngleTolerance = 0.19999999999999996
workPart.ModelingViews.WorkView.VisualizationVisualPreferences.DisplayAppearance = displayAppearanceOptions1
End Sub
End Module