See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Setting Plot Style Table in Lisp

  1. #1
    I could stop if I wanted to
    Join Date
    2004-12
    Location
    California
    Posts
    283
    Login to Give a bone
    0

    Default Setting Plot Style Table in Lisp

    Afternoon -

    I need to build into my lisp a way to set the appropriate plot style table and make it active.

    I've searched through the forums here and no one really gave an answer, so please do not post links to other posts!

    I've tried the following list with nothing working.....

    (vla-RefreshPlotDeviceInfo objLayout)
    (vla-Put-StyleSheet objLayout "MyStyle.stb")

    ThisDrawing.ActiveLayout.StyleSheet = "MyStyle.stb"

    (vl-load-com)
    (vla-put-PrinterStyleSheetPath (vla-get-Files (vla-get-Preferences (vlax-get-acad-object))) "MyStyle.stb")

    I've attached a pic of the tool itself from the options dialog box but I need a way of doing this from the command line for the lisp routine.

    Any suggestions?
    Attached Images Attached Images

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    1

    Default Re: Setting Plot Style Table in Lisp

    So are you trying to set "default" STB file (for use with R14 and previous drawings - as your photo shows), or are you trying to set the current STB file for a particular layout?

    IF the former...

    Code:
     (setq o (vla-get-Output (vla-get-Preferences (vlax-get-acad-object))))
     (vla-put-PlotPolicy o 0)
     (vla-put-DefaultPlotStyleTable o "monochrome.stb")
    IF the latter.....

    See this post for an example of setting the "stylesheet" for multiple layouts in multiple drawings.

    If you just want to operate on the current layout, then here is a lisp example:

    Code:
      (vla-put-StyleSheet
        (vla-get-ActiveLayout
      	(vla-get-ActiveDocument (vlax-get-acad-object))
        )
        "monochrome.stb"
      )
    Last edited by rkmcswain; 2007-01-30 at 02:36 AM.
    R.K. McSwain | CAD Panacea |

  3. #3
    I could stop if I wanted to
    Join Date
    2004-12
    Location
    California
    Posts
    283
    Login to Give a bone
    0

    Default Re: Setting Plot Style Table in Lisp

    I am getting the following error on both routines.....

    "Automation Error. Invalid input"

    What's that?

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: Setting Plot Style Table in Lisp

    Quote Originally Posted by fletch97
    I am getting the following error on both routines.....

    "Automation Error. Invalid input"

    What's that?
    Have you run the following function?
    Code:
    (vl-load-com)
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    I could stop if I wanted to
    Join Date
    2004-12
    Location
    California
    Posts
    283
    Login to Give a bone
    0

    Default Re: Setting Plot Style Table in Lisp

    Nope but I just added it in and I got the same error for the second routine and basically the same error for the first routine except it says "invalid argument" instead of "input".

    Any Ideas?

  6. #6
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Setting Plot Style Table in Lisp

    Quote Originally Posted by fletch97
    Nope but I just added it in and I got the same error for the second routine and basically the same error for the first routine except it says "invalid argument" instead of "input".

    Any Ideas?
    If you did a staight copy and paste of RK's code, does monochrome.stb exist?

    Or if you changed it, can Autocad find the one you are trying to set?

    Just a guess, though.

    HTH

  7. #7
    I could stop if I wanted to
    Join Date
    2004-12
    Location
    California
    Posts
    283
    Login to Give a bone
    0

    Default Re: Setting Plot Style Table in Lisp

    I changed the name to ours, which is there.....not sure why RK's routine won't work?



    Command: (setq o (vla-get-Output (vla-get-Preferences (vlax-get-acad-object))))
    #<VLA-OBJECT IAcadPreferencesOutput2 0b1d7b18>

    Command: (vla-put-PlotPolicy o 0)
    nil

    Command: (vla-put-DefaultPlotStyleTable o "hmc-std.stb")
    *Cancel*

    Command:
    Command:
    Command: Automation Error. Invalid Argument

  8. #8
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Setting Plot Style Table in Lisp

    Quote Originally Posted by fletch97
    I changed the name to ours, which is there.....not sure why RK's routine won't work?

    Command: (setq o (vla-get-Output (vla-get-Preferences (vlax-get-acad-object))))
    #<VLA-OBJECT IAcadPreferencesOutput2 0b1d7b18>

    Command: (vla-put-PlotPolicy o 0)
    nil

    Command: (vla-put-DefaultPlotStyleTable o "hmc-std.stb")
    *Cancel*

    Command:
    Command:
    Command: Automation Error. Invalid Argument
    You are using R14?

    If so, I don't have it to test it; maybe someone else will chime in.

    I did test the second one in 2006, and it returned a similar error message when the file wasn't found, but worked correctly when it was. This would lead me to believe that maybe there is something amiss with the file name specified.

  9. #9
    I could stop if I wanted to
    Join Date
    2004-12
    Location
    California
    Posts
    283
    Login to Give a bone
    0

    Default Re: Setting Plot Style Table in Lisp

    I am running ADT 2006


    The file is there because I can see it as an option in the dialog box for the options menu as well as in the layer manager. So how can I get this to set it from the command line?

    Take a look at my first attachment on my first post.....you can see my stb file there.

  10. #10
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Setting Plot Style Table in Lisp

    Quote Originally Posted by fletch97
    I am running ADT 2006


    The file is there because I can see it as an option in the dialog box for the options menu as well as in the layer manager. So how can I get this to set it from the command line?

    Take a look at my first attachment on my first post.....you can see my stb file there.
    OK.

    I think you need to use RK's second example instead of the first. I couldn't make the first one work in 2006, either, and It may be because of a change between versions. Maybe RK will verify later.

    Have you tried the second example? Here is what I did:

    I wrapped the code in a defun called test and loaded it.

    Code:
    (defun c:test ()
     (vla-put-StyleSheet
        (vla-get-ActiveLayout
      	(vla-get-ActiveDocument (vlax-get-acad-object))
        )
        "Black.ctb"  ;;<--we still use CTB, yours would be hmc-std.stb
      )
    )
    Then I went to a layout and changed the plot style to something else, then executed test at the command line. Then I went back into the layout manager to verify that it changed it to Black.ctb.

    It works here. (2006) Maybe someone that uses STBs will verify it for STBs.

Page 1 of 2 12 LastLast

Similar Threads

  1. Change All Layers' Plot Style Setting
    By parker.depriest356295 in forum AutoLISP
    Replies: 1
    Last Post: 2013-02-05, 07:05 PM
  2. setting the plot style
    By rstiles in forum AutoLISP
    Replies: 5
    Last Post: 2012-02-10, 07:54 PM
  3. Replies: 1
    Last Post: 2006-10-13, 04:58 PM
  4. Plot style Table
    By rputhenv in forum AutoCAD Plotting
    Replies: 5
    Last Post: 2005-03-05, 08:30 AM

Posting Permissions

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