syntax for left aligned text

Discussion in 'AutoCAD' started by ajm, Aug 4, 2004.

  1. ajm

    ajm Guest

    What is the correct syntax for left aligned text.
    The code I have below doesn't appear to work.
    Any ideas ?

    (setq ss1 (ssget "X" '((0 . "TEXT")))) ;selects ALL text
    (setq cnt 0) ;set counter to 0
    (if ss1
    (repeat (sslength ss1) ;step through selection set
    (setq obj (vlax-ename->vla-object (ssname ss1 cnt)))
    ; (vlax-put obj 'acAlignmentLeft)
    ; (vlax-put obj 'Alignment "Left") ;Change all text to left justified
    (setq cnt (1+ cnt))
    )
    )
    (setq ss1 nil)

    T.I.A.
    Andrew McDonald
     
    ajm, Aug 4, 2004
    #1
  2. Andrew,

    you are almost there

    replace (vlax-put obj 'Alignment "Left") with (vlax-put obj 'Alignment acAlignmentLeft)

    The property of the text is Alignment - one of the possible enumerated values for this property is acAlignmentLeft (= 0).

    Peter
     
    petersciganek, Aug 4, 2004
    #2
  3. ajm

    Jürg Menzi Guest

    Another possibility:

    (vla-put-Alignment Obj acAlignmentLeft)

    Cheers...;-)
     
    Jürg Menzi, Aug 4, 2004
    #3
  4. ajm

    Fatty Guest

    ;;; may be this helps you:
    (defun C:LEFT_ALIGN ( / cnt obj ss1)
    (vl-load-com)
    ;;; and another ent's too:
    ;;;(setq ss1 (ssget (list (cons 0 "TEXT,MTEXT,ATTDEF")))
    (setq ss1 (ssget "X" '((0 . "TEXT")))
    cnt 0
    )
    (if ss1
    (repeat (sslength ss1)
    (setq obj (vlax-ename->vla-object (ssname ss1 cnt))
    cnt (1+ cnt)
    )
    (vlax-put-property obj 'Alignment 0)
    )
    )
    )
    (princ)
    (C:LEFT_ALIGN )

    ;;;check any VLA-objects with this function:
    (vlax-property-available-p obj prop [check-modify])
    ;;; Example:
    (vlax-property-available-p obj 'AcAlignment);result -> nil
    (vlax-property-available-p obj 'AcAlignmentLeft);result -> nil
    (vlax-property-available-p obj 'Alignment);result (yes!!!) -> T
     
    Fatty, Aug 4, 2004
    #4
  5. ajm

    Joe Burke Guest

    Fatty,

    I think the guessing game is what we want to avoid.

    ;; dump properties and methods
    (defun c:dump ( / obj )
    (if (setq obj (car (entsel "\nSelect object: ")))
    (progn
    (textscr)
    (vlax-dump-object (vlax-ename->vla-object obj) T)
    )
    (princ "\nObject not selected. ")
    )
    (princ)
    ) ;end

    I believe whatever properties are listed, which are not marked (RO), can be set with
    (vlax-put obj '<property> <value>).

    Joe Burke

    snip
     
    Joe Burke, Aug 4, 2004
    #5
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.