Nachfolgendes Makro setzt Klammern um das/die angegebenen Mass/e:

 

Option Explicit
'---------------------------------------------------------------------------------------
' Procedure : MakeRefDim
' Author    : jherzog
' Date      : 14.05.2015
' Time      : 15:33
' Languages : VBA 6.5
' V5-Release: V5R19/21
' Purpose   : Add brackets to dimension (ref dim)
' Parms     : -
' Ret. Value: -
'
' Syntax    : MakeRefDim
'
' Prereqs   : An active drawing with dimensions
' Remarks   : Interactive; multi-sel; try 'Outside rectangle selection trap'
'---------------------------------------------------------------------------------------
'
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 "Abbruch"
      Exit Sub
   Else
      For n = 1 To oSel.Count2
         Set oDim = oSel.Item2(n).Value
         Set oDimVal = oDim.GetValue
         oDimVal.SetBaultText 1, "(", ")", "", ""
      Next
   End If
  
   oSel.Clear

End Sub

Zum Seitenanfang