Move Ordinate Dimension text

Move Ordinate Dimension text

Mario-Villada
Advocate Advocate
1,575 Views
3 Replies
Message 1 of 4

Move Ordinate Dimension text

Mario-Villada
Advocate
Advocate

Hello everyone,

after placing ordinate dimensions  I would like to move the dimension text a bit upwards, I tried by specifying new coordinates of their jogpoints, and the text origin but it does not do anything,

 

This is what I have:

 

For i:= 1 to sktch.SketchLines.Count do
Begin
  sktL1:= sktch.SketchLines.Item[i];
  oGIntent := oSheet.CreateGeometryIntent( sktL1,kStartPointIntent);
  oPt:= sktL1.Geometry.StartPoint;
  oPt := oDV.DrawingViewToSheetSpace(oPt);
  oPt.X := oPt.X+0.5;
  oPt.Y := oPt.Y+1;
  OrdDim := oSheet.DrawingDimensions.OrdinateDimensions.Add(oGIntent,oPt,kHorizontalDimensionType,emptyparam,emptyparam);
  OrdDim.JogPointOne.X := oPt.X+0.5;
  OrdDim.JogPointOne.Y := oPt.Y+0.5;
  OrdDim.JogPointTwo.X := oPt.X+1;
  OrdDim.JogPointTwo.Y := oPt.Y+0.5;
  dimStr := OrdDim.Text.FormattedText;
  OrdDim.Text.FormattedText := 'RL ' +DimStr ;

End;

 

there is no error message, and the code finishes successfully, but the dimension texts remain in the same place.

any Ideas why?

 

I read back the coordinates of the jogpoints before and after changing their coordinates and they do not change, as if they were read only. any suggestion?

 

Regards,

 

Mario.

0 Likes
Accepted solutions (1)
1,576 Views
3 Replies
Replies (3)
Message 2 of 4

YuhanZhang
Autodesk
Autodesk
Accepted solution

Hi Mario,

 

You could try below sample code to move ordinate dimension text position:

 

Sub MoveOrdinateDimTextPosition()
    Dim oSheet As Sheet
    Set oSheet = Me.Sheets(1)
    
    Dim oDim As OrdinateDimension
    For Each oDim In oSheet.DrawingDimensions.OrdinateDimensions
         
        Dim oPos As Point2d
        Set oPos = oDim.Text.Origin
        
        oPos.Y = oPos.Y + 0.2
        
        oDim.Text.Origin = oPos
    Next

End Sub

 Note that the JogPointOne is a Point2d object(transient geometry), and when you want to set it you should do it like:

 

Set oPt = OrdDim.JogPointOne
oPt.Y = oPt.Y + 1
OrdDim.JogPointOne = oPt

 As it is transient, set value to OrdDim.JogPointOne.X does not affect the OrdDim.JogPointOne indeed.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 3 of 4

Mario-Villada
Advocate
Advocate

Thanks a lot Rocky!

As usual you have been very helpful.

 

Mario.

0 Likes
Message 4 of 4

Anonymous
Not applicable

Hi Rocky

 

i'm trying to use this code but the following message box appear

 

Run-time error '-2147418113 (8000ffff)

Method 'JogPointTwo' of object 'OrdinateDimension' failed

 

this is my code

Dim a As OrdinateDimensionSet
Set a = xsheet.DrawingDimensions.OrdinateDimensionSets.Item(1)
Set pos = a.OriginMember.JogPointTwo
pos.Y = pos.Y + 0.2
a.OriginMember.JogPointTwo = pos

 

where is the problem

0 Likes