Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dimension text positon

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
atomic.lex
455 Views, 3 Replies

Dimension text positon

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

 

Labels (1)
3 REPLIES 3
Message 2 of 4
Cadkunde.nl
in reply to: atomic.lex

If its not working as expected, can you tell us what you were expecting or trying to accomplish

Message 3 of 4
atomic.lex
in reply to: Cadkunde.nl

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).

Message 4 of 4
Cadkunde.nl
in reply to: atomic.lex

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.

Post to forums  

Autodesk Design & Make Report