Constraining dimensions on a drawing?

Constraining dimensions on a drawing?

harvey_craig2RCUH
Advocate Advocate
815 Views
10 Replies
Message 1 of 11

Constraining dimensions on a drawing?

harvey_craig2RCUH
Advocate
Advocate

When I create drawings I like to line up all my dimensions. The way I do it now is I sketch a horizontal line and just pull the dimensions until they line up with it, then remove line after.

harvey_craig2RCUH_0-1709825191372.png

As you can see I would pull the 29.0 down to meet my sketch line. This is painstaking. Is there a way I can line these up with a horizontal constraint like I would with points in a sketch? It would be also nice to be able to 'group' them so I don't have to select them all before moving vertically.

Thanks,

Harvey

0 Likes
Accepted solutions (1)
816 Views
10 Replies
Replies (10)
Message 2 of 11

Frederick_Law
Mentor
Mentor

Don't remember if you can select them and align them.

Also try ordinate.

0 Likes
Message 3 of 11

mluterman
Advisor
Advisor
Yeah, I'd love to have that too. That would be an excellent candidate for the Inventor Ideas Forum.
Message 4 of 11

ampster40
Advisor
Advisor

Ordinate Set will automatically align the dims.

Message 5 of 11

Mario.VanWiechen
Advocate
Advocate

If you select all the dimensions and RMB the menu has an option for aligning the selected dimensions.

 

Always remember  "  RMB " will give you so many options

Message 6 of 11

harvey_craig2RCUH
Advocate
Advocate

Hi I tried this. I selected the dims & RMB to get this menu:

Screenshot 2024-03-08 084419.png

I tried the 'arrange dimensions' and:

Screenshot 2024-03-08 084551.png

It just moves them randomly with no sense of alignment. Is there something else you had in mind?

 

Cheers,

Harvey 

0 Likes
Message 7 of 11

harvey_craig2RCUH
Advocate
Advocate

I tried this but you can only have one origin and in the case of a revolved part with varying diameters the origin changes every time. I'll keep this in mind for set origin instances.

Cheers,

Harvey.

0 Likes
Message 8 of 11

harvey_craig2RCUH
Advocate
Advocate

Yeah the selecting them and aligning them is what I'm doing. The Arrange and Ordinate don't do what I'm looking for.

 

Cheers,

Harvey

0 Likes
Message 9 of 11

harvey_craig2RCUH
Advocate
Advocate

I think you're right, there doesn't appear to do anything I can do for what I'm describing. 

 

Cheers,

Harvey

0 Likes
Message 11 of 11

harvey_craig2RCUH
Advocate
Advocate

Cheers, that works for some of them, not perfect. I've got it saved as an external rule and I can see it being used periodically. Inventor should still add an in-built tool.

 

The code is outdated, I run 2023, here is the code with some minor tweaks to allow it to work as an external rule out the box for anyone who comes across this thread in the future.

 

Sub main() 
   Dim oDrawDoc As DrawingDocument
   oDrawDoc = ThisApplication.ActiveDocument

   ' Determine if there are any dimensions in the select set.
   Dim oSelectSet As SelectSet
   oSelectSet = oDrawDoc.SelectSet
   Dim colDimensions As New Collection
   Dim i As Long
   For i = 1 To oSelectSet.Count
      If TypeOf oSelectSet.Item(i) Is DrawingDimension Then
         ' Add any dimensions to the collection. We need to save them
         ' in something besides the selection set because once we start
         ' manipulating them the select set will be cleared.
         colDimensions.Add(oSelectSet.Item(i))
      End If
   Next

   If colDimensions.Count < 2 Then
      MsgBox ("You must select at least 2 dimensions for this operation.")
      Exit Sub
   End If

   ' Ask the user if he/she wants vertical or horizontal alignment.
   Dim bHorizontal As Boolean
   If MsgBox("Do you want horizontal alignment? (Selecting ""No"" results in vertical alignment)", vbQuestion + vbYesNo, "Align Dimensions") = vbYes Then
       bHorizontal = True
   Else
    bHorizontal = False
   End If
	
   For i = 1 To colDimensions.Count
      Dim oDimension As DrawingDimension
      oDimension = colDimensions.Item(i)
	Dim dPosition As Double
      If i = 1 Then
         ' Get the position of the first dimension text. This is
         ' the position the other dimensions will be aligned to.
         If bHorizontal Then
            dPosition = oDimension.Text.Origin.Y
         Else
            dPosition = oDimension.Text.Origin.X
         End If
      Else
         ' Change the position of the dimension.
         Dim oPosition As Point2d
         oPosition = oDimension.Text.Origin
         If bHorizontal Then
            oPosition.Y = dPosition
         Else
            oPosition.X = dPosition
         End If
    
         oDimension.Text.Origin = oPosition
      End If
   Next
End Sub