Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

"open" command in LISP

4 REPLIES 4
Reply
Message 1 of 5
Gderegter
1261 Views, 4 Replies

"open" command in LISP

Why does the rule (command "open" "existingfilepathname") entered at the command line not work in AutoCAD 2002? It returns "Unknown command" What's wrong here? It worked allright in R14...
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Gderegter

Things changed in AutoCAD 2000, when MDI mode was introduced. The
following should work:

(defun cmdOpen (name)
(vl-load-com)
(if (= 0 (getvar "SDI"))
(vla-activate
(vla-open
(vla-get-documents (vlax-get-acad-object)) name))
(vla-sendcommand
(vla-get-activedocument
(vlax-get-acad-object))
(strcat "(command \"_.OPEN\")\n" name "\n"))
)
)

(Posted many moons ago by Frank Whaley).

jrf
Member of the Autodesk Discussion Forum Moderator Program
Please do not email questions unless you wish to hire my services

In article , Gderegter wrote:
> Why does the rule (command "open" "existingfilepathname") entered at
> the command line not work in AutoCAD 2002? It returns "Unknown
> command" What's wrong here? It worked allright in R14...
>
Message 3 of 5
Anonymous
in reply to: Gderegter

It was recently pointed out to me that Frank's code is still running in the
original document in MDI mode. Which may, or may not, be desired. An
alternative that does _not_ leave the code running is this function:

(defun OpenDwg (fqnName)
(command "._VBAStmt"
(strcat "AcadApplication.Documents.Open \"" fqnName "\"")))


--
R. Robert Bell, MCSE
www.AcadX.com


"Jon Fleming" wrote in message
news:VA.00001274.03b31acd@fleming-group.com...
| Things changed in AutoCAD 2000, when MDI mode was introduced. The
| following should work:
|
| (defun cmdOpen (name)
| (vl-load-com)
| (if (= 0 (getvar "SDI"))
| (vla-activate
| (vla-open
| (vla-get-documents (vlax-get-acad-object)) name))
| (vla-sendcommand
| (vla-get-activedocument
| (vlax-get-acad-object))
| (strcat "(command \"_.OPEN\")\n" name "\n"))
| )
| )
|
| (Posted many moons ago by Frank Whaley).
|
| jrf
| Member of the Autodesk Discussion Forum Moderator Program
| Please do not email questions unless you wish to hire my services
|
| In article , Gderegter wrote:
| > Why does the rule (command "open" "existingfilepathname") entered at
| > the command line not work in AutoCAD 2002? It returns "Unknown
| > command" What's wrong here? It worked allright in R14...
| >
|
|
Message 4 of 5
Anonymous
in reply to: Gderegter

Hum? You totally lost me there. In what sense does Frank's code continue to
run after executing?

jrf
Member of the Autodesk Discussion Forum Moderator Program
Please do not email questions unless you wish to hire my services

In article , R. Robert
Bell wrote:
> It was recently pointed out to me that Frank's code is still running in the
> original document in MDI mode. Which may, or may not, be desired. An
> alternative that does _not_ leave the code running is this function:
>
> (defun OpenDwg (fqnName)
> (command "._VBAStmt"
> (strcat "AcadApplication.Documents.Open \"" fqnName "\"")))
>
>
> --
> R. Robert Bell, MCSE
> www.AcadX.com
Message 5 of 5
Anonymous
in reply to: Gderegter

Put a time stamp check at the end of his code. Use the function, wait a bit,
then switch back to the original doc. Notice the long delay. That original
doc was *not* quiescent.

--
R. Robert Bell, MCSE
www.AcadX.com


"Jon Fleming" wrote in message
news:VA.00001276.027025dc@fleming-group.com...
| Hum? You totally lost me there. In what sense does Frank's code continue
to
| run after executing?
|
| jrf
| Member of the Autodesk Discussion Forum Moderator Program
| Please do not email questions unless you wish to hire my services
|
| In article , R.
Robert
| Bell wrote:
| > It was recently pointed out to me that Frank's code is still running in
the
| > original document in MDI mode. Which may, or may not, be desired. An
| > alternative that does _not_ leave the code running is this function:
| >
| > (defun OpenDwg (fqnName)
| > (command "._VBAStmt"
| > (strcat "AcadApplication.Documents.Open \"" fqnName "\"")))
| >
| >
| > --
| > R. Robert Bell, MCSE
| > www.AcadX.com
|
|

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost