measure number between extension line

measure number between extension line

jostroopers
Collaborator Collaborator
630 Views
6 Replies
Message 1 of 7

measure number between extension line

jostroopers
Collaborator
Collaborator

I have placed a part on a drawing.

I have added dimensions.

This model can occur in different lengths.

If I change the model in length, my model will be neatly adjusted in the drawing.

Only the number of the dimensions is no longer in the middle between the extension lines.

How can I make sure that the number is neatly in the middle between the extension lines after I have changed the length of the model.

Mvg Jos
Youre drawings are as good as the symbols that compleet them.....
0 Likes
Accepted solutions (1)
631 Views
6 Replies
Replies (6)
Message 2 of 7

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Hi, I think you should look for a way to identify the dimensions. In this example of ilogic, you will center all the dimensions of the active sheet

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet= oDoc.ActiveSheet
For Each oDrawingDim As DrawingDimension In oSheet.DrawingDimensions
    If TypeOf oDrawingDim Is LinearGeneralDimension Or _
       TypeOf oDrawingDim Is AngularGeneralDimension Then
        Call oDrawingDim.CenterText
    End If
Next

You can center a specific dimension if you identify it through the item, as in this example

 

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet

oSheet.DrawingDimensions(1).CenterText

 Maybe you could put an event to the drawing file so that the rule runs automatically. For example, before any change of drawing view or before saving the drawing file.

I hope this helps with your problem. regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 7

jostroopers
Collaborator
Collaborator

Hi Sergio

Thanks for the quick response.

The first code works for me.

I placed it to the After Save Document event trigger.

 

Thanks a lot.

Mvg Jos
Youre drawings are as good as the symbols that compleet them.....
0 Likes
Message 4 of 7

CCarreiras
Mentor
Mentor

Hi!

 

I tried the code but ia have an issue... i have to run it twice to center the dimensions.

Fisrt time i run the code, nothing happens.

 

It's supposed to work like that?

inv2020.1

CCarreiras

EESignature

0 Likes
Message 5 of 7

Sergio.D.Suárez
Mentor
Mentor

The code is not supposed to do that, try this code

If the code does the same as above, try the following. 

 

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet= oDoc.ActiveSheet
For Each oDrawingDim As DrawingDimension In oSheet.DrawingDimensions
    If oDrawingDim.Type = 117474560 Or oDrawingDim.Type = 117474816 Then
        oDrawingDim.CenterText
    End If
Next

 Sometimes inventor performs the operations but the changes are not displayed correctly, a trick that works for me is to turn on and off so that they update themselves.

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet= oDoc.ActiveSheet
For Each oDrawingDim As DrawingDimension In oSheet.DrawingDimensions
    If oDrawingDim.Type = 117474560 Or oDrawingDim.Type = 117474816 Then
        oDrawingDim.CenterText
		oDrawingDim.HideValue = True
		oDrawingDim.HideValue = False
    End If
Next


I hope this helps. regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 6 of 7

CCarreiras
Mentor
Mentor

Hi!

After i add your fixes, it star to working well.

 

Then... i deleted the fixes (back to the original code again).... and now, it works well!!
Therefore...... your original code should work well.

 

Sorry,  i don't know what happens before.

CCarreiras

EESignature

0 Likes
Message 7 of 7

jostroopers
Collaborator
Collaborator

After some tests with the length of my model, the dimensions were not placed in the middle. I also used the other codes but then nothing changed. I now have an event trigger after saving the document and have placed the rule in it twice. Now it works.

Mvg Jos
Youre drawings are as good as the symbols that compleet them.....
0 Likes