Dimensions of Assembly in idw Drawing

Dimensions of Assembly in idw Drawing

Archershome
Participant Participant
659 Views
3 Replies
Message 1 of 4

Dimensions of Assembly in idw Drawing

Archershome
Participant
Participant

I was wondering if anybody would be able help with some code that will do the following:

 

I have a automated ilogic model that is then used within a 2D drawing, this 2D drawing then has dimensions on it referenced to the the model.

 

This model changes in its length the dimension associated with its length then changes but the dimension text then goes outside of the dimension boundary (does not stay central)

 

Is there any code that can scan the dimensions and in effect tidy them up?

 

Any other ideas of how else this could be done would be great.

 

Cheers in advance

0 Likes
Accepted solutions (1)
660 Views
3 Replies
Replies (3)
Message 2 of 4

ChrisAtherton
Advocate
Advocate
Accepted solution

I use the following in a rule:

 

    ' Set a reference to the active drawing document

    Dim oDoc As DrawingDocument

    oDoc = ThisApplication.ActiveDocument

 

    ' Set a reference to the active sheet

    Dim oSheet As Sheet

    oSheet = oDoc.ActiveSheet

 

    Dim oDrawingDim As DrawingDimension

 

    ' Iterate over all dimensions in the drawing and

    ' center them if they are linear or angular.

 

    For Each oDrawingDim In oSheet.DrawingDimensions

        If TypeOf oDrawingDim Is LinearGeneralDimension Or _

           TypeOf oDrawingDim Is AngularGeneralDimension Then

            Call oDrawingDim.CenterText

        End If

    Next

Chris Atherton
IEng MIMechE BEng Hons
Design Automation Services Manager | Symetri
https://uk.linkedin.com/in/chrissoathe
0 Likes
Message 3 of 4

Archershome
Participant
Participant

Thank you very much Smiley Happy

0 Likes
Message 4 of 4

ChrisAtherton
Advocate
Advocate

No problem,

 

If you look at the code you'll see its similar to the sample in the API help file that comes with inventor.  This is a great resource for finding bits of code that can be used within your iLogic rules.  To use it you either need to convert it from VBA to something that you can use in iLogic or add the sample as a macro that you call via your code.

 

Once your happy with the solution in this forum please mark it as solved.

 

Thanks

 

Chris

Chris Atherton
IEng MIMechE BEng Hons
Design Automation Services Manager | Symetri
https://uk.linkedin.com/in/chrissoathe
0 Likes