Jump to content

How to pass Entity name to defun


Recommended Posts

Posted (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 by SLW210
Added Code Tags!!
Posted

Please use Code Tags for your Code not Quote Tags. (<> in the editor toolbar)

Posted

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)

 

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...