Jump to content

Need help to resolve basic lisp error


AbdRF

Recommended Posts

Hi all,

I am learning lisp programming.Here is the code which I am a trying to run 
 

(defun c:tex (/ p1 a b c d e f)
(setq pl (getpoint "\nStarting point: "))
(setq a (getdist p1 "\nEnter height: "))
(setq c (getdist p1 "\nline spacing: "))
(setq d "T")
(while d
  (setq e (getstring 1 "Text: "))
  (command "text" pl a "0" e)
  (setq pl (list (car p1)(- (cadr p1) c)))
  (setq f (getstring))
  (if (= f "*")(setq d nil))
)
(princ)
)



I am getting the below error.Can somebody explain me  ?

Quote

Starting point: ; error: bad argument type: point: nil


 

Link to comment
Share on other sites

You may want to look into (initget) call prior to (get.... ) calls.  -David

(defun c:foo (/ p1 a c)
  (initget 1)
  (setq p1 (getpoint "\nStarting Point:   "))

  (initget 6)
  (setq a (getdist p1 (strcat "\nTEXT Height <"
                        (rtos (getvar "TEXTSIZE") 2 2)
                        ">:   ")))
  (or a (setq a (getvar "TEXTSIZE")))
  (setvar "TEXTSIZE" a)

  (initget 7)
  (setq c (getdist p1 "\nLine Spacing":   ")))



 ...)

 

Link to comment
Share on other sites

My $0.05 using  a library routine. If ran again both variables can be set to update. 

 

image.png.757bf0cd76cd4cc2fef4c7793c409fd9.png

 


(if (not AH:getvalsm)(load "Multi Getvals.lsp"))
(setq ans (AH:getvalsm (list "Enter values" "Text height" 5 4 (rtos (getvar "textsize"))  "Line spacing " 5 4 "1" )))

Edited by BIGAL
Link to comment
Share on other sites

On 8/5/2019 at 12:53 PM, Roy_043 said:

You have a variable pl (PL) and a variable p1 (P one).

Oh that was so silly on my part.
Thanks 

Link to comment
Share on other sites

On 8/5/2019 at 3:35 PM, David Bethel said:

You may want to look into (initget) call prior to (get.... ) calls.  -David


(defun c:foo (/ p1 a c)
  (initget 1)
  (setq p1 (getpoint "\nStarting Point:   "))

  (initget 6)
  (setq a (getdist p1 (strcat "\nTEXT Height <"
                        (rtos (getvar "TEXTSIZE") 2 2)
                        ">:   ")))
  (or a (setq a (getvar "TEXTSIZE")))
  (setvar "TEXTSIZE" a)

  (initget 7)
  (setq c (getdist p1 "\nLine Spacing":   ")))



 ...)

 

Sure David,will try this out .
Cheers
 

Edited by AbdRF
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...