Nachfolgendes Makro setzt Rähmchen um das/die angegebenen Mass/e:

 

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
   
   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

Zum Seitenanfang