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!

CATScript

Status
Not open for further replies.

JDoh

Aerospace
Mar 30, 2012
4
Hi,
Looking over the forum has helped me a lot, but now I am looking for a bit of help. I am very much a begineer in the cat script side of things and currently use the record macro function.

Im currently trying to create some script that will do the following:
- Copy v4 2D Drawing data
- Paste into V5 drawing

When using the macro, and running it it always comes up with an error. 'The CSO is empty, Copy operation can not be performed'

The macro recorder code is below.

Private Sub CommandButton1_Click()

Dim document1 As Document
Set document1 = CATIA.ActiveDocument

Dim selection1 As Selection
Set selection1 = document1.Selection


Set selection1 = CATIA.ActiveDocument.Selection
CATIA.DisplayFileAlerts = False

selection1.Copy

Dim windows1 As Windows
Set windows1 = CATIA.Windows

Dim specsAndGeomWindow1 As SpecsAndGeomWindow
Set specsAndGeomWindow1 = windows1.Item("Drawing2")

specsAndGeomWindow1.Activate

specsAndGeomWindow1.WindowState = catWindowStateMaximized

Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument

Dim selection2 As Selection
Set selection2 = drawingDocument1.Selection

selection2.Clear

Dim drawingRoot1 As DrawingRoot
Set drawingRoot1 = drawingDocument1.GetItem("CATIADrawingDrawing0")

selection2.Add drawingRoot1

selection2.Paste

Dim specsViewer1 As SpecsViewer
Set specsViewer1 = specsAndGeomWindow1.ActiveViewer

specsViewer1.Reframe


Any help would be greatly apprciated.
 
Replies continue below

Recommended for you

In Most cases it is actually Drawing 1, As one of my other functions is that of opening a blank V5 Drawing and opening a V4 drawing.
 
Hi,

Why don't you use Migratev4tov5 from Tools-Options ? You want something specific ? It can be done but....why complicated when it can be easy ?

Regards
Fernando
 
I forgot...complete path to migration tool is Tools-Options-Utility...

Regards
Fernando
 
Hi, Thank you very much for your reply.

Im trying not to use the migration tool, As the program I am designing should do the following operations.
1. Open up folder where V4 data is
2. Open blank V5 drawing sheet
3. Copy Over v4 data to v5 sheet
4. Change Text, Dimensions, Levels, Colour all to new standard
5. Save file with the inputs from the Userform.

So far, I have 1,2 and 4 complete, with 5 nearly there.
Just struggling with number 4.
 
Do you have a sample .model file to upload ?

Regards
Fernando
 
Hi,

Sorry for late response, I've been very busy...

I tried to do what you want but I didn't succeed...probably the only way to do it as you wish is open the .model file, use sendkeys to switch from *Master sheet to SHT 4 sheet (using arrow right), then use search to select everything in SHT 4, copy and paste in v5 drawing.

The problem is I cannot switch from first sheet to the second one (using sendkeys) which is in fact the most important thing.

Anyway, I still believe is much easier to use conversion tool and after that enter in v5 drawings to correct what you want (if this cannot be done directly when you are using conversion tool).

Regards
Fernando
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor