Catia V5 Macro for Dimension properties
Catia V5 Macro for Dimension properties
(OP)
Hello All,
Could anyone help with the macro which sets all dimension properties for,
1. Dimensions font with Catia Symbols (0.156 inch size) Regular Style with 20% spacing.
2. Precision of all linear dimensions should be 2 decimal.
3. Precision of all Basic dimensions(Dimensions with rectangular frame) should be 3 decimal.
4. Angular dimensions should not be touched for decimal places but the point no.1 above applies.





RE: Catia V5 Macro for Dimension properties
Dim oDrwDoc As DrawingDocument
Dim oSheets As DrawingSheets
Dim oSheet As DrawingSheet
Dim oViews As DrawingViews
Dim oView As DrawingView
Dim oDims As DrawingDimensions
Dim oDim As DrawingDimension
Dim oDimVal As DrawingDimValue
Dim vc As Integer 'view count
Dim dc As Integer 'dimension count
Sub CATMain()
CATIA.DisplayFileAlerts = False
Dim Message, Style, Title, Response, MyString
Message = ("This macro will cchange all your drawing dimensions from current unit to millimeters with 3 decimals (except those from main and background views)" &_
(chr(13)) &_
""&(chr(13))&_
" Do you want to continue ?")
Style = vbYesNo + vbDefaultButton1 'Define default button
Title = "Purpose "
Response = MsgBox(Message, Style, Title)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes"
Set oDrwDoc = CATIA.ActiveDocument
Set oSheets = oDrwDoc.Sheets
Set oSheet = oSheets.ActiveSheet
Set oViews = oSheet.Views
For vc = 3 To oViews.Count 'scan all views for dimensions except main view and background views
Set oView = oSheet.Views.Item(vc)
oView.Activate
Set oDims = oView.Dimensions
For dc = 1 To oDims.Count
Set oDim = oDims.Item(dc)
Set oDimVal = oDim.GetValue
oDimVal.SetFormatName 1, "NUM,DIMM" 'pay attention to number format and unit, for inches you can write "NUM.DINC" or "in"
oDimVal.SetFormatPrecision 1, "0.010" 'precision - this is what you are searching for but you need to modify the macro, this is just an example
Next 'dc
Next 'vc
End If
End Sub
Regards
Fernando
RE: Catia V5 Macro for Dimension properties
Thanking You,
Regards,
Guru Charan T
RE: Catia V5 Macro for Dimension properties
Regards
Fernando