Trying to figure out if text can be vertical.

Discussion in 'AutoCAD' started by Rick Keller, Sep 29, 2004.

  1. Rick Keller

    Rick Keller Guest

    Hello,

    I am trying to work with setting a style from lisp.

    I know how to do this but if a font can be vertical it has an extra prompt.

    Is there a way to find out if a font can be vertical.

    I know that TTF fonts cannot be vertical. But some SHX fonts can be and some
    cannot.

    So the style command is one prompt longer when you get the vertical option.

    Rick
     
    Rick Keller, Sep 29, 2004
    #1
  2. Rick Keller

    Jeff Mishler Guest

    This should help you....

    (if (= (logand (cdr (assoc 70 (tblsearch "style" "putstylenamehere")))) 4)
    (princ "\nText is vertical!")
    (princ "\nText is NOT Vertical!")
    )
     
    Jeff Mishler, Sep 29, 2004
    #2
  3. Rick Keller

    Rick Keller Guest

    That would work if the text style is set to vertical.
    But what I am looking for is to tell if the FONT can be vertical.

    This way I can use the style command with the correct prompts.

    Example:

    Font can be vertical...

    (command "-style" "stylename" "fontfile" "height" "width" "oblique"
    "backwards" "upside-down" "vertical")

    Font cannot be vertical...

    (command "-style" "stylename" "fontfile" "height" "width" "oblique"
    "backwards" "upside-down")

    Rick
     
    Rick Keller, Sep 29, 2004
    #3
  4. Rick Keller

    Jeff Mishler Guest

    Oh, I see......
    How about:
    (command "-style" "stylename" "fontfile" "height" "width" "oblique"
    "backwards" "upside-down")
    (if (> (getvar "cmdactive") 0)
    (command "vertical")
    )

    --
    Jeff
    check out www.cadvault.com
     
    Jeff Mishler, Sep 29, 2004
    #4
  5. Rick Keller

    Rick Keller Guest

    Yep... That worked.

    Thanks

    Rick


     
    Rick Keller, Sep 29, 2004
    #5
  6. Rick Keller

    MP Guest

    and another stroke of genius from the pen of Mishler!
    :)
    very clever sir!
     
    MP, Sep 30, 2004
    #6
  7. Rick Keller

    Adesu Guest

    Hi Jeff,can you explain to me,about

    1. Logand
    2. Where you find 4

    _$ (if (= (logand (cdr (assoc 70 (tblsearch "style" "standard")))) 4)
    (princ "\nText is vertical!")
    (princ "\nText is NOT Vertical!") )

    Text is NOT Vertical!"\nText is NOT Vertical!"

    _$ (tblsearch "style" "standard")

    ((0 . "STYLE") (2 . "Standard") (70 . 0) (40 . 0.0) (41 . 1.0) (50 . 0.0)
    (71 . 0) (42 . 2.0) (3 . "txt") (4 . ""))

    _$ (assoc 70 (tblsearch "style" "standard"))

    (70 . 0)

    _$ (cdr (assoc 70 (tblsearch "style" "standard")))

    0

    _$ (logand (cdr (assoc 70 (tblsearch "style" "standard"))))

    0

    or short formula like this

    _$ (if (= (logand 0) 4)
    (princ "\nText is vertical!")
    (princ "\nText is NOT Vertical!"))

    Text is NOT Vertical!"\nText is NOT Vertical!"
     
    Adesu, Sep 30, 2004
    #7
  8. Rick Keller

    Jeff Mishler Guest

    The 4 comes from the help files under the DXF code listing for Style:
    Standard flag values (bit-coded values):
    1 = If set, this entry describes a shape
    4 = Vertical text
    16 = If set, table entry is externally dependent on an xref
    32 = If this bit and bit 16 are both set, the externally dependent xref
    has been successfully resolved
    64 = If set, the table entry was referenced by at least one entity in
    the drawing the last time the drawing was edited. (This flag is for the
    benefit of AutoCAD commands. It can be ignored by most programs that read
    DXF files and need not be set by programs that write DXF files)

    The logand is a logical bitwise AND, which means it will return 4 if the
    bitcode value of 4 is found in the integer provided.
    Here is a quick example of what (logand x 4) will return for x = 1 thru 10:
    $ (setq test '(1 2 3 4 5 6 7 8 9 10))
    (1 2 3 4 5 6 7 8 9 10)
    _$ (foreach x test (princ (strcat "\n" (itoa (logand x 4)))))

    If you would like to see an excellent article on bit codes, check out this
    thread:
    http://discussion.autodesk.com/thread.jspa?messageID=2006356
     
    Jeff Mishler, Sep 30, 2004
    #8
  9. Rick Keller

    Adesu Guest

    Huh ... logand become headache my head,I believe next time I would and must
    to understand about logand,thanks a lot Jeff for your help.
     
    Adesu, Sep 30, 2004
    #9
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.