0% found this document useful (0 votes)
25 views2 pages

Running Ok

The document defines macros and subroutines to create a table in a CATIA drawing document. It declares variables to store the active drawing document, sheets, views and other objects. The CATMain macro calls the WalkDownTree subroutine to populate an array with part numbers by recursively traversing the product structure. It then adds a table to the active drawing view and populates cells with sequential numbers and the part numbers from the array.

Uploaded by

Vitthal Devakate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

Running Ok

The document defines macros and subroutines to create a table in a CATIA drawing document. It declares variables to store the active drawing document, sheets, views and other objects. The CATMain macro calls the WalkDownTree subroutine to populate an array with part numbers by recursively traversing the product structure. It then adds a table to the active drawing view and populates cells with sequential numbers and the part numbers from the array.

Uploaded by

Vitthal Devakate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Dim z(30) As String

Dim temp As Integer


Dim temp2 As Integer

Sub CATMain()
Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument
Dim drawingSheets1 As DrawingSheets
Set drawingSheets1 = drawingDocument1.Sheets
Dim f As String
f = Replace(drawingDocument1.Name, ".CATDrawing", "")
Dim drawingSheet1 As DrawingSheet
Set drawingSheet1 = drawingSheets1.Item(f)
f = f + ".CATProduct"
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Dim oProdDoc As ProductDocument
Set oProdDoc = documents1.Item(f)
Dim oRootProd As Product
Set oRootProd = oProdDoc.Product
A = 0
Dim par As Parameters
Set par = oRootProd.UserRefProperties
Dim SinexRef As String
Dim DrwDoc As DrawingDocument
Set DrwDoc = CATIA.ActiveDocument
Call WalkDownTree(oRootProd, A)
Dim shActiveSheet As DrawingSheet
Set shActiveSheet = DrwDoc.Sheets.ActiveSheet
Dim vwActiveView As DrawingView
Set vwActiveView = shActiveSheet.Views.ActiveView
'------------------
' CREATE TABLE
'-----------------
' table position: 350, 150
' number of rows equal to 10
' number of columns: 4
' row height: 20
' column width: 50
Dim tblTable As DrawingTable
Set tblTable = vwActiveView.Tables.Add(300, 300, temp + 1, 5, 10, auto)

' set table caption


Dim i As Integer
i = 0
For h = 0 To temp

tblTable.SetCellString 1, 1, "SR.NO."
tblTable.SetCellString 2, 1, "01"
tblTable.SetCellString 3, 1, "02"
tblTable.SetCellString 4, 1, "03"
tblTable.SetCellString 5, 1, "04"
tblTable.SetCellString 6, 1, "05"
tblTable.SetCellString 7, 1, "06"
tblTable.SetCellString 3, 2, z(1)
i = i + 1

Next
MsgBox temp
End Sub
Sub WalkDownTree(oInProduct As Product, B)
Dim k As Integer
Dim oInstances As Products
Set oInstances = oInProduct.Products
If B <> 0 Then
z(B - 1) = oInProduct.ReferenceProduct.PartNumber
temp = B
End If
For k = 1 To oInstances.Count
Dim oInst As Product
Set oInst = oInstances.Item(k)
Call WalkDownTree(oInst, k)
Next
End Sub

You might also like