+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 22
  1. #1
    Forum Newbie
    Using
    AutoCAD 2013
    Join Date
    Sep 2016
    Posts
    5

    Default LISP function to save PDFs in same file

    Registered forum members do not see this ad.

    Hey everyone, I am new to this whole forum thing, so I apologize if I should be starting a new thread but I do have a question related to this that I was hoping you could help with.


    I have been trying to automate my plotting process using MColor 9 which is a extension to CAD for color renderings. The issue is I am trying to plot multiple tabs at once, or back to back automatically. The command for plotting with Mcolor is "MCO_PLOT", but it will only do one tab at a time. I have created a LISP that has gotten me really close to where I want to be, which is:

    Code:
     (defun C:mco-plot ()
      (foreach lay (layoutlist)
        (setvar 'ctab lay)
        (command "_mco_plot")
      ); end foreach
     ); end defun


    *I changed the new command from "mco_plot" to "mco-plot" so it did not conflict.


    This LISP will automatically plot each tab back to back, but the hang up is that on each tab it asks me where I want to save the PDF. What I really need is something to add to this LISP function that will either have the PDF automatically save to the current drawings folder, or just have me specify the location once and save the PDF's for all the tabs in that location. I know this is unique because not everyone has MColor 9, I hadn't even heard of it before until my current job. However, I think there must be a solution out there since the only part I need now is a way to specify the saving location one time (one time per project) and then I would be good to go.


    Thank you for your time!
    Last edited by rkmcswain; 23rd Sep 2016 at 12:56 pm. Reason: added [CODE] tags

  2. #2
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,716

    Default

    If MCO-PLOT is say compiled as a FAS or a .net then you probably can not change it. Some software has extensions to do what you want when running the command. Trying to find info on Mcolor 9 ?
    A man who never made mistakes never made anything

  3. #3
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2011
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    11,720

    Default

    I moved your thread to the AutoLISP, Visual LISP & DCL Forum, please post in the correct forum.

    I also deleted your post in the other thread, please post your question only once.

    Please read the Code Posting Guidelines and edit your Code to be included in Code Tags.
    [CODE]Your Code Here[/CODE] =
    Code:
    Your Code Here
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  4. #4
    Forum Newbie
    Using
    AutoCAD 2013
    Join Date
    Sep 2016
    Posts
    5

    Default

    BIGAL,


    I am not sure if MCO-PLOT is compiled as a FAS or a .net. I'm not really even sure it is truly an extension or not, it was already loaded on my computer at work and they have been using it for several years. It might be a separate program that is linked to CAD, but I am not sure. The code that I posted does already work though as far as repeating the MCO-PLOT command for each tab, but it is prompting me to select a location to save the pdf for each tab(for example, if I run the command, it asks to save the first tab, then it plots it to PDF and then it asks to save the next tab and so on. Even if I hit cancel it still cycles through all the tabs with a saving location prompt). The saving part is what I am trying to automate... I have reached out to the Mcolor support staff and they did say that they could do batch plotting, but I couldn't get it to work and it seemed just as tedious as plotting individually.

  5. #5
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,716

    Default

    When you run the MCO-plot does it ask the questions at the command line or does it use a Dialouge box. If its command line then you should be able to supply filename etc

    Search your pc for MCO* and look at file type is it lsp fas dvb exe dll arx etc
    A man who never made mistakes never made anything

  6. #6
    Forum Newbie
    Using
    AutoCAD 2013
    Join Date
    Sep 2016
    Posts
    5

    Default

    BIGAL,


    I created the MCO-PLOT lisp command, so it is a lsp file. I searched the computer like you said and that was the only thing that came up. Mcolor seems to be an exe file type. When I run the MCO-PLOT, I type the command and then it comes up with a dialogue box that asks where I would like to save the file. It does that for each tab automatically because of the way I set the lisp function up, but I would like it to save automatically too without prompting me on each tab.

  7. #7
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,716

    Default

    Need you to post lisp, you added more info but did not supply a hint you say a dialouge comes up is that part of your lisp ?

    A lot of software can be command line driven with extra settings, no extra info then dialouge box appears

    Here is an example using lisp to write the command line with switches
    Code:
    ;by Roy_043
    (startapp (strcat gsExe " " "-sDEVICE=pdfwrite -dBATCH -dNOPAUSE -dQUIET  ""-sOutputFile=\"" trgFile "\" ""\"" (KGA_String_Join srcFileLst "\" \"") "\"" ))
    A man who never made mistakes never made anything

  8. #8
    Forum Newbie
    Using
    AutoCAD 2013
    Join Date
    Sep 2016
    Posts
    5

    Default

    Sorry, I'm confused. I posted the lisp in the first post. The dialogue box is not part of it.

  9. #9
    Super Member
    Using
    not applicable
    Join Date
    Jun 2016
    Posts
    519

    Default

    The post BIGAL is quoting a (too) small portion from:
    http://www.cadtutor.net/forum/showth...l=1#post667826
    BricsCAD 16

  10. #10
    Super Member
    Using
    not applicable
    Join Date
    Jun 2016
    Posts
    519

    Default

    Registered forum members do not see this ad.

    This may work.
    Code:
    (defun C:mco-plot ()
      (if (= 1 (getvar 'dwgtitled))
        (foreach lay (layoutlist)
          (setvar 'ctab lay)
          (command "_mco_plot" (strcat (getvar 'dwgprefix) lay ".pdf"))
        )
      )
      (princ)
    )
    BricsCAD 16

Similar Threads

  1. Save a dwg in a subfolder with the same name as the file, using lisp code
    By ankoron in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 10th Sep 2016, 11:40 am
  2. Replies: 17
    Last Post: 15th Nov 2015, 12:07 pm
  3. Lisp Command For Setting The Auto File Save Location
    By ReinierMeyer in forum AutoLISP, Visual LISP & DCL
    Replies: 17
    Last Post: 9th Jan 2014, 05:49 pm
  4. calling commands from loaded arx file using lisp function (command)
    By LibertyOne in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 3rd May 2011, 01:43 pm
  5. Where to save a Lisp file?
    By amounjid in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 7
    Last Post: 23rd Sep 2008, 09:27 pm

Tags for this Thread

Bookmarks

Posting Permissions

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