Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Determine if Drawing Dimension is Broken

13 REPLIES 13
SOLVED
Reply
Message 1 of 14
Maxim-CADman77
739 Views, 13 Replies

Determine if Drawing Dimension is Broken

I'd like to know the way to determine if particular Drawing Dimension is Broken.

I mean those dimensions crossing View-Break sign like this:

BrokenDimensionSample.png

 

For now I don't even see any simple way to get the name of a DrawingView the Dimension belongs to.

13 REPLIES 13
Message 2 of 14

Inventor itself can determine it (judging by the display option in dimension style settings):

BrokenDimensionSymbol.png

BrokenDimension.png

Message 3 of 14

Hi @Maxim-CADman77 ,

 

You should be able to identify such dimension lines by querying the (Get/Set) ShowBreakSymbol() boolean on the DimensionStyle Object as documented here.

 

Let me know in case of any further questions.

 

-

Tobias

 

Edit: I might have misinterpreted the question. You don't necessarily need to know which view the dimensions belong to but rather the position of their GeometryIntents in relation to the Start and End Point of the Break Operation in addition to their orientation. That way you should be able to determine whether ShowBreakSymbol() should be true or not.

Does that approach make sense and is easy enough to implement?

Tobias Orlow
Designated Support Specialist
Customer Success Organization
Linkedin: www.linkedin.com/in/tobiasorlow/
Message 4 of 14

I believe this is related only to dimension style but not particular dimensionns.

Message 5 of 14

Hi @Maxim-CADman77 ,

 

Ah I see what you mean.

Within the Dimension you can only query and change the property via the dimensions' "Style" and changes would be made to the style itself.

If you do have the requirement to set the BreakSymbol per Dimension, I believe it would be best to log it on the IdeaStation.

 

Tobias Orlow
Designated Support Specialist
Customer Success Organization
Linkedin: www.linkedin.com/in/tobiasorlow/
Message 6 of 14

I'd rather prefer some (even tricky) workaround within next several days than ideal solution several years later.

Message 7 of 14

@Maxim-CADman77,

 

Try below VBA code to identify broken dimension in drawing.

 

Sub Select_Broken_Dimension()
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oSheet As Sheet
    Set oSheet = oDoc.ActiveSheet
    
    Dim oDimension As DrawingDimension
    For Each oDimension In oSheet.DrawingDimensions
        Dim d As Double
        d = distance(oDimension.DimensionLine.StartPoint.Y, oDimension.DimensionLine.StartPoint.X, oDimension.DimensionLine.EndPoint.Y, oDimension.DimensionLine.EndPoint.X)
        d = d / 10
        If d <> oDimension.ModelValue Then
            Call oDoc.SelectSet.Select(oDimension)
        End If
        
    Next
End Sub

Function distance(ya As Double, xa As Double, yb As Double, xB As Double)
    distance = Sqr((ya - yb) ^ 2 + (xa - xB) ^ 2)
End Function

 

Please feel free to contact if there are any queries.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 8 of 14

This is good idea!

 

But still needs adding some analysis of the Drawing View.

I mean it doesn't take to consideration DrawingView Scale value (works as expected only for dimensions belong to 1:1 Scaled Views).

 

PS: I believe it's also worth to compare rounded values, like:

If Round(d,8) <> Round(oDD.ModelValue,8) Then

Message 9 of 14

@Maxim-CADman77,

 

Please provide non confidential sample drawings (different scale) to test the feasibility.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 10 of 14

I believe you don't need another sample.

Just change Drawing View Scale value to something different  from "10:1".

Then to keep it working as expected you'll need to change accordingly the hard-coced multiplier in line

 d = d / 10

For Dimension that belongs to 5:1 Scaled View:
     d = d/5

For Dimension that belongs to 1:2 Scaled View:

    d = d*2

...etc.

Message 11 of 14
Message 12 of 14

I still hope it is possible to get scale multiplier of the parent view for each dimension...

Message 13 of 14

I'm attaching a sample set of model and drwing with several broken dimensions on several views with different scale.

I still hope somebody will help me to make VS (View Scale) variable an accosiative.

My current code is:

Sub Main
	Dim oIDW As DrawingDocument = ThisApplication.ActiveDocument
	Dim oSh As Sheet = oIDW.ActiveSheet
	Dim oDD As DrawingDimension
	Dim MsgMody As String
	Dim VS As Double ' View Scale

	For Each oDD In oSh.DrawingDimensions
		MsgBody &= oDD.Text.Text
'		MsgBody &= oDD.ModelValue
		VS = 1/2 ' !!!!
		Dim d As Double = OnIDWdistMM(oDD.DimensionLine.StartPoint.Y, oDD.DimensionLine.StartPoint.X, oDD.DimensionLine.EndPoint.Y, oDD.DimensionLine.EndPoint.X) / VS
		MsgBody &= " (" &  Round(d,3) & ")" ' 
		If Round(d,8) <> Round(10*oDD.ModelValue,8) Then MsgBody &= " - BROKEN !!!"
		MsgBody &= vbCrLf
	Next
	MsgBox(MsgBody,,"Dimensions' Break status:")
End Sub

Function OnIDWdistMM(ya As Double, xa As Double, yb As Double, xB As Double)
	OnIDWdistMM = 10 * Sqrt((ya - yb) ^ 2 + (xa - xB) ^ 2)
End Function

 

Message 14 of 14

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report