Submitted by vantogeorge on Thu, 08/15/2013 - 02:08
Forums:
Hi All,
May I please know the code to select all comand.
I would like to select all the dimensions by filtering it into Dimensions.
Hi All,
May I please know the code to select all comand.
I would like to select all the dimensions by filtering it into Dimensions.
re: dimensions
Each part maintains a dimension collection which you can access. The following code iterates through this collection in the current work part and writes out some properties of each dimension to the information window.
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
For Each myDim As Annotations.Dimension In workPart.Dimensions
lw.WriteLine("annotation origin: " & myDim.AnnotationOrigin.ToString)
lw.WriteLine("computed size: " & myDim.ComputedSize.ToString)
Dim mainText() As String
Dim dualText() As String
myDim.GetDimensionText(mainText, dualText)
For Each textLine As String In mainText
lw.WriteLine("main text: " & textLine)
Next
For Each textLine As String In dualText
lw.WriteLine("dual text: " & textLine)
Next
lw.WriteLine("is inspection dimension: " & myDim.InspectionDimensionFlag.ToString)
lw.WriteLine("is retained: " & myDim.IsRetained.ToString)
lw.WriteLine("")
Next
lw.Close()
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image when the NX session terminates
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
End Function
End Module
re: dimensions
Hi,
could you modify code to select only dimensions in current drawing sheet?