Lisp Arguments keeps popping up error

Lisp Arguments keeps popping up error

thomas_huntFMPXR
Contributor Contributor
284 Views
5 Replies
Message 1 of 6

Lisp Arguments keeps popping up error

thomas_huntFMPXR
Contributor
Contributor

bad argument type: numberp: "PV-TEXT-NOTE"

 

the Set up code below:

(defun c:ldr (/)

;set variables
(setq LL (getvar "clayer") ML (getvar "cmleaderstyle"))
 
;Localize variables
(/ LL CC color ML h a v c pt)

(command "mspace")
(setq h (/ (getvar 'viewsize) 2/0))
         a (apply '/ (getvar 'screensize))
         v (list (* h a) h)
         c (trans (getvar 'viewctr) 1/0)
   (setq pt1 (mapcar '- c v) pt2 (mapcar '+ c v))
(command "mspace")

;setup
(setvar "clayer" "PV-TEXT-NOTE" "0.375")
(command "cecolor" "ByLayer")
(setvar "cmleaderstyle")
(setvar "ARIEL ANNOTATIVE" "1/8")

;equipment pad 1
(setq pt (getpoint "\nEQUIPMENTPAD1"))
(command "mleader" pt pause "nEQUIPMENTPAD1")

;equipment pad 1
(setq pt (getpoint "\nEQUIPMENTPAD2"))
(command "mleader" pt pause "\nEQUIPMENTPAD2")

;(e)structure
(setq pt (getpoint "\nSTRUCTURE"))
(command "mleader" pt pause "(E) \nSTRUCTURE")

;street
(setq pt (getpoint "\nSTREET1"))
(command "text" "style" "PV-TEXT-NOTE" pt "0.375" pause "Street1")
       
;street 2
(setq pt (getpoint "\nSTREET2"))
(command "text" "style" "PV-TEXT-NOTE" pt "0.375" pause "Street2")
       
;utility recloser pole
(setq pt (getpoint "\nUTILITY RECLOSER POLE"))
(command "mleader" pt pause "(N) n\UTILITY RECLOSER POLE")

;customer own goab
(setq pt (getpoint "\nCUSTOMER CUSTOMER GOAB"))
(command "mleader" pt pause "(N) n\CUSTOMER CUSTOMER GOAB")
         
;primary utility metering
(setq pt (getpoint "\nPRIMARY UTILITY METERING"))
(command "mleader" pt pause "(E) n\PRIMARY UTILITY METERING")

;property line  
(setq pt (getpoint "\nPROPERTY LINE"))
(command "mleader" pt pause " n\PROPERTY LINE")
         
;site fence, type  
(setq pt (getpoint "\nSITE FENCE, TYP"))
(command "mleader" pt pause " n\SITE FENCE, TYP")  
 
;20' gravel access road  
(setq pt (getpoint "\n20' GRAVEL ACCESS ROAD"))
(command "mleader" pt pause " n\20' GRAVEL ACCESS ROAD")

;site access gate  
(setq pt (getpoint "\nSITE ACCESS GATE"))
(command "mleader" pt pause " n\SITE ACCESS GATE")
 
;mv trenching, typ  
(setq pt (getpoint "\nMV TRENCHING, TYP"))
(command "mleader" pt pause " n\MV TRENCHING, TYP")
 
;tracker motor, typ  
(setq pt (getpoint "\nTRACKER MOTOR, TYP"))
(command "mleader" pt pause " n\TRACKER MOTOR, TYP")
 
;site meter location  
(setq pt (getpoint "\nSITE METER LOCATION"))
(command "mleader" pt pause " n\SITE METER LOCATION")
         
;restore settings
(command "dimstyle" "restore")
(setvar "cmleaderstyle" ML)
(setvar "clayer" LL)
(command "cecolor" color)

)
0 Likes
Accepted solutions (1)
285 Views
5 Replies
Replies (5)
Message 2 of 6

CodeDing
Advisor
Advisor

@thomas_huntFMPXR ,

 

You are not localizing variables, you are performing division and passing a string where a number should be. Update beginning of your code to this:

 

(defun c:ldr ( / LL CC color ML h a v c pt1 pt2)

  ;set variables
  (setq LL (getvar "clayer") ML (getvar "cmleaderstyle"))

  (command "mspace")
  (setq h (/ (getvar 'viewsize) 2)
        a (apply '/ (getvar 'screensize))
        v (list (* h a) h)
        c (trans (getvar 'viewctr) 1 0)
  );setq
  (setq pt1 (mapcar '- c v) pt2 (mapcar '+ c v))

 

I did not read your entire code, so if you have more errors, please troubleshoot.

 

Best,

~DD

0 Likes
Message 3 of 6

Kent1Cooper
Consultant
Consultant

[Actually, you are at least attempting to localize variables, but not in the right place.]

I imagine some mathematical function is perhaps missing an input and/or a closing parenthesis, and the next thing that gets fed into it is that Layer/Style name, when it wants a number.  I haven't searched for where that kind of thing might be happening.

Beyond that, there are several errors.  In some places you have strings beginning with a newline in the form "\nWhatever...", but in some places the backslash is missing, and in others it follows the n.

(setvar "cmleaderstyle") needs at least one more argument.

"ARIEL ANNOTATIVE" is not a system variable, so you can't use it as the first argument in a (setvar) function.

There may be others.

Kent Cooper, AIA
0 Likes
Message 4 of 6

komondormrex
Mentor
Mentor

that one won't work ever. "0.375" is obviously redundant. 

(setvar "clayer" "PV-TEXT-NOTE" "0.375")

 

0 Likes
Message 5 of 6

thomas_huntFMPXR
Contributor
Contributor

the above suggestions create a syntax error

0 Likes
Message 6 of 6

Kent1Cooper
Consultant
Consultant
Accepted solution

@thomas_huntFMPXR wrote:

the above suggestions create a syntax error


Do you mean @CodeDing's suggestion in Message 2?  I suspect it may have gotten you past your original error, and something later [not part of their suggestion] is causing the syntax error.  One cause of syntax errors is incorrect parentheses, so as a start, check carefully for that.

Kent Cooper, AIA
0 Likes