HLP: Changing Style with LSP

Discussion in 'AutoCAD' started by Mr. B, Mar 7, 2004.

  1. Mr. B

    Mr. B Guest

    I've a self-made LSP file I wrote many years ago. I first select an
    'existing' line of Text and my routine continues the Text on the next line.

    This works fine for my companies 'default' font type (a non-standard Acad
    font). This font (ARCHQUIK.SHX) has 5 options after the 'name' when you use
    STYLE. However, IF I pick an existing font that is not my 'standard', and
    which has more, or less, options, my routine craps out.

    This is part of my LISP file:

    (princ "\nSelect First line of Text: ")
    (setq txt1 (entget (car (entsel))))
    (setq txtht1 (cdr (assoc '40 txt1))) ; get height of selection
    (setq txtst1 (cdr (assoc '10 txt1))) ; get insert pt of selection
    (setq txtly1 (cdr (assoc '8 txt1))) ; get layer of selection
    (setq newdist (+ txtht1 (* txtht1 0.618))) ; suggested text line spacing
    (setq etxt (getvar "textstyle")) ; get exist Text Style

    ; set to existing selected text
    (setq ntxt (cdr (assoc '7 txt1))) ; GROUP 7 is Text Style - new
    (command "-style" ntxt "" txtht1 "" "" "N" "N")

    The 'last' line is what can give me problems IF I select another font type.

    QUESTION:
    Is there some way is LISP that will allow my to change my current Font without
    using the "-STYLE" command? So that regardless of Height, Oblique, etc.
    options, it will change?

    Regards,

    Bruce
     
    Mr. B, Mar 7, 2004
    #1
  2. Maybe (setvar "TEXTSTYLE" "...") will do what you need?

    Juergen
     
    Jürgen Palme, Mar 7, 2004
    #2
  3. Mr. B

    Mr. B Guest

    DUH! Oh am I an idiot :(

    I've only been writting lisp's files for years... (silly me!)

    Thanks!

    Bruce
     
    Mr. B, Mar 7, 2004
    #3
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.