Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catia Macro Drafting Dimension Change

Status
Not open for further replies.

NaWin55

Mechanical
Mar 21, 2020
97
IN
Hi
I want to create a macro to change all the dimensions of the drafting document
i have created this macro but its not working properly.
here is the macro

Option Explicit
Sub CATMain()

Dim myDrawDoc As DrawingDocument
Set myDrawDoc = CATIA.ActiveDocument

Dim drawSheets As DrawingSheets
Set drawSheets = myDrawDoc.Sheets

Dim drawiSheet As DrawingSheet
Set drawiSheet = drawSheets.ActiveSheet

Dim drawviews As DrawingViews
Set drawviews = drawiSheet.Views

Dim i As Integer
Dim oSel As Selection
Set oSel = CATIA.ActiveDocument.Selection
oSel.Clear
oSel.Search ("Drafting.View,scr")
For i = 1 To oSel.Count
Dim Drawview As DrawingView
Set Drawview = drawviews.Item(i)
MsgBox Drawview.Name
Next

Dim drawDims As DrawingDimensions
Set drawDims = Drawview.Dimensions

Dim j As Integer
Dim oSel2 As Selection
Set oSel2 = CATIA.ActiveDocument.Selection
oSel2.Clear
oSel2.Search ("Drafting.Dimension,all")
For j = 1 To oSel.Count
Dim drawDim As DrawingDimension
Set drawDim = drawDims.Item(j)
drawDim.GetValue.SetFormatName 1, "cm"
Next
End Sub

Here is the error
DimError_zq04rs.png

Here is the drawing file image
I want the macro to change dimensions of the drawing doc to cm or mm or m
DraftDoc_s1ivw4.png

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top