Hello everyone.
I make some macro.
I want to numbering all Dimensions for draft.
So, I write some code.
-------------------------------------------------
Sub CATMain()
Dim MyDoc As DrawingDocument
Dim MySelection As Selection
Dim MySheet As drawingsheet
Dim MyDrawingView As DrawingView
Dim MyDimensions As DrawingDimensions
Dim MyDimension As DrawingDimension
Dim MyText As DrawingText
Dim oValues(5)
Dim drawingview1 As DrawingView
Dim Dimensions1 As DrawingDimensions
Dim Dimension2 As DrawingDimension
Dim Text1 As DrawingText
Set MyDoc = CATIA.ActiveDocument
Set MySheet = MyDoc.DrawingRoot.ActiveSheet
Set MySelection = MyDoc.Selection
If MySelection.Count = 0 Then
MsgBox "Nothing Selected"
Exit Sub
Else
For k = 1 To MySelection.Count
If MySelection.Item(k).Type = "DrawingView" Then
Set MyDrawingView = MySelection.Item(1).Value
Set MyDimensions = MyDrawingView.Dimensions
For i = 1 To MyDimensions.Count
Set MyDimension = MyDimensions.Item(i)
Dim MyDimV
Set MyDimV = MyDimension
Call MyDimV.GetBoundaryBox(oValues)
Set MyText = MyDrawingView.Texts.Add("No. 000" & i, oValues(0), oValues(1))
If MySelection.Item(k).Type = "drawingview" Then
Set drawingview1 = MySelection.Item(2).Value
Set Dimensions1 = drawingview1.Dimensions
For j = 1 To Dimensions1.Count
Set Dimension1 = Dimensions1.Item(j)
Dim MyDimX
Set MyDimX = Dimension1
Call MyDimX.GetBoundaryBox(oValues)
Set Text1 = drawingview1.Texts.Add("No. 000" & i + j, oValues(0), oValues(1))
Next
End If
Next
End If
Next
End If
End Sub
-----------------------------------------
This code don't activate normally.
Only activate One view.
Next view is not activate.
But I want activate all view.
If one view have 10 dimesions then next view's number start 11.
hlep,,,