Results 1 to 5 of 5

Thread: Copy page setup from another file

  1. #1
    Login to Give a bone
    0

    Default Copy page setup from another file

    Does anyone have any idea why this doesn't work? The important/significant lines are in a small for . . . each loop towards the end.

    Code:
       Private Sub subCopyPageSetupFromFile()
    
            Dim strDrvPathFileExt As String
    
            Dim objSrcDB As New Database
    
            Dim objTransactionManager As Autodesk.AutoCAD.DatabaseServices.TransactionManager
    
            Dim objTransaction As Transaction
    
            Dim objSrcPlotSettingsDictionary As DBDictionary
    
            Dim objDictionaryEntry As DictionaryEntry
    
            Dim objPlotSettings As PlotSettings
    
    
            strDrvPathFileExt = "C:\ProgramData\Autodesk\ApplicationPlugins\Acad.dwt"
    
            objSrcDB.ReadDwgFile(strDrvPathFileExt, FileOpenMode.OpenForReadAndReadShare, True, "")
    
            objTransactionManager = objSrcDB.TransactionManager
    
            objTransaction = objTransactionManager.StartTransaction
    
            objSrcPlotSettingsDictionary = objTransaction.GetObject(objSrcDB.PlotSettingsDictionaryId, OpenMode.ForRead)
    
            For Each objDictionaryEntry In objSrcPlotSettingsDictionary
    
                objPlotSettings = objTransaction.GetObject(objDictionaryEntry.Value, OpenMode.ForRead)
    
                MsgBox(objDictionaryEntry.Key.ToString.ToUpper)
    
            Next
    
            objTransaction.Dispose()
    
            objTransactionManager.Dispose()
    
    End Sub
    Last edited by BlackBox; 2019-07-16 at 01:31 PM. Reason: Please use [CODE] Tags

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,536
    Login to Give a bone
    0

    Default Re: Copy page setup from another file

    Norman's C# code here should help (convert to VB as desired):

    https://forums.autodesk.com/t5/net/i...2698926#M19537

    There's also a good description of how a Layout is a PlotSettings Object; don't be misled by the VB code in that thread.

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3620, Core i7-7700K 4.2GHz, 64GB RAM, Samsung 970 Pro M.2, 8GB NVIDIA Quadro P4000

  3. #3
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    5,735
    Login to Give a bone
    0

    Default Re: Copy page setup from another file

    Also, your code doesn't check for the existence of page setups in the destination dwg. If they already exist, copying them from a source db will not overwrite them. I delete them from the destination db before I start to import them.
    C:> ED WORKING....

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    5,735
    Login to Give a bone
    0

    Default Re: Copy page setup from another file

    Here is my solution. ImportPageSetups.zip contains two commands. PageSetups.zip contains a form and Active.zip contains a class of objects by Scott McFarlane. Add them to your project and rename the namespaces to match your project.
    Attached Files Attached Files
    C:> ED WORKING....

  5. #5
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,536
    Login to Give a bone
    0

    Default Re: Copy page setup from another file

    This old thread may be of use as well:

    https://forums.augi.com/showthread.p...=1#post1219546
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3620, Core i7-7700K 4.2GHz, 64GB RAM, Samsung 970 Pro M.2, 8GB NVIDIA Quadro P4000

Similar Threads

  1. 2016: Page Setup Manager/Page Setups not importing
    By tbevis730888 in forum AutoCAD General
    Replies: 2
    Last Post: 2016-07-02, 03:49 PM
  2. Replies: 4
    Last Post: 2013-11-17, 09:49 PM
  3. Copy Page Setup
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2010-03-29, 01:24 PM
  4. Page setup copy?
    By pearlx100 in forum AutoCAD Plotting
    Replies: 4
    Last Post: 2009-06-08, 10:56 PM
  5. Missing Page Setups in Page Setup Override
    By footprint_arch in forum AutoCAD Sheet Set Manager
    Replies: 2
    Last Post: 2005-06-15, 08:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •