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.
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.