One simply approach to copy a layout with its entities is use “SendCommand”. Below code shows the procedure where code using command line implementation of layout (layout command) coping.
_
Public Shared Sub ImportLayout()
Dim fd As Object = _
Application.GetSystemVariable("FILEDIA")
Application.SetSystemVariable("FILEDIA", 0)
Dim acadapp As Object = Application.AcadApplication
'start layout command
acadapp.ActiveDocument.SendCommand("-Layout" + vbCr)
'say wants to import from tamplate
acadapp.ActiveDocument.SendCommand("Template" + vbCr)
'provide the file path
acadapp.ActiveDocument.SendCommand("c:temptest.dwt" _
+ vbCr)
'provide the template name
acadapp.ActiveDocument.SendCommand("TestLayout" + vbCr)
Application.SetSystemVariable("FILEDIA", fd)
End Sub

Leave a Reply