I've been writing a script to change the position of the dimension text, but it's not working as expected. Can anyone tell me why and how it might work?
P.S. I set the dimension text to the center position (it works) and after that try to move it by changing the X and Y coordinates (it doesn't work).
Sub ChangeDimTextPosition(DimName As String, DimX As Double, DimY As Double) Dim oDoc As DrawingDocument = ThisDoc.Document Dim oSheets As Sheets = oDoc.Sheets Dim oViews As DrawingViews Dim oName As String Dim oCoords() As Double = {0,0} For Each oSheet As Sheet In oSheets oSheet.Activate oViews = oDoc.ActiveSheet.DrawingViews For Each oView As DrawingView In oViews ViewName = oView.Name For Each oDim As DrawingDimension In oSheet.DrawingDimensions If oDim.Retrieved Then oName = oDim.RetrievedFrom.Parameter.Name Else oName = "" If oName = DimName Then Call oDim.CenterText oCoords(0) = oDim.Text.Origin.X + DimX oCoords(1) = oDim.Text.Origin.Y + DimY Call oDim.Text.Origin.PutPointData(oCoords) Exit Sub End If Next oDim Next oView Next oSheet End Sub
Solved! Go to Solution.
Solved by Cadkunde.nl. Go to Solution.
If its not working as expected, can you tell us what you were expecting or trying to accomplish
Sorry,
I set the dimension text to the center position (it works) and after that try to move it by changing the X and Y coordinates (it doesn't work).
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry Dim pnt As Inventor.Point2d = oTG.CreatePoint2d(oCoords(0), oCoords(1)) oDim.Text.Origin = pnt
Can't find what you're looking for? Ask the community or share your knowledge.