Jump to content

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)

 

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

Posted

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

 

Posted

Thank you, again.

 

I Will put attention on It when i return to home.

Posted (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 by topogigio
  • Like 1

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