Submitted by fmattel on Wed, 10/05/2016 - 06:35
Forums:
Hello
I have a drawing with lot of dimensions; some of them are suppressed using the UG Function 'Suppress Drafting Object'; they are controlled by expressions
I created a journal which writes, in a text file, all Append Text and all Dimension Value visible on the drawing but the journal writes also the suppressed ones (not visible); I need only not suppressed dimensions.
I did not find any 'suppress' properties for dimensions object.
How can I do the distinction between 'not suppressed' dimensions (visible on the drawing) and 'suppressed' dimensions (not visible on the drawing)
Thanks in advance for your help
re: suppressed drafting object
You can use the .AskControllingExp method to determine if there is an expression that controls a dimension. If there is a controlling expression, you can query the value of the expression to determine if the dimension is suppressed or not.
re: suppressed drafting object
Thanks a lot for your help
Find below the journal I wrote using '.AskControllingExp'
It gives, in a drawing,all main dimension values; if this dimension is controlled by an expression, the journal gives you also the expression name and the expression value. If expression value = 0, the dimension is suppressed otherwise the dimension is not suppressed.
Hope my explanation is clear enough (English is not my mother tongue)
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module NXJournal
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim lw As ListingWindow = theSession.ListingWindow
Dim MainText() as string
Dim DualText() as string
Dim ExpTag as Tag=nothing
Dim myExp as Expression
Sub Main
lw.open()
For Each partDimension as Annotations.Dimension in workpart.dimensions
theUfSession.drf.AskControllingExp(partDimension.tag,ExpTag)
myExp=Utilities.NXObjectManager.Get(ExpTag)
partDimension.GetDimensionText(MainText, DualText)
if ExpTag <> nothing then
lw.writeline("Dim : " & MainText(0) & " --> " & myExp.name & "=" & myExp.value)
else
lw.writeline("Dim : " & MainText(0))
end if
Next
lw.close()
End Sub
End Module