Setting layer Plotstyle in VBA

Discussion in 'AutoCAD' started by Kevin Schafer, Dec 7, 2004.

  1. I'm trying to create a VBA routine which will create layers from a comma
    delimited file. The file will contain all the layer setting including Name,
    Freeze/thaw, On/off, Color, Linetype, Lineweight, Plotstyle. I have been
    able to get the routine to create the layers with everything correct,
    however I can't get the routine to assign a plotstyle to the layer.

    I'm attempting to set the plotstyle by using the
    NEWLAYER.PlotStyleName = LAYPLOTSTYLE

    where NEWLAYER is defined as the layer I'm creating and LAYPLOTSYLE is the
    name of the style I want set to that layer.

    Any help would be greatly appreciated
     
    Kevin Schafer, Dec 7, 2004
    #1
  2. The Help File specifies the property is

    String; read-write (write-only for the Group object)
    The plot style name for the object.

    I interpret this to mean it is read only for all objects other than the Group object. I can't modify it manually in the layer properties dialog.

    Regards - Nathan
     
    Nathan Taylor, Dec 7, 2004
    #2
  3. I read that in the help file. However I have another routine that changes
    some existing layer settings that allows me to set the plotstylename. I've
    compared the the two files and can't figure out why one is letting me set
    the property and my new one is not.
     
    Kevin Schafer, Dec 8, 2004
    #3
  4. Is it safe to assume that the drawing is set to use STBs??? If the drawing
    is set to use CTBs, then you cannot set a plot style for a layer.
    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Dec 8, 2004
    #4
  5. Yes the drawing is setup to use .STB's and the correct plot style table file
    is loaded and set as the default to be used for all drawings.

    thanks
     
    Kevin Schafer, Dec 8, 2004
    #5
  6. The name-based plot styles need to exist in the drawing before you can
    assign them to the layer's property. Just loading the .stb file is not
    enough. The easiest way to make sure they exist is to assign each style to
    an AcadEntity before you attempt to assign it to the Layer object.

    --
    R. Robert Bell


    I'm trying to create a VBA routine which will create layers from a comma
    delimited file. The file will contain all the layer setting including Name,
    Freeze/thaw, On/off, Color, Linetype, Lineweight, Plotstyle. I have been
    able to get the routine to create the layers with everything correct,
    however I can't get the routine to assign a plotstyle to the layer.

    I'm attempting to set the plotstyle by using the
    NEWLAYER.PlotStyleName = LAYPLOTSTYLE

    where NEWLAYER is defined as the layer I'm creating and LAYPLOTSYLE is the
    name of the style I want set to that layer.

    Any help would be greatly appreciated
     
    R. Robert Bell, Dec 9, 2004
    #6
  7. Thanks I'll try this and see if that fixes my problem
     
    Kevin Schafer, Dec 10, 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.