Results 1 to 7 of 7

Thread: "Apply to Layout" VBA command

  1. #1
    Member
    Join Date
    2018-10
    Posts
    8
    Login to Give a bone
    0

    Default "Apply to Layout" VBA command

    How can I call the "Apply to Layout" button in the plot windows using vba? ApplytoLayout.png

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

    Default Re: "Apply to Layout" VBA command

    VBA and most api's don't interact with the GUI. You need to write your own plotting code. The plot dialog is called by a running version of the PLOT command and only one command can run at a time.
    C:> ED WORKING....

  3. #3
    Member
    Join Date
    2018-10
    Posts
    8
    Login to Give a bone
    0

    Default Re: "Apply to Layout" VBA command

    I am kinda new to this all VBA Autocad. So I put together a code that opens the drawings, sets the printer name, plot style, and plot settings of each individual drawing depending on specific block attribute exported from each drawing and depending on user input I export the drawing to pdf or print the respective drawing to the printer I set. I got the code working, now I would like to "Apply to layout" those plot setting prior to saving and closing the drawings. Or any way I can have those plot settings saved to the layout so the next person that opens the drawings would see those same parameters.

    If I were to do it manually after running my code it would be to go the <Previous plot> page setup and press "Apply to layout" how can i do that using the PLOT command?

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

    Default Re: "Apply to Layout" VBA command

    My old vla-SetActivePageSetup custom .NET LispFunction may be of some help:

    http://forums.augi.com/showthread.ph...=1#post1219546

    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

  5. #5
    Member
    Join Date
    2018-10
    Posts
    8
    Login to Give a bone
    0

    Default Re: "Apply to Layout" VBA command

    Quote Originally Posted by BlackBox View Post
    My old vla-SetActivePageSetup custom .NET LispFunction may be of some help:

    http://forums.augi.com/showthread.ph...=1#post1219546

    Cheers
    I will try to look into it and I will let you know

  6. #6
    Member
    Join Date
    2018-10
    Posts
    8
    Login to Give a bone
    0

    Default Re: "Apply to Layout" VBA command

    Quote Originally Posted by Ed Jobe View Post
    VBA and most api's don't interact with the GUI. You need to write your own plotting code. The plot dialog is called by a running version of the PLOT command and only one command can run at a time.
    I have currently set the parameters via excel vba as follow, I was thinking that there would be a way I can add one line at the end to just save them to the layout.
    Code:
       
        Dim AcadApp As AcadApplication
        AcadApp.ActiveDocument.ActiveLayout.ConfigName = "DWG To PDF.pc3"
        AcadApp.ActiveDocument.ActiveLayout.RefreshPlotDeviceInfo
        AcadApp.ActiveDocument.ActiveLayout.PlotRotation = ac90degrees
        AcadApp.ActiveDocument.ActiveLayout.UseStandardScale = False
        AcadApp.ActiveDocument.ActiveLayout.StandardScale = ac1_1
        'ect.
        AcadApp.ActiveDocument.Plot.NumberOfCopies = 1
        AcadApp.ActiveDocument.Plot.PlotToDevice
       'Is there something like AcadApp.ActiveDocument.Plot.Save ?

    I might be understanding you now, otherwise please let me know (sorry I am not strong in either Autocad or Coding). Are you referring to the "-Plot" command in Autocad? I will need to send command in order to do what i want?

    Code:
    AcadApp.ActiveDocument.SendCommand -plot
    'ect.
    cadApp.ActiveDocument.SendCommand y ' Save changes to page setup [Yes/No]? <N> Y

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

    Default Re: "Apply to Layout" VBA command

    You've made changes to the active Layout's page setup. Which is fine. You could also use the layout's CopyFrom method.
    Code:
    AcadApp.ActiveDocument.ActiveLayout.CopyFrom AcadApp.ActiveDocument.PlotConfigurations (itemName)
    If you wanted to make changes to a page setup/PlotConfiguration, you would do it to a PlotConfigurations(item) and then use the Layout.CopyFrom method to make it active.
    C:> ED WORKING....

Similar Threads

  1. Replies: 2
    Last Post: 2016-12-22, 01:02 PM
  2. Replies: 8
    Last Post: 2012-08-18, 01:31 AM
  3. apply command does not apply in "edit rail"
    By ray salmon in forum Revit Architecture - General
    Replies: 0
    Last Post: 2008-12-16, 06:21 PM
  4. How to show "last printed" or "path" text in layout
    By cstone in forum AutoCAD General
    Replies: 3
    Last Post: 2008-11-29, 12:05 AM
  5. Replies: 1
    Last Post: 2005-11-23, 05:58 PM

Tags for this Thread

Posting Permissions

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