Change the diameter dimension location

Change the diameter dimension location

huanggy
Enthusiast Enthusiast
727 Views
6 Replies
Message 1 of 7

Change the diameter dimension location

huanggy
Enthusiast
Enthusiast

Dear All,

 

We need re-location the diameter dimension after we change the drawing view's scale. but we didn't know how to chane the Startpoint of the dimension (mark with Red word "1"), just find the text location.

 

Who knows how to set the new point to for the startpoint?

 

Many appreciate fo any input!

 

Thanks and My Regards,

 

Gengyun

 

 

0 Likes
728 Views
6 Replies
Replies (6)
Message 2 of 7

philippe.leefsma
Alumni
Alumni

Hi Gengyun,

 

I was trying to modify the "DrawingDimension.DimensionLine" property or start/end point of it but none of this was working, so unfortunately I'm sceptical it is possible to achieve what you are looking for from the API.

 

I'm sending a query to the devlopment team and will let you know the feedback.

 

Thank you,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 7

huanggy
Enthusiast
Enthusiast

Thanks, Philippe.

 

We are ADN member and I forget to log it on Autodesk subscription support.

 

Looking forward your reply about this case.

 

My Best Regards,

 

Gengyun

0 Likes
Message 4 of 7

philippe.leefsma
Alumni
Alumni

Hi Gengyun,

 

Here is the feedback I received:

 

Currently from API what we can move is the DimensionText.Origin which will move both the point “1” and dimension text (marked as “2” ), but unfortunately there is no API to return the position of the point “1” so we can’t get the distance between the point “1” and the dimension text origin and so we can’t workaround it.

 

Sorry for the bad news.

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 5 of 7

huanggy
Enthusiast
Enthusiast

Thanks for you quicly feedback, Philippe.

 

The problem is DimensionText.Origin is un-controlable. you may test it by VBA. for example, add 10 for Y, and apply, then add 10 for X and apply. sometimes the text move to wrong direction.

 

Thanks again and hope Autodesk will fix it in next version.

 

My Best Regards,

 

Gengyun

0 Likes
Message 6 of 7

Vladimir.Ananyev
Alumni
Alumni

Try this method. It works for me.

Public Sub Test_MoveDimTextBox()
  ' Set a reference to the drawing document.
  ' This assumes a drawing document is active.
  Dim oDrawDoc As DrawingDocument
  Set oDrawDoc = ThisApplication.ActiveDocument
  
  ' Set a reference to the active sheet.
  Dim oSheet As Sheet
  Set oSheet = oDrawDoc.ActiveSheet
  
  Dim oView As DrawingView
  Set oView = oSheet.DrawingViews.Item(1)
  
  Dim oDim As DrawingDimension
  Set oDim = oSheet.DrawingDimensions.Item(1)
  
  Dim oText As DimensionText
  Set oText = oDim.Text

  ' Change the position of the Dimension Text
  Dim oP As Point2d
  Set oP = oText.Origin
  oP.X = oP.X - 5
  oP.Y = oP.Y + 2
  oText.Origin = oP
  oSheet.Update
  Beep
End Sub

 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 7 of 7

huanggy
Enthusiast
Enthusiast

Thanks,Vladimir. we will take a try!

0 Likes