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

Loading LISP (VLX) from the web

14 REPLIES 14
Reply
Message 1 of 15
Anonymous
1826 Views, 14 Replies

Loading LISP (VLX) from the web

Does anyone have any info on how to perform a load to a compiled VLX file that exists on a website? Does it need to be downloaded locally, or can AutoCAD load it up direct? Bruce
14 REPLIES 14
Message 2 of 15
Anonymous
in reply to: Anonymous

\\\\path\\file "Bruce Sheldon" wrote in message news:4076c6b4$1_3@newsprd01... > Does anyone have any info on how to perform a load to a compiled VLX file > that exists on a website? Does it need to be downloaded locally, or can > AutoCAD load it up direct? > > Bruce > >
Message 3 of 15
Anonymous
in reply to: Anonymous

Yes, I believe it has to be downloaded, but this might give you some ideas how to automate that... (and (vl-load-com) (setq *acad* (vlax-get-acad-object)) (setq *doc* (vla-get-activedocument *acad*)) (setq *util* (vla-get-utility *doc*)) (not (vla-getremotefile *util* "http://www.cadlantic.com/freebies/digital.lsp" 'file actrue)) (= (type file) 'STR) (or (load file) 1) digicount (digicount) ) -- John Uhden, Cadlantic http://www.cadlantic.com Sea Girt, NJ "Bruce Sheldon" wrote in message news:4076c6b4$1_3@newsprd01... > Does anyone have any info on how to perform a load to a compiled VLX file > that exists on a website? Does it need to be downloaded locally, or can > AutoCAD load it up direct? > > Bruce > >
Message 4 of 15
Anonymous
in reply to: Anonymous

Thanks, John. I'll give this a try. "John Uhden" wrote in message news:4077587a$1_2@newsprd01... > Yes, I believe it has to be downloaded, but this might give you some ideas how > to automate that... > > (and > (vl-load-com) > (setq *acad* (vlax-get-acad-object)) > (setq *doc* (vla-get-activedocument *acad*)) > (setq *util* (vla-get-utility *doc*)) > (not (vla-getremotefile *util* "http://www.cadlantic.com/freebies/digital.lsp" > 'file actrue)) > (= (type file) 'STR) > (or (load file) 1) > digicount > (digicount) > ) > > -- > John Uhden, Cadlantic > > http://www.cadlantic.com > Sea Girt, NJ > > "Bruce Sheldon" wrote in message > news:4076c6b4$1_3@newsprd01... > > Does anyone have any info on how to perform a load to a compiled VLX file > > that exists on a website? Does it need to be downloaded locally, or can > > AutoCAD load it up direct? > > > > Bruce > > > > >
Message 5 of 15
3DToolBox
in reply to: Anonymous

I can not get this to work in 2007. Is this a bug in 2007 or am I just going crazy.

here is what I have so far
--------------------------------Keep it simple for now-----------

(setq remotefile "http://www.cadlantic.com/freebies/Digital.lsp")
(setq *acad* (vlax-get-acad-object))
(setq *doc* (vla-get-activedocument *acad*))
(setq *util* (vla-get-utility *doc*))
(vla-getremotefile (list *util* remotefile 'tempfile :vlax-true))

Thanks to anyone helping.
3DToolbox
Message 6 of 15
Anonymous
in reply to: Anonymous

3DToolBox wrote:
> I can not get this to work in 2007. Is this a bug in 2007 or am I just going crazy.
>
> here is what I have so far
> --------------------------------Keep it simple for now-----------
>
> (setq remotefile "http://www.cadlantic.com/freebies/Digital.lsp")
> (setq *acad* (vlax-get-acad-object))
> (setq *doc* (vla-get-activedocument *acad*))
> (setq *util* (vla-get-utility *doc*))
> (vla-getremotefile (list *util* remotefile 'tempfile :vlax-true))
>
> Thanks to anyone helping.
> 3DToolbox

The documentation says:

object.GetRemoteFile URL, LocalFile, IgnoreCache

So, using this as a vla- function this should have 4 parameters, not one
list as you are using.
How about

(vla-getremotefile *util* remotefile 'tempfile :vlax-true)

?

--
Message 7 of 15
3DToolBox
in reply to: Anonymous

Thank you for the response.

I have tried it that way, and it just returns nil.

Looking deeper into this, it does actually download the file from the web address, and places it in Temporary Internet Files, so I think the problem is in the LocalFile call of the function (with a variable called tempfile), so I have tried to tell it the local file to create, but still no go. Here is that so far:-----

(setq remotefile "http://www.cadlantic.com/freebies/Digital.lsp")
(setq tempfile (list "c:\Digital.lsp")) ;;<< I have also tried the next line
;; (setq temptile "c:\Digital.lsp")
(setq *acad* (vlax-get-acad-object))
(setq *doc* (vla-get-activedocument *acad*))
(setq *util* (vla-get-utility *doc*))
(setq testing (vla-getremotefile *util* remotefile tempfile :vlax-true))

Thanks for any help,
3DToolbox
Message 8 of 15
Anonymous
in reply to: Anonymous

3DToolBox wrote:



> (setq tempfile "c:\Digital.lsp")


What happens if you use two backslashes instead of one?
Message 9 of 15
3DToolBox
in reply to: Anonymous

Thanks for the response.

I just tried with two backslashes
(setq tempfile "c:\\Digital.lsp")
with no luck.

I thought maybe we could copy the file from Temporary Internet Files, to somewhere, but -no way-no how- can we get that to happen. I tried to copy it from dos, and I can't even locate it in dos. Windows must have some special links into Temporary Internet Files so that AutoCAD and dos can not see the files.

Any help would be awesome.
Thank you,
3DToolbox
Message 10 of 15
Anonymous
in reply to: Anonymous

3DToolBox wrote:
> Thank you for the response.
>
> I have tried it that way, and it just returns nil.
>
> Looking deeper into this, it does actually download the file from the web address, and places it in Temporary Internet Files, so I think the problem is in the LocalFile call of the function (with a variable called tempfile), so I have tried to tell it the local file to create, but still no go. Here is that so far:-----
>
> (setq remotefile "http://www.cadlantic.com/freebies/Digital.lsp")
> (setq tempfile (list "c:\Digital.lsp")) ;;<< I have also tried the next line
> ;; (setq temptile "c:\Digital.lsp")
> (setq *acad* (vlax-get-acad-object))
> (setq *doc* (vla-get-activedocument *acad*))
> (setq *util* (vla-get-utility *doc*))
> (setq testing (vla-getremotefile *util* remotefile tempfile :vlax-true))
>
> Thanks for any help,
> 3DToolbox

The trouble here is that you have to remember that the underlying
program (or at least its interface) is written by a Visual Basic
programmer, so it uses non-lispy style for handling its parameters. The
method doesn't return the result as its value, it just writes the file
to disk and assigns the path to that file to the variable you gave as
tempfile (quote required, don't omit it: you are telling the method its
name, not its value!).

So, the usage would be something like:


(setq remotefile "http://www.cadlantic.com/freebies/Digital.lsp")
(setq *acad* (vlax-get-acad-object))
(setq *doc* (vla-get-activedocument *acad*))
(setq *util* (vla-get-utility *doc*))
(vla-getremotefile *util* remotefile 'tempfile :vlax-true)

(setq f (open tempfile "r"))
(setq first-line (read-line f))
and then do something with the opened file...


- As an aside, when using backslashes in Lisp strings, you have to
double them: "C:\\somefile", as a single backslash is an escape character.
Alternately, both AutoCAD and Windows can also handle unix-style paths:
"C:/somefile".

Quite another question is that loading executable code from the Internet
is not the safest of hobbies. Even if it has no malicious intent or
transfer errors, it may be doing things in some way incompatible with
your system, so you have to check it anyway; at that stage you can
install it from your local copy.

--
Message 11 of 15
3DToolBox
in reply to: Anonymous

Thank you for your response.

I still can not get it to work. With the following code.

(setq remotefile "http://www.cadlantic.com/freebies/Digital.lsp")
(setq *acad* (vlax-get-acad-object))
(setq *doc* (vla-get-activedocument *acad*))
(setq *util* (vla-get-utility *doc*))
(vla-getremotefile *util* remotefile 'tempfile :vlax-true)

(setq f (open tempfile "r"))
(setq first-line (read-line f))
----------------------------------------------------
When I inspect tempfile it is "'"
I believe that it is downloading it fine, and then when windows tries to tell AutoCAD where it was downloaded to, windows is unable to tell it Temporary Internet Files. As a side note, has AutoCAD disabled this because programmers could download and install malicious code through this??? Or maybe this is a bug in 2007???
Message 12 of 15
Anonymous
in reply to: Anonymous

(setq remotefile "http://www.cadlantic.com/freebies/Digital.lsp")
(setq *acad* (vlax-get-acad-object))
(setq *doc* (vla-get-activedocument *acad*))
(setq *util* (vla-get-utility *doc*))
(vla-getremotefile *util* remotefile 'tempfile :vlax-true)

(setq f (open tempfile "r"))
(setq first-line (read-line f))
(princ first-line)
(princ)

Prints

Command: 'VLIDE C:\Documents and Settings\Allen\Local Settings\Temporary
Internet Files\Content.IE5\3ZKS5JG4\Digital[1].lsp
;; Digital.LSP (01-07-2002), John F. Uhden, Cadlantic


in my text window....
Message 13 of 15
3DToolBox
in reply to: Anonymous

Must be a bug in 2007 --
I am attaching a screenshot so you don't think I am totally ignorant.
Message 14 of 15
Anonymous
in reply to: Anonymous

3DToolBox wrote:
> Thank you for your response.
>
> I still can not get it to work. With the following code.
>
> (setq remotefile "http://www.cadlantic.com/freebies/Digital.lsp")
> (setq *acad* (vlax-get-acad-object))
> (setq *doc* (vla-get-activedocument *acad*))
> (setq *util* (vla-get-utility *doc*))
> (vla-getremotefile *util* remotefile 'tempfile :vlax-true)
>
> (setq f (open tempfile "r"))
> (setq first-line (read-line f))
> ----------------------------------------------------
> When I inspect tempfile it is "'"
> I believe that it is downloading it fine, and then when windows tries to tell AutoCAD where it was downloaded to, windows is unable to tell it Temporary Internet Files. As a side note, has AutoCAD disabled this because programmers could download and install malicious code through this??? Or maybe this is a bug in 2007???

Sorry about misleading you: I have been running this on 2006 Mechanical,
where it works. On further investigation, this works on 2002, 2005, 2006
and 2008 but NOT on 2007. (All Mechanical variants on my machine.)

On 2007 I get an empty string for tempfile, and am equally baffled about
what to do. You could try a bug report to Autodesk, though probably
they'll just tell you to upgrade.

--
Message 15 of 15
3DToolBox
in reply to: Anonymous

Thanks for the help.

I will have to go back to the drawing board, and maybe figure a different way to attack this one.

Thanks,
3DToolBox

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

Post to forums  

Autodesk Design & Make Report

”Boost