I want space

Discussion in 'AutoCAD' started by Adesu, Feb 23, 2005.

  1. Adesu

    Adesu Guest

    I've create a program,but in "tex (getstring T "\nENTER NEW TEXT: "))", if
    user hit a space bar for create a space between string character,it can't
    work,the fact this program evaluated next step.
    How to create added space on string,because character "T" can't help it.

    ; cmt is stand for create for multiple text
    ; Design by Ade Suharna <>
    ; 23 february 2005
    ; Program no.202/02/2005
    ; Edit by
    (defun c:cmt (/ cnt num loc ht spa lo tex)
    (setq cnt 0
    num (fix (getreal "\nHOW MANY ROW WOULD YOU CREATE: "))
    loc (getpoint "\nCLICK LOCATION FOR OBJECT: ")
    ht (getreal "\nENTER NEW HEIGHT TEXT: ")
    spa (getdist "\nENTER GAP BETWEEN A TEXT: "))
    (repeat num
    (setq lo (list (car loc)(- (cadr loc) (* cnt spa))(caddr loc))
    tex (getstring T "\nENTER NEW TEXT: "))
    (entmake
    (list
    '(0 . "TEXT")
    '(8 . "0") ; layer name
    (cons 10 lo) ; text location
    (cons 40 ht) ; text height
    (cons 1 tex) ; name of text
    '(50 . 0.0) ; text rotation
    '(41 . 1.0) ; with factor
    '(51 . 0.0) ; oblique angle
    '(7 . "Standard") ; text style name
    '(71 . 0) ; 2 = backward,4 = upside down
    '(72 . 0) ; horizontal justification
    '(73 . 0))) ; vertical justification
    (setq cnt (1+ cnt))
    (princ "\n")(princ tex)
    )
    )
     
    Adesu, Feb 23, 2005
    #1
  2. Adesu

    dean_bourke Guest

    Worked fine on ACAD2002/win2000

    Dean
     
    dean_bourke, Feb 23, 2005
    #2
  3. Adesu

    Adesu Guest

    I've tested again,it ok,thanks
     
    Adesu, Feb 23, 2005
    #3
  4. Adesu

    Alaspher Guest

    Hi, Ade!
    Why you limit repeating on start? My be better like this:
    Code:
    	(defun c:cmt (/ ht lay loc spa style tex x y z)
    (setq loc   (getpoint "\nCLICK LOCATION FOR OBJECT: ")
    x     (car loc)
    y     (cadr loc)
    z     (caddr loc)
    ht    (getdist "\nENTER NEW HEIGHT TEXT: ")
    spa   (getdist "\nENTER GAP BETWEEN A TEXT: ")
    lay   (getvar "clayer")
    style (getvar "textstyle")
    )
    (while (/= "" (setq tex (getstring t "\nENTER NEW TEXT: ")))
    (entmake (list '(0 . "TEXT")
    (cons 8 lay)         ; layer name
    (list 10 x y z)      ; text location
    (cons 40 ht)         ; text height
    (cons 1 tex)         ; name of text
    '(50 . 0.0)          ; text rotation
    '(41 . 1.0)          ; with factor
    '(51 . 0.0)          ; oblique angle
    (cons 7 style)       ; text style name
    '(71 . 0)            ; 2 = backward,4 = upside down
    '(72 . 0)            ; horizontal justification
    '(73 . 0)            ; vertical justification
    )
    )
    (setq y (- y spa))
    (princ "\n")
    (princ tex)
    )
    )
    Best regards!
     
    Alaspher, Feb 23, 2005
    #4
  5. Adesu

    Adesu Guest

    Hi Alaspher,thanks for your alternative correction,it's good for me
     
    Adesu, Feb 25, 2005
    #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.