vla-put-stylesheet on all layouts?

Discussion in 'AutoCAD' started by Josh, Sep 24, 2004.

  1. Josh

    Josh Guest

    I want to check for and old stylesheet name and push a new one to each
    layout in a drawing as needed. It works sometimes, errors out sometimes
    with automation error. I thought the problem may have been with pushing the
    same name as the current name to a layout; hence the IF statement. Am I
    missing something here?

    ;;;change old ctb's to new ones
    (vlax-for lay (vla-get-layouts (vla-get-activedocument
    (vlax-get-acad-object)))
    (setq plotsty (strcase (vla-get-stylesheet lay))
    newplotsty (cond
    ((= plotsty "OLDNAME1.CTB") "newname1.ctb")
    ((= plotsty "OLDNAME2.CTB") "newname2.ctb")
    (t plotsty)
    )
    )
    (if (/= plotsty newplotsty)
    (vla-put-stylesheet lay newplotsty)
    )
    )

    Thanks,
    Josh
    A2K, LDD3, XP
     
    Josh, Sep 24, 2004
    #1
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.