Line Up Dimensions
Line Up Dimensions
(OP)
I have two dimensions in drafting, and want to Line up one of them to other, I used Line-Up option, but it only aligned the dimension line and not the dimension value. I want to overlap both dimensions exactly to the Dimension value position. I tried to create a macro, but I am not able to get x and y values of drawing dimension text, unlike Drawing Text.





RE: Line Up Dimensions
But why? Are the two values different?
RE: Line Up Dimensions
Sub CATMain()
Dim DrwDoc As DrawingDocument
Set DrwDoc = CATIA.ActiveDocument
Dim dd As DrawingDimension
Dim xy(7) As Variant
Dim dd1 As Object
Dim m1, c1, m2, c2, x_intersection, y_intersection As Double
Dim oSel1 As Selection
Set oSel1 = CATIA.ActiveDocument.Selection
ReDim strArray1(1)
Dim sStatus1 As String
strArray1(0) = "DrawingDimension"
sStatus1 = oSel1.SelectElement3(strArray1, "Select Dimensions to Align", False, CATMultiSelTriggWhenUserValidatesSelection, False)
Set dd = oSel1.Item(1).Value
Set dd1 = oSel1.Item(2).Value
oSel1.Clear
dd1.GetBoundaryBox xy
m1 = (xy(7) - xy(1)) / (xy(6) - xy(0))
c1 = xy(1) - m1 * xy(0)
m2 = (xy(5) - xy(3)) / (xy(4) - xy(2))
c2 = xy(5) - m2 * xy(4)
If m1 - m2 <> 0 Then
int_x = (c2 - c1) / (m1 - m2)
int_y = m1 * int_x + c1
dd.MoveValue int_x, int_y, 1, 1
End If
End Sub
RE: Line Up Dimensions
indocti discant et ament meminisse periti