×
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

Copy Drawing Page

Copy Drawing Page

Copy Drawing Page

(OP)
Does anyone know how to copy a specific page out of a drawing into another drawing using Vb?

I do remember this being ask before but I can't seem to find that post.

Thanks
Kapmc

RE: Copy Drawing Page

The Ctrl+C and Ctrl+V is not working for you?

but try this

Note! The code shown only copies geometry, not text or pictures.

'******************************
'******************************

'Assumes one blank drawing as the active document
'and one open template drawing called "Template1.CATDrawing", with titleblock
'geometry drawn in the background view
'Titleblock geometry will be pasted into the background of the new blank drawing

Sub catmain()

Dim NewDrawing As DrawingDocument
Dim TemplateDrawing As DrawingDocument

Set NewDrawing = CATIA.ActiveDocument
Set TemplateDrawing = CATIA.Documents.Item("Template1.CATDrawing")

TemplateDrawing.Activate 'Activates the template drawing
Dim TemplateDrawingBackground As DrawingView
Set TemplateDrawingBackground = TemplateDrawing. _
Sheets.ActiveSheet.Views.Item(2) 'background

Dim TemplateSelection As Selection
Set TemplateSelection = TemplateDrawing.Selection
TemplateSelection.Search ("Drafting.Geometry;All")
TemplateSelection.Copy

'Paste the copied geometry into the new drawing:
NewDrawing.Activate 'activates the new, blank drawing
Dim NewDrawingBackground As DrawingView
Set NewDrawingBackground = NewDrawing. _
Sheets.ActiveSheet.Views.Item(2) 'background

Dim NewDrawingSelection As Selection ' Selections are for one document only
Set NewDrawingSelection = NewDrawing.Selection

NewDrawingSelection.Add NewDrawingBackground
NewDrawingSelection.Paste

End Sub


'******************************
'******************************


*edit*
Try in CATIA's search editor to find the expression that will select everything(geometry,text...) in the drawing,
and replace "Drafting.Geometry;All" with the found expression
*edit*

I stole this code snippet from a post by Bjorn D

Regards,
Derek

RE: Copy Drawing Page

(OP)
Derek:

Ya you know me why use the simple path when you can complicate the issue.

Thanks for the code I will give it a try.

Kapmc.

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