topogigio Posted June 19 Posted June 19 (edited) Hello. I'm new here and i'm a basic hobbist programmer in autolisp. My problem Is this error: Error: wrong (bad) function: < Entity name: ....> This is my test code (simplified) , that would be modified to greater selection (ssget "_x" (list (0 . "*Polyline ) (8 . "1")) and a while loop that calls the function, where there are some if and while cycles ( a lisp that i created and works on a single Entity) (setq selezione (ssget ":s") (setq a (ssname selezione 0) (defun estraz_vertici (elem) (setq param ( entget elem)) (print param) ) (Estraz_vertici (a)) I read that entity name Is a pointer (i have no advaced knowledge in programming) and i don't know how to work with It in this case. Thank you in Advance Edited June 19 by SLW210 Added Code Tags!! Quote
SLW210 Posted June 19 Posted June 19 Please use Code Tags for your Code not Quote Tags. (<> in the editor toolbar) Quote
Steven P Posted June 19 Posted June 19 In LISP anything enclosed in () is a function (Estraz_vertici (a)) means pass the result of function 'a' to function 'Estraz_vertici' - outside brackets to be a variable I think you want (Estraz_vertici a) Quote
topogigio Posted June 23 Author Posted June 23 On 6/19/2025 at 11:24 PM, SLW210 said: Please use Code Tags for your Code not Quote Tags. (<> in the editor toolbar) Thank you. I Will do this next time. I didn't know that. On 6/19/2025 at 11:46 PM, Steven P said: In LISP anything enclosed in () is a function (Estraz_vertici (a)) means pass the result of function 'a' to function 'Estraz_vertici' - outside brackets to be a variable I think you want (Estraz_vertici a) Thank you I tryed and i have same error. Quote
Steven P Posted June 23 Posted June 23 Looking at this again, missed this first time around, your brackets need to be in pairs an opening ( and a closing ) Your first 2 lines, the setq lines. Something like this: (defun c:test ( / selezione a ) (setq selezione (ssget ":s")) (setq a (ssname selezione 0)) (defun estraz_vertici (elem / ) (setq param ( entget elem)) (print param) ) ; end defun (Estraz_vertici a) (princ) ) ; end function Quote
topogigio Posted June 24 Author Posted June 24 Thank you, again. I Will put attention on It when i return to home. Quote
topogigio Posted June 25 Author Posted June 25 (edited) Hello. On 6/19/2025 at 11:46 PM, Steven P said: In LISP anything enclosed in () is a function (Estraz_vertici (a)) means pass the result of function 'a' to function 'Estraz_vertici' - outside brackets to be a variable I think you want (Estraz_vertici a) @Steven P You are/was rigth and my Memory failed, saying that It gave me the same error. It's correct (Estraz_vertici a) And works in the while loop that i made. Also thank you for teaching how to pass a defun result to' another and i ask you how to give more same defun results to another one and different defuns sigle result to another One. Thank you again for tour patience and attention Edited June 25 by topogigio 1 Quote
Recommended Posts
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.