NX Variant configuration

2024-02-20T21:29:50Z
NX Open NX System Administration

Summary


Details

In NX open I would want to get the Variant Rule names like shown in the dialog.

SVR_SPhere and SVR_BLock. Is this possible in VBnet

Platforms
  • na windows-1032
Release Versions
  • NX V2212.8900
Solution

How to get the values of the box below:

Getting values from the Variant Rule box

' NX 1980.1700

' Please NOTE that the sample code below is for reference only, please modify if necessary.

'

Imports System

Imports NXOpen

Module NXJournal

Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()

Sub Echo(ByVal output As String)

theSession.ListingWindow.Open()

theSession.ListingWindow.WriteLine(output)

theSession.LogFile.WriteLine(output)

End Sub

Sub Main (ByVal args() As String)

Dim workPart As NXOpen.Part = theSession.Parts.Work

Dim displayPart As NXOpen.Part = theSession.Parts.Display

' Menu: Assemblies->Variant Configuration...

Dim variantRulesConfigurationBuilder1 As NXOpen.PDM.VariantRulesConfigurationBuilder = Nothing

variantRulesConfigurationBuilder1 = theSession.ConfigurationManager.CreateVariantRulesConfigurationBuilder(workPart)

' Dialog Begin Select Product Assembly

Dim variantrules1() As String

variantrules1 = variantRulesConfigurationBuilder1.GetVariantRulesForProductAssembly("000069", "")

' ONLY PRINT 1 ENTRY for testing purpose, value are "4, BLUE", please refer to Information dialog above.

Echo(variantrules1.Length)

Echo(variantrules1(0))

End Sub

End Module

Notes

KB Article ID# PL8775970

Contents

SummaryDetails

Associated Components

Block/UI Interface Stylers Knowledge Fusion Menuscript NX Open - All Languages NX Open Python Open for C/C++ Open for CAE Open for GRIP Open for Java Pre-NX6 UI Styler SNAP UDO