Hello All,
I have to create text indicating number below each and every dimension for every view. See the attached image for more clarity. Right now I am doing it manually. I want to automate this process. I have created a macro for it. But the problem is that I text is not coming at a desired place. Its location is far away from dimensions. Any help regarding this will be highly appreciated. Here is my code.
I have to create text indicating number below each and every dimension for every view. See the attached image for more clarity. Right now I am doing it manually. I want to automate this process. I have created a macro for it. But the problem is that I text is not coming at a desired place. Its location is far away from dimensions. Any help regarding this will be highly appreciated. Here is my code.
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)
Set MyDoc = CATIA.ActiveDocument
Set MySheet = MyDoc.DrawingRoot.ActiveSheet
Set MySelection = MyDoc.Selection
If MySelection.Count = 0 Then
MsgBox "Nothing Selected"
End
Else
If MySelection.Item(1).Type = "DrawingView" Then
Set MyDrawingView = MySelection.Item(1).Value
Set MyDimensions = MyDrawingView.Dimensions
Set MyDimension = MyDimensions.Item(1)
Dim MyDimV
Set MyDimV = MyDimension
Call MyDimension.GetBoundaryBox(oValues)
'MsgBox oValues(1)
Set MyText = MyDrawingView.Texts.Add("Temp", oValues(0), oValues(1))
Else
MsgBox "Wrong Selection"
End If
End If
End Sub