Text.Origin.y won't work

Text.Origin.y won't work

shastu
Advisor Advisor
205 Views
2 Replies
Message 1 of 3

Text.Origin.y won't work

shastu
Advisor
Advisor

This should be simple.  See below code.  The text in the dimension is centered, but then I want to position the dimension based off of variable that I captured previously.  I tried using oDrawingDim.Text.origin = variable, but it doesn't do it.  In the example below I changed the variable to the value of 5 just to clarify.

 

Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument

' Set a reference to the active sheet
Dim oSheet As sheet
Set oSheet = oDoc.ActiveSheet

Dim oDrawingDim As DrawingDimension

' Iterate over all dimensions in the drawing and
' center them if they are linear or angular.

For Each oDrawingDim In oSheet.drawingDimensions
If TypeOf oDrawingDim Is LinearGeneralDimension Or _
TypeOf oDrawingDim Is AngularGeneralDimension Then
Call oDrawingDim.CenterText
oDrawingDim.Text.origin.y = 5
End If
Next

0 Likes
206 Views
2 Replies
Replies (2)
Message 2 of 3

tyler.warner
Advocate
Advocate

Try this:

Reference example here (link) 

 

 

 

 

Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument

' Set a reference to the active sheet
Dim oSheet As Sheet
oSheet = oDoc.ActiveSheet

Dim oDrawingDim As DrawingDimension

' Iterate over all dimensions in the drawing and
' center them if they are linear or angular.

For Each oDrawingDim In oSheet.DrawingDimensions
	If TypeOf oDrawingDim Is LinearGeneralDimension Or _
	TypeOf oDrawingDim Is AngularGeneralDimension Then
		Dim oPosition As Point2d
		oDrawingDim.CenterText
		oPosition = oDrawingDim.Text.Origin
		oPosition.Y = 5
		oDrawingDim.Text.Origin = oPosition
	End If

Next

 

 

 

 

 

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
0 Likes
Message 3 of 3

shastu
Advisor
Advisor

Thanks.

0 Likes