PDA

View Full Version : Problem using (command "Insert" fname ^C) in Autolisp routine



rharris51
2004-07-26, 11:45 PM
We are trying to make an old lisp routine for automatically redefining detail blocks work under AutoCAD 2005. The following instruction now fails and interrupts the routine when it executes but does not find a matching filename:

(command "insert" fname ^C)

It's a very simple command and it still works when it finds the file it is looking for - but now it crashes the whole routine when fname is not found in the path.

It exits the lisp routine after displaying the search path and the last line displayed is *Invalid*.

Is there a flag or switch that needs to be set to make this command work the ways it did under older versions? Any workarounds or quick solutions?

CAB2k
2004-07-27, 12:41 AM
Try this.

(if (findfile fname)
(command "insert" fname ^C)
(alert "\nFile not found")
)

stig.madsen
2004-07-27, 08:22 AM
Just an observation. The ^C thingie should be changed to nil (^C is seen as a symbol that just happens to be nil when the call is made but it has no real meaning)

matt.worland
2004-07-27, 01:45 PM
You can also try this.

(command "insert" fname \E)

jwanstaett
2004-07-28, 02:09 PM
(command "insert" fname)(command)

this work in 2002 the 2nd (command) send the esc to autocad

RobertB
2004-07-28, 06:04 PM
(command "insert" fname)(command)
this work in 2002 the 2nd (command) send the esc to autocad

That is the same as Stig's reply because (command nil) = (command) :razz:

Partha Ghosh
2004-09-03, 10:44 AM
You better include the folder (which contains the required file) in your "support file search path" and then run the programme.