Jump to content

Search the Community

Showing results for tags 'copyobjects layers'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 1 result

  1. Hi, I am trying to copy a layer "DATE" from an old drawing file and then pasting to new drawing file. Following is the VBA code... Private Sub CommandButton1_Click() Dim oDoc As New AxDbDocument Dim nDoc As New AxDbDocument Dim newPath As String 'without layer and updated Dim oldPath As String 'to update UserForm1.Hide 'Call the copyLayer() CopyLayers newPath, oldPath End Sub Private Sub UserForm_Activate() oldPath = "E:\ACE\Testing\09Dec\oldFile.dwg" newPath = "E:\ACE\Testing\30Jan\newFile.dwg" savPath = "E:\ACE\Testing\09Dec\oldFile_Copy.dwg" End Sub 'To copy the Layers from newFile and pasting them to OldFile Public Sub CopyLayers(ByVal newFile As String, ByVal oldFile As String) Dim oDbx As Object 'To update i.e OLD FILE Dim nDbx As Object 'Updated i.e NEW FILE Dim olayer As AcadLayer Dim i As Integer With ThisDrawing.Application Set nDbx = .GetInterfaceObject("ObjectDBX.AxDbDocument.18") End With nDbx.Open FileName:=newFile 'Copying the Layers from Updated File i.e NEW FILE Dim copyLay() As Object For Each olayer In nDbx.Layers If UCase(olayer.Name) = "DATE" Then ReDim Preserve copyLay(i) Set copyLay(i) = olayer 'MsgBox olayer.Name i = i + 1 End If Next 'MsgBox i Dim idPairs As Variant 'Dim copyObj As Variant 'Opening the NEW FILE to copy the Layer With ThisDrawing.Application Set oDbx = .GetInterfaceObject("ObjectDBX.AxDbDocument.18") End With oDbx.Open FileName:=oldFile nDbx.CopyObjects copyLay, ThisDrawing.Application.ActiveDocument.ModelSpace, idPairs oDbx.SaveAs savPath Set oDbx = Nothing Set nDbx = Nothing End Sub There no error, but my old file is not getting updated.. !! Whats wrong with this code??? Regards JB
×
×
  • Create New...