Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

why does not work? form.lsp

6 REPLIES 6
Reply
Message 1 of 7
nychoe1
371 Views, 6 Replies

why does not work? form.lsp

why does not work like do this~

(setq P2 (getpoint p1 (strcat "@" (rtos xx 2 0) "<0") ""))

 

I want to know,

please just edit...

 

;======================================================

(defun c:form ( )
  (setq dsc (getvar "dimscale"))
  (setq xx (* 10 dsc))
  (if (= SPC nil)(setq SPC 9))
 
  (setq P1 (getpoint "\nstart point : "))
  ;(setq P2 (getpoint P1 "\nent point : ")
  (setq P2 (getpoint p1 (strcat "@" (rtos xx 2 0) "<0") ""))
 
 (setq ROW (getint "\nrow : "))
        (setq COLM (getint "\ncolumn : "))
        (setq DST (distance P1 P2))
        (setq DST1 (/ DST COLM))
        (setq COLMM (+ COLM 1))
        (setq ROWW (+ ROW 1))
        (setq PP1 P1)
        (setq PP2 P2)
 
  (setq SPCC (getreal (strcat "\nheight :<"(rtos SPC)"> : ")))
  (if (numberp SPCC)(setq SPC SPCC))
  (setq SPC1 (* _SC SPC))

  (repeat ROWW
    (command "line" P1 P2 "")
    (setq P1 (polar P1 (dtr 90) SPC1)
          P2 (polar P2 (dtr 90) SPC1)
    )
  )
 
  (command "line" PP1 (polar PP1 (dtr 90) (* ROW SPC1)) "")
  (command "line" PP2 (polar PP2 (dtr 90) (* ROW SPC1)) "")
 
  (repeat (- COLM 1)
    (setq PP1 (polar PP1 (dtr 0) DST1))
    (command "line" PP1 (polar PP1 (dtr 90) (* ROW SPC1)) "")
 
  )
  (princ)
)

6 REPLIES 6
Message 2 of 7
hgasty1001
in reply to: nychoe1

Hi,

 

You have an extra "" as an argument to the setq, mey be this:  (setq p2 (getpoint p1 (strcat "@" (rtos xx 2 0) "<0")))

 

Gaston Nunez

Message 3 of 7
p_mcknight
in reply to: nychoe1

I could be wrong about my interpretation but, are you trying to get the getpoint to return a point programatically without user input.  If so, then that is the wrong use of getpoint.  Getpoint is for user input.  If you want a programmatically retuned point then use a different function like

(polar p1 0 xx) or

(list (+ xx (car p1)) (cadr p1) (caddr p1))

Message 4 of 7
vivifira
in reply to: p_mcknight

I see what p_mcknight is saying. In which case couldn't you just leave the getpoint function out and receive the results of just the equation?.....scratch that..... I just tried it and it didn't work..... sorry.

 

Message 5 of 7
Kent1Cooper
in reply to: nychoe1


@nychoe1 wrote:

why does not work like do this~

(setq P2 (getpoint p1 (strcat "@" (rtos xx 2 0) "<0") ""))

....


Try:

 

(setq p2 (polar p1 0 xx))

Kent Cooper, AIA
Message 6 of 7
nychoe1
in reply to: p_mcknight

thank you so much.

(polar p1 0 xx) is ok !!!
Message 7 of 7
nychoe1
in reply to: Kent1Cooper

thank you~~ so much

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost