How to handle non existent ordinate dimensions?

How to handle non existent ordinate dimensions?

tobias_wiesendanger
Advocate Advocate
411 Views
3 Replies
Message 1 of 4

How to handle non existent ordinate dimensions?

tobias_wiesendanger
Advocate
Advocate

It seems if you create ordinate dimensions and later hide the refenreced geometry, the oridinate dimension is hidden. It still exists and creates problems. If you list all drawing dimension you can see that it is still there. Is there any way I can filter them out of the drawingDimension collection. I cant seem to find any diffrence to a normal ordinate dimension. The object looks exactly the same.

 

You can see this by yourself if you create something like this and iterate over all drawing dimension.

AllVisible.png

When you now supress a hole the result looks the same.

HohleSupressed.png

0 Likes
412 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor

Hi @tobias_wiesendanger.  Very interesting and odd issue.  Since neither the DrawingDimension object, nor the OrdinateDimension object have a Visible property, the only other option I can think about possibly pursuing right now for this is to use the OrdinateDimension.Intent property to get to the DrawingCurve object that it may be attached/associated to, then loop through its Segments and check the DrawingCurveSegment.Visible property.  But that seems like a lot of work, and I'm not even sure if it would work for this situation.  There are so many ways to define Intent, and some don't include any 'geometry', and many times the geometry is just a Point or Point2d type object, which most likely would not help us in this case.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 4

WCrihfield
Mentor
Mentor

One thing I did notice, after attempting to test my theory above, is that it will throw an 'Unspecified error' when attempting to get/access the OrdinateDimension.Intent property of the one dimension who's source Intent has been suppressed.  So, now I'm thinking that we can just check for that property, using a Try...Catch block to 'handle' the potential error, we can figure out which ones most likely aren't going to be visible.  It doesn't seem to trigger the 'Attached' property, so that's not an option, and as you've seen, we can still get its display value, so that's not an option.  And as I suspected before, the Intent.Geometry is definitely not a reliable way to check it either, because every thing I had an OrdinateDimension attached to, even if I clicked on drawing view geometry when I placed them, their Intent.IntentType was not kGeometryIntent, so I was not able to check the Visible property of any geometry.

 

It seems like a rather unique situation with OrdinateDimensions / OrdinateDimensionSets that, as long as it wasn't the Origin dimension of the set, it doesn't cause any visible problems in the drawing when one of the things being dimensioned gets suppressed.

 

P.S.:  Below is the fairly simple iLogic code I used for testing, after I cleaned it up a bit, so it might be used as a test in a loop.

Sub Main
	oDDoc = ThisDrawing.Document
	oSheet = oDDoc.ActiveSheet
	For Each oDD As DrawingDimension In oSheet.DrawingDimensions
		If Not IntentProblem(oDD) Then
			MsgBox(oDD.Text.Text, , "")
		Else
			MsgBox("IntentProblem = True")
		End If
	Next
End Sub

Function IntentProblem(oDim As DrawingDimension) As Boolean
	If TypeOf oDim Is OrdinateDimension Then
		Dim oOD As OrdinateDimension = oDim
		Dim oIntent As GeometryIntent = Nothing
		Try
			oIntent = oOD.Intent
			Return False
		Catch oEx As Exception
			'MsgBox("Error trying to get 'Intent' of OrdinateDimension." & vbCrLf & _
			'oEx.Message & vbCrLf & oEx.StackTrace, , "")
			Return True
		End Try
	End If
	Return False
End Function

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 4

tobias_wiesendanger
Advocate
Advocate

Thank you very much for your elaborate answer. Sadly it is kinda what I thought. There seems to be no solution to find out what dimension is "hidden" and which is not.

 

I tried with GeometryIntent but sadly this works fine for me even if the dimension is not visible. There is no error to catch.

The difference is I did it in VBA if that matters (shouldnt). It will be used in an inventor addin written in C# and there are odd behaviors with such dimensions. Sometimes it is not possible to get the value with text.text on the dimension. Most of the time it works, sometimes it doesnt. (The getter fails).

 

And yes it is a very unique situation but sadly it is something that can be done by the user. And as we all know if a user can do something they probaby will 🙂

 

I create a table based on the drawingDimension collection and this will lead to rows that dont have a "real" reference to something on the sheet.

0 Likes