Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Line Up Dimensions

Status
Not open for further replies.

man2007

Aerospace
Nov 6, 2007
283
IN
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.
 
Replies continue below

Recommended for you

You either need a macro or overlay the dimension values manually.

But why? Are the two values different?
 
We are updating drawing views with similar parts, where we end up in getting lot of pink dimensions. Re-routing will not work for some dimensions, and we need to create new ones. To avoid writing ECN and also to ease the comparison of old and new drawings, we exactly overlap the dimension values. I was looking for an option built-in in Catia itself, but could not find one. Finally I was able to write the following macro: We need to use this macro along with Line-Up option to get the desired result.

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
 
I had the feeling that the scale of the view will come into the equation, as the distance from the value to the dimline, which is defined by the drawing standard.

Eric N.
indocti discant et ament meminisse periti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top