Plot Style Lists

Discussion in 'AutoCAD' started by rthomas, Feb 16, 2004.

  1. rthomas

    rthomas Guest

    Here's the scenario:
    I have a routine that creates an assortment of objects that should remain on the same layer. However they should plot at different line weights. My company controls line weights by use of plot styles (stb). In this routine I want to select a plot style from a list of all the styles contained in a particular table (the stb file). I can access the table all right but can't seem to figure out how to get at the individual styles within the table. Suggestions appreciated.
    Thanks
    Richard thomas
     
    rthomas, Feb 16, 2004
    #1
  2. rthomas

    dean_bourke Guest

    If my memory serves me correctly, I believe in R2002 all of the plotstyles in the current PS table were shown in the drop down box in the properties toolbar. It seems that in R2004 only Plot styles that are in use (ie assigned to a layer) are visible in that box. So I suppose you could assign all plot styles to individual layers to get the in the box.

    Dean
     
    dean_bourke, Feb 16, 2004
    #2
  3. rthomas

    rthomas Guest

    I understand that. But how do you access the list from lisp or vba. I can create a list of all the available plot style tables (ie acad.stb, monochrome.stb ourcompanyplotstyle.stb etc) using lisp but can't get access to the individual styles contained in those tables. If I know which particular style I want in advance I could use the "change" command but I would rather be able to select from a list if possible. I have another routine now that I use to create layers (on the fly so to speak) that allows the user to select from a list of plot styles. However this list was created just for this routine by creating a list within the routine and not by accessing the native Autocad table. The problem with this method is that it does not allow you to change tables without writing another separate routine. To my way of thinking it would be preferable to be able to choose the table and then the style.
    Richard Thomas
     
    rthomas, Feb 17, 2004
    #3
  4. rthomas

    BillZ Guest

    (vlax-safearray->list (vlax-variant-value (vla-getplotstyletablenames
    (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object))))))

    Bill
     
    BillZ, Feb 17, 2004
    #4
  5. rthomas

    BillZ Guest

    Now that I read your post again I'm not sure that I answered your question.
    Are you trying to change to different plot styles via lisp?

    (vlax-put-property (vla-get-output (vla-get-preferences (vlax-get-acad-object))) "DefaultPlotStyleTable" "acad.ctb")

    This also works for :
    DefaultPlotStyleForLayer = "Normal"
    DefaultPlotStyleForObjects = "ByLayer", "ByBlock", "Normal", or any style name in the currently loaded plot style.

    The value of this property is stored in the DEFPLSTYLE system variable.

    From the help files:
    DEFLPLSTYLE System Variable
    Type: String
    Saved in: Registry

    Specifies the default plot style for layer 0. If the current drawing you are working in is in color-dependent mode (PSTYLEPOLICY is set to 1), DEFLPLSTYLE is read-only and has a value of "BYCOLOR." If the current drawing you are working in is in named plot styles mode (PSTYLEPOLICY is set to 0), DEFLPLSTYLE is writable and has a default value of "NORMAL."

    To convert the current drawing to use named or color-dependent plot styles, use CONVERTPSTYLES.

    HTH

    Bill
     
    BillZ, Feb 17, 2004
    #5
  6. rthomas

    rthomas Guest

    I will admit I am about as thick as a brick. Technical writing has never been my forte. I am only moderately comfortable with autolisp and am barely more than aquainted with vba, so let me try this again. I have a plotstyle TABLE named mycompanyplotstyle.stb. This TABLE contains ten plot styles for lineweight and color named style_1, style_2, style_3 etc. The following gets me a list of the TABLES that are in the Plot Styles Folder under Autocad Support
    (setq acaddoc (vla-get-activedocument (vlax-get-acad-object))
    acadlay (vla-get-activelayout acaddoc))
    (vlax-safearray->list
    (vlax-variant-value
    (vla-GetPlotStyleTableNames acadlay
    )
    )
    )
    )
    This sets the sellected TABLE as current:
    (setq PSTable (getstring))
    (vla-put-StyleSheet
    (vla-get-ActiveLayout
    (vla-get-activedocument
    (vlax-get-acad-object)
    )
    )
    PSTable
    )
    )
    (my Thanks to Jimmy Bergmark for the above)
    The question is: How do you get a list of the styles within the TABLE. ie Style_1, Style_2, Style_3 etc?
    Thanks again,
    Richard Thomas
     
    rthomas, Feb 17, 2004
    #6
  7. rthomas

    BillZ Guest

    The *.ctb files in R2004 are edited in the Autodesk hard copy plot style table editor.

    Sounds like a job for VB.

    Bill
     
    BillZ, Feb 17, 2004
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.