The following script will create frame(s) around dimension(s):

 

Option Explicit
'---------------------------------------------------------------------------------------
' Procedure : FrameDim
' Author    : jherzog
' Date      : 14.05.2015
' Time      : 15:33
' Languages : VBA 6.5
' V5-Release: V5R19/21
' Purpose   : Add frame around dimension
' Parms     : -
' Ret. Value: -
'
' Syntax    : FrameDim
'
' Prereqs   : An active drawing with dimensions
' Remarks   : Interactive; multi-sel
'---------------------------------------------------------------------------------------
'
Const strVersion As String = "V1.0"
Const strMacroName As String = "Frame Dimensions"

Sub CATMain() 'MakeRefDim()
   Dim oAD As DrawingDocument
   Dim InputObjectType(0)
   Dim oSel As Object 'Selection
   Dim oDim As DrawingDimension
   Dim oDimVal As DrawingDimValue
   Dim strStat As String
   Dim n As Integer
   
   Dim oTolType As Long       'Tolerance type
   Dim oTolName As String     'Tolerance Name
   Dim oUpTol As String       'Upper tolerance value (alpha numerical type)
   Dim oLowTol As String      'Lower tolerance value (alpha numerical type)
   Dim odUpTol As Double      'Upper tolerance value (numerical type)
   Dim odLowTol As Double     'Lower tolerance value (numerical type)
   Dim oDisplayMode As Long   'Tolerance display mode

   Set oAD = CATIA.ActiveDocument
   
   Set oSel = oAD.Selection
   InputObjectType(0) = "DrawingDimension"
   
   strStat = oSel.SelectElement3(InputObjectType, "Wählen Sie die Bemaßung aus", True, CATMultiSelTriggWhenSelPerf, True)
   If (strStat <> "Normal") Then
      MsgBox "Macro terminated by user", vbOKOnly Or vbCritical, strMacroName & " " & strVersion
      Exit Sub
   Else
      For n = 1 To oSel.Count2
         Set oDim = oSel.Item2(n).Value
         Set oDimVal = oDim.GetValue
         oDim.ValueFrame = catFraRectangle           'draw rectangle around dim
         oDimVal.ValueFramedElement = catFraValueTolText
         oDimVal.ValueFramedGroup = catFraBoth
      Next
   End If
   
   oSel.Clear

End Sub

Go to top