TheSwamp

Code Red => VB(A) => Topic started by: Humbertogo on April 25, 2007, 07:15:06 AM

Title: insert a layout from another drawing
Post by: Humbertogo on April 25, 2007, 07:15:06 AM
How can i insert a layout from another drawing like its happing in the desingcenter?
Title: Re: insert a layout from another drawing
Post by: Bryco on April 25, 2007, 11:05:20 AM
I don't remember where I got this.
Code: [Select]
Public Function CopyLayout(Source As AcadLayout, TargetName As String) As AcadLayout

    Dim Doc As AcadDocument, Layout As AcadLayout
    Dim objArray() As Object, i As Integer

    Set Doc = Source.Document
    Set Layout = Doc.Layouts.Add(TargetName)

    If Source.Block.count > 0 Then

        ReDim objArray(0 To Source.Block.count - 1)

        For i = 0 To Source.Block.count - 1
            Set objArray(i) = Source.Block.Item(i)
        Next

        Doc.CopyObjects objArray, Layout.Block

    End If

    Layout.CopyFrom Source

    Set CopyLayout = Layout

End Function
Title: Re: insert a layout from another drawing
Post by: Humbertogo on April 26, 2007, 03:29:42 AM
thanks again