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 Drafting VBA Copy and Paste Between Views

Status
Not open for further replies.

kvu35

Aerospace
Jun 11, 2019
2
US
I am trying to create a macro that copies and pastes a drawing component from the background view to another view. So far I've tried this (not written perfectly, written for readability):

Dim bubble as DrawingComponent
Set bubble = CATIA.ActiveDocument.Views....Components.Item('Bubble1')

Dim viewToPasteInto as DrawingView
Set viewToPasteInto = CATIA.ActiveDocument....

Dim sel as Selection
Set sel as CATIA.ActiveDocument.Selection

sel.Clear
sel.Add bubble
viewToPasteInto.Activate()
sel.Paste

The macro pastes the bubble, but not in the desired view. It will paste the bubble in the original view: the background view. For some reason, sending the windows key command CTRL+V in subsitute of sel.Paste will give the desired outcome. That is,

Dim bubble as DrawingComponent
Set bubble = CATIA.ActiveDocument.Views....Components.Item('Bubble1')

Dim viewToPasteInto as DrawingView
Set viewToPasteInto = CATIA.ActiveDocument....

Dim sel as Selection
Set sel as CATIA.ActiveDocument.Selection

sel.Clear
sel.Add bubble
viewToPasteInto.Activate()

' press CTRL+v

I've tried using PasteSpecial with all of the input parameters possible but nothing.
 
Replies continue below

Recommended for you

Selection.Clear ' just to be nice
Selection.Add ObjectToCopy
Selection.Copy
Selection.Clear
Selection.Add WhereToPaste ' in your case the target DrawingView
Selection.Paste
Selection.Clear



Eric N.
indocti discant et ament meminisse periti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top