Continue to Site

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 V5 MACRO: Insert a table from existing CATDrawing file

Status
Not open for further replies.

Nagaraj Metri

Mechanical
May 15, 2024
2
Hello Everyone,

I am looking for a macro to insert a table from a existing CATDrawing file(master drawing) into the active CATDrawing file. I have a master drawing with many table.

Need to follow below steps:
1. Open the master CATDrawing file
2. Select a table
3. Copy the table
4. Insert it into the active CATDrawing file.

Kindly help me to create MS VBA code for this.

Thanks & Regards,
Nagaraj Metri
 
Replies continue below

Recommended for you

I have tried with below code but it is taking some specific output file. I want to add it for current active drawing. Please help me.
I need it for active drawing file & not for this code written file.
Set drawingDocument2 = documents1.Open("C:\Users\nagarajmetri\Desktop\New folder\1.CATDrawing")



Language="VBSCRIPT"

Sub CATMain()

Set documents1 = CATIA.Documents

Set drawingDocument1 = documents1.Open("C:\Users\nagarajmetri\Desktop\New folder\a.CATDrawing")

Set drawingDocument1 = CATIA.ActiveDocument

Set selection1 = drawingDocument1.Selection

selection1.Clear

Set drawingSheets1 = drawingDocument1.Sheets

Set drawingSheet1 = drawingSheets1.Item("Sheet.1")

Set drawingViews1 = drawingSheet1.Views

Set drawingView1 = drawingViews1.Item("Front view")

selection1.Add drawingView1

selection1.Copy

Set documents1 = CATIA.Documents

Set drawingDocument2 = documents1.Open("C:\Users\nagarajmetri\Desktop\New folder\1.CATDrawing")

Set drawingDocument2 = CATIA.ActiveDocument

Set selection2 = drawingDocument2.Selection

selection2.Clear

Set drawingSheets2 = drawingDocument2.Sheets

Set drawingSheet2 = drawingSheets2.Item("Sheet.1")

selection2.Add drawingSheet2

selection2.Paste

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor