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
I do remember this being ask before but I can't seem to find that post.
Thanks
Kapmc





RE: Copy Drawing Page
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
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.