Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

My programs keep breaking "laycur"???

0 views
Skip to first unread message

Jamie Richardson

unread,
Jul 15, 2003, 10:18:54 AM7/15/03
to
I have several programs that I have created that draw structural shapes.
It will put the shapes on the correct layers. After running the program
"laycur" (change to current layer) becomes broke, giving me the message:

"laycur ; error: no function definition: TYPE"

Any ideas what might cause this. I would like to have some clue on what
to look for in my programs so I can fix them.

thanks,
jamie

--
+-+-+-+-+-+-+-+-+
Jamie Richardson
CAD Coordinator
+-+-+-+-+-+-+-+-+


Josh

unread,
Jul 15, 2003, 10:29:32 AM7/15/03
to
TYPE is a lisp function. You've used it as a variable name in your code and
redefined it. You need to rename those variables.

Josh


"Jamie Richardson" <jrich...@ns.ericksenroed.com> wrote in message
news:3F140D4E...@ns.ericksenroed.com...

Jason Piercey

unread,
Jul 15, 2003, 10:22:56 AM7/15/03
to
Command: !type
#<SUBR @021a749c TYPE>

Command: (setq type nil)
nil

Command: (type)


; error: no function definition: TYPE

Give you any clues?

--

-Jason
Member of the Autodesk Discussion Forum Moderator Program


"Jamie Richardson" <jrich...@ns.ericksenroed.com> wrote in message
news:3F140D4E...@ns.ericksenroed.com...

Jamie Richardson

unread,
Jul 15, 2003, 10:44:05 AM7/15/03
to
Thank you both vary much.

TYPE it was.

jamie
--
+-+-+-+-+-+-+-+-+
Jamie Richardson
CAD Coordinator
+-+-+-+-+-+-+-+-+

Tom Smith

unread,
Jul 15, 2003, 10:49:32 AM7/15/03
to
Actually you can get away with redefining a "reserved" symbol name, as long
as you declare it local to your function ...

Command: (defun c:typetest (/ type) (setq type nil))
C:TYPETEST

Command: !type
#<SUBR @02dd749c TYPE>

Command: typetest
nil

Command: !type
#<SUBR @02dd749c TYPE>

The typetest function sets type nil, but since it uses type as a local
vatiable, it doesn't mess with the normal (type) function. Not that you
should do this.

You should not only change the "type" variable name, but should also delare
ALL your variables local to the function that uses them. Otherwise all your
programs will continue stomping on each other.

Jamie Richardson <jrich...@ns.ericksenroed.com> wrote in message
news:3F140D4E...@ns.ericksenroed.com...

Randy Richardson

unread,
Jul 15, 2003, 2:07:46 PM7/15/03
to
True enough, but some day you might want to make a minor change to your code
that would involve using that AutoLISP function within your function. Seems
like that may have happened to me once or twice. Nah--couldn't be.

-Randy Richardson

"Tom Smith" <tsm...@dongardner.com> wrote in message
news:434D040AE0731BBF...@in.WebX.maYIadrTaRb...

Martin Schmid

unread,
Jul 23, 2003, 4:03:45 PM7/23/03
to
You don't need to rename... just make sure they're defined as local
variables:

(defun c:asdfsadf ( / asdfsadf)
(setq asdfsadf nil)
)

I can run asdfsadf all day w/ no errors


"Josh" <jos...@hotmail.com> wrote in message
news:608289CF54D5B031...@in.WebX.maYIadrTaRb...

Josh

unread,
Jul 23, 2003, 5:08:17 PM7/23/03
to
It's better form to not use function names as symbol names in the first
place.

With your example what happens when...
(defun asdfasdf (type)
(type type)
)
?

"Martin Schmid" <martin...@sbcglobal.net.nospam> wrote in message
news:B1C1A33AA224F5FE...@in.WebX.maYIadrTaRb...

Martin Schmid

unread,
Jul 24, 2003, 7:41:21 AM7/24/03
to
I agree... function names as symbol names should be avoided... my point was
that standard programming practice dictates that variables are defined with
as limitied scope as possible to avoid naming collisions.

MS

"Josh" <jos...@hotmail.com> wrote in message

news:AA9C412F85D7B4AA...@in.WebX.maYIadrTaRb...

0 new messages