Message 1 of 11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Evening all
I have a rule that positions each view label at a set distance below each view. Is there a way to move the label based on the number of dimensions below the view. I found this rule a while ago (And cant find it again) and cant get it to work. Can anyone help me out please
Donald
Inventor 2024
Sub Main Dim oDoc As DrawingDocument = ThisDoc.Document Dim oSheet As Sheet = oDoc.ActiveSheet Dim oView As DrawingView = oSheet.DrawingViews.Item(1) ' Assuming you're working with the first view ' Get the lowest Y position of all dimensions on the drawing sheet Dim lowestY As Double = GetLowestDimensionY(oSheet) ' Get the label associated with the view Dim oLabel As DrawingLabel = oView.Label ' Define the new position for the label Dim newX As Double = oLabel.Position.X Dim newY As Double = lowestY - 10 ' Adjust this value as needed for spacing ' Move the label to the new position oLabel.Move(New Point2d(newX, newY)) ' Refresh the drawing to see the changes oSheet.Update() End Sub Function GetLowestDimensionY(sheet As Sheet) As Double Dim lowestY As Double = Double.MaxValue For Each oDim As GeneralDimension In Sheet.DrawingDimensions Dim dimPosition As Point2d = oDim.Position Dim dimY As Double = dimPosition.Y If dimY < lowestY Then lowestY = dimY End If Next Return lowestY End Function
Solved! Go to Solution.