Modify AcadDimRotated Object

Modify AcadDimRotated Object

Anonymous
Not applicable
487 Views
1 Reply
Message 1 of 2

Modify AcadDimRotated Object

Anonymous
Not applicable
How do I modify the dimension points of an AcadDimRotated object? I created
it by: Set MyDim = ThisDrawing.ModelSpace.AddDimRotated(p1, p2, p3, ang). I
now want to go through a dwg file and modify the p1s and p2s. Thanks.


Chris
0 Likes
488 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
"Chris Picklesimer" wrote in message
news:38A45537F0CC418AF5F5DB4D7AB9FB3A@in.WebX.maYIadrTaRb...
> How do I modify the dimension points of an AcadDimRotated object? I
created
> it by: Set MyDim = ThisDrawing.ModelSpace.AddDimRotated(p1, p2, p3, ang).
I
> now want to go through a dwg file and modify the p1s and p2s. Thanks.

In VBA, there is no way to do this, but there is
a way using AcadX.arx, which is available at my
web site.

The demo code below requires the latest version of
AcadX (www.caddzone.com/acadx/acadx.htm). Don't try
this with older versions, because in the process of
writing this demo, I found and fixed a bug that was
causing this code to fail on older versions.

'--------------------------------------------------------
' Sub: SetDimOriginPoint
' Moves the origin point of a dimension to a new location
' ADim is the dimension
' Pos identifies which origin point to move (0 = first, 1 = second)
' NewPoint identifies the new location of the origin point

Public Sub SetDimOriginPoint(ADim As AcadDimension, _
Pos As Integer, NewPoint As Variant)
Dim AcadX As New AcadXApplication
Dim Indices(0 To 0) As Long
Indices(0) = Pos
Dim OldPts As Variant
OldPts = AcadX.GetStretchPoints(ADim)
Dim Disp(0 To 2) As Double
Dim i As Integer
For i = 0 To 2
Disp(i) = NewPoint(i) - OldPts((Pos * 3) + i)
Next i
AcadX.MoveStretchPointsAt ADim, Indices, Disp
End Sub

Public Sub Test()
Dim Ent As AcadEntity
Dim Pt As Variant
Dim NewPoint As Variant
Utility.GetEntity Ent, Pt, vbCrLf & "Dimension: "
Dim Pos As Integer
Pos = Utility.GetInteger(vbCrLf & _
"Point to move (first = 0, second = 1): ")
NewPoint = Utility.GetPoint(, vbCrLf & "New location: ")
SetDimOriginPoint Ent, Pos, NewPoint
End Sub

'--------------------------------------------------------
0 Likes