TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: QuestionEverything on November 29, 2016, 06:09:31 PM

Title: vl-unload-com
Post by: QuestionEverything on November 29, 2016, 06:09:31 PM
Hello everyone,
Is there a way to UNLOAD the visual lisp extensions?
The reverse of (vl-load-com).
Title: Re: vl-unload-com
Post by: MP on November 29, 2016, 06:17:18 PM
http://www.theswamp.org/index.php?topic=42807.msg533923#msg533923

(offered in jest)

Title: Re: vl-unload-com
Post by: QuestionEverything on November 29, 2016, 06:28:18 PM
Hi MP,
This looks nice, but wouldn't (_KillProcess) commit a suicide, since it uses the vl- functions by itself?  :lol:

Is there some standard command/function for doing this, or the only way would be to collect all the vl- functions and undefine them?
Title: Re: vl-unload-com
Post by: MP on November 29, 2016, 06:34:52 PM
Suicide was the suggestion -- and why it was offered "in jest" (http://www.dictionary.com/browse/jest). :)
Title: Re: vl-unload-com
Post by: MP on November 29, 2016, 06:36:55 PM
I suppose one could walk the atoms family and abuse (set to nil) all the vla-* atoms but euuuww.

If I may be so nosey -- why do you need to do this?
Title: Re: vl-unload-com
Post by: dgorsman on November 30, 2016, 10:10:26 AM
If I may be so nosey -- why do you need to do this?

+1
Title: Re: vl-unload-com
Post by: QuestionEverything on November 30, 2016, 11:25:30 AM
If I may be so nosey -- why do you need to do this?
It might sound stupid, but I wanted to replicate a situation to see how a code runs without ActiveX.
For example a co-worker is running a few routines on a MacOS and the only fix would be to substitute all the vl-*** functions with vanilla alternatives.  :uglystupid2:
To guarantee that everything is OK, the most practical way would be to run by yourself the same stuff on the same obstacles - meaning that unload/not load at all the activeX stuff.
Title: Re: vl-unload-com
Post by: gile on November 30, 2016, 11:37:21 AM
Hi,

Most vl-* functions work on MAC because they do not use ActiveX at all.
Only vla-*, vlax-* and vlr-* cannot work on MAC OS systems.
Remember the "new" (since 2012) getpropertyvalue (http://docs.autodesk.com/ACDMAC/2015/ENU/index.html?url=files/GUID-8E5913FC-09ED-4C70-AFB7-2431C062E899.htm,topicNumber=d30e362048) and setpropertyvalue (http://docs.autodesk.com/ACDMAC/2015/ENU/index.html?url=files/GUID-8F32FD8C-D81A-4DCA-B455-9D560CF17246.htm,topicNumber=d30e373984) functions can replace in many situations vla-get-* and vla-put-* (and are sometimes more powerfull).
Title: Re: vl-unload-com
Post by: Lee Mac on November 30, 2016, 01:30:16 PM
If I may be so nosey -- why do you need to do this?
It might sound stupid, but I wanted to replicate a situation to see how a code runs without ActiveX.

Simply refrain from evaluating (vl-load-com) in the first place...
Title: Re: vl-unload-com
Post by: QuestionEverything on November 30, 2016, 01:49:37 PM
Hi,

Most vl-* functions work on MAC because they do not use ActiveX at all.
Only vla-*, vlax-* and vlr-* cannot work on MAC OS systems.
Remember the "new" (since 2012) getpropertyvalue (http://docs.autodesk.com/ACDMAC/2015/ENU/index.html?url=files/GUID-8E5913FC-09ED-4C70-AFB7-2431C062E899.htm,topicNumber=d30e362048) and setpropertyvalue (http://docs.autodesk.com/ACDMAC/2015/ENU/index.html?url=files/GUID-8F32FD8C-D81A-4DCA-B455-9D560CF17246.htm,topicNumber=d30e373984) functions can replace in many situations vla-get-* and vla-put-* (and are sometimes more powerfull).
From this I understand that methods and reactors can not be used.
GetPropertyValue and SetPropertyValue will certainly ease the task, thanks!

If I may be so nosey -- why do you need to do this?
It might sound stupid, but I wanted to replicate a situation to see how a code runs without ActiveX.

Simply refrain from evaluating (vl-load-com) in the first place...
I mean thats the problem, my AutoCAD automatically loads acad.lsp, from where like 300 .lsp files, so I can't trace every lsp file that uses (vl-load-com).
Alternative question would be: is there an easy way to prevent this, without messing up my own settings?
Title: Re: vl-unload-com
Post by: Lee Mac on November 30, 2016, 01:53:07 PM
I mean thats the problem, my AutoCAD automatically loads acad.lsp, from where like 300 .lsp files, so I can't trace every lsp file that uses (vl-load-com).
Alternative question would be: is there an easy way to prevent this, without messing up my own settings?

Temporarily rename the acad.lsp/acaddoc.lsp files.
Title: Re: vl-unload-com
Post by: MP on November 30, 2016, 02:01:58 PM
Don't try this at home kids.

Code: [Select]
(defun vl-unload-com ( )

    ;;  Untested, quick and dirty, abuse to suit.
    ;;
    ;;  Note: Subsequent vl-load-com call won't restore former functionality.

    (mapcar
        (function (lambda (a) (set a nil)))
        (vl-remove-if-not
            (function (lambda (a) (wcmatch (strcase (vl-symbol-name a)) "VLAX-*,VLA-*,VLR-*")))
            (atoms-family 0)
        )
    )
   
    (princ "\nPoof: Now you're as dumb as a f'ing mac.")       
   
    (princ)

)

Added : VLR-*
Title: Re: vl-unload-com
Post by: ronjonp on November 30, 2016, 02:14:17 PM
Don't try this at home kids.
..
    (princ "\nNow you're as dumb as a f'ing mac.")       
..
;D
Title: Re: vl-unload-com
Post by: ribarm on November 30, 2016, 02:17:32 PM
Unfortunately I think that all newer ACAD releases have somewhere (vl-load-com) added inside startup autoload procedures and even until now I haven't figured out where is that initiated... I am though completely sure that this is the case as I have bunch of lisps also autoloaded inside lower releases A2010- and when I type (vlax-get-acad-object) it returns no function definition error message... This is how I check weather my lisps are written like I wanted ((vl-load-com) is specified inside defined lisp command function in all lisps where extensions are needed for correct functionality)...

@MP - you forgot ab VLR-* functions...
Title: Re: vl-unload-com
Post by: QuestionEverything on November 30, 2016, 02:42:38 PM
Don't try this at home kids.

Code: [Select]
(defun vl-unload-com ( )

    ;;  Untested, quick and dirty, abuse to suit.
    ;;
    ;;  Note: Subsequent vl-load-com call won't restore former functionality.

    (mapcar
        (function (lambda (a) (set a nil)))
        (vl-remove-if-not
            (function (lambda (a) (wcmatch (strcase (vl-symbol-name a)) "VLAX-*,VLA`-*")))
            (atoms-family 0)
        )
    )
   
    (princ "\nNow you're as dumb as a f'ing mac.")       
   
    (princ)

)
M.Puckett, this is awesome!  :yay!:
I'm left with the impression that you've wrote many awesome stuff, and I like your sense of humour.
Title: Re: vl-unload-com
Post by: MP on November 30, 2016, 02:53:13 PM
(1) M.Puckett, this is awesome! :yay!: (2) I'm left with the impression that you've wrote many awesome stuff, and (3) I like your sense of humour.

(1) Thank you QE, (2) Possibly true tho none of it's on-line and (3) lol, you're now a member of a very small group. :-D