Get dimension tolerance value from a dimension on a drawing

Get dimension tolerance value from a dimension on a drawing

Anonymous
Not applicable
1,322 Views
2 Replies
Message 1 of 3

Get dimension tolerance value from a dimension on a drawing

Anonymous
Not applicable

I'm trying to get the value of the tolerance on an existing dimension on my drawing.

 

I know how to set the tolerance using:

oDrawingDims.Tolerance.Set...

I also know how to see the current tolerance type:

If oDrawingDims.Tolerance.ToleranceType = 31233 Then...

But how do I read the value of the current tolerance? For example, if the value is currently set to Symmetric, +/- 0.005", or Deviation, +0.001" -0.003", or any of the other tolerance types, how can I get those values using iLogic?

0 Likes
Accepted solutions (1)
1,323 Views
2 Replies
Replies (2)
Message 2 of 3

james.collinsPWQR2
Advocate
Advocate
Accepted solution

Hi,

 

This should do the trick:

 

' set a reference to the active document, assumes that its a drawing document.
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveEditDocument
' set a reference to the sheet
Dim oSheet As Sheet
' cycle through all the sheets
For Each oSheet In oDrawDoc.Sheets
	oSheet.Activate()
	' set a reference to the drawing dimension
	Dim oDim As DrawingDimension
	' define the doubles to hold the values
	Dim oUpperTol, oLowerTol, oModelValue As Double
	' cycle through all the dimensions
	For Each oDim In oSheet.DrawingDimensions
		' get dimensions model value (returns cm's)
		oModelValue = oDim.ModelValue
		' get Upper tolerance
		oUpperTol = oDim.Tolerance.Upper
		' get Upper tolerance
		oLowerTol = oDim.Tolerance.Lower
		' Show user the values
		MsgBox("DIM Value: " & oModelValue & " cm's" & vbLf & _
		"Tol Upper: " & oUpperTol & vbLf & _
		"Tol Lower: " & oLowerTol)
	Next
Next ']j

All the best,

 

James

Message 3 of 3

Anonymous
Not applicable

Thank you, James. That's exactly what I needed!

0 Likes