×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

CATScript

CATScript

CATScript

(OP)
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.

RE: CATScript

(OP)
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.
 

RE: CATScript

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
 

RE: CATScript

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

Regards
Fernando
 

RE: CATScript

(OP)
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.
 

RE: CATScript

Do you have a sample .model file to upload ?

Regards
Fernando
 

RE: CATScript

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
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources