Author Topic: vl-unload-com  (Read 4400 times)

0 Members and 1 Guest are viewing this topic.

QuestionEverything

  • Guest
vl-unload-com
« 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).

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vl-unload-com
« Reply #1 on: November 29, 2016, 06:17:18 PM »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

QuestionEverything

  • Guest
Re: vl-unload-com
« Reply #2 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?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vl-unload-com
« Reply #3 on: November 29, 2016, 06:34:52 PM »
Suicide was the suggestion -- and why it was offered "in jest". :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vl-unload-com
« Reply #4 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?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: vl-unload-com
« Reply #5 on: November 30, 2016, 10:10:26 AM »
If I may be so nosey -- why do you need to do this?

+1
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

QuestionEverything

  • Guest
Re: vl-unload-com
« Reply #6 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.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: vl-unload-com
« Reply #7 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 and setpropertyvalue functions can replace in many situations vla-get-* and vla-put-* (and are sometimes more powerfull).
« Last Edit: November 30, 2016, 11:44:10 AM by gile »
Speaking English as a French Frog

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: vl-unload-com
« Reply #8 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...

QuestionEverything

  • Guest
Re: vl-unload-com
« Reply #9 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 and setpropertyvalue 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?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: vl-unload-com
« Reply #10 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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vl-unload-com
« Reply #11 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-*
« Last Edit: November 30, 2016, 11:12:35 PM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ronjonp

  • Needs a day job
  • Posts: 7529
Re: vl-unload-com
« Reply #12 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

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: vl-unload-com
« Reply #13 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...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

QuestionEverything

  • Guest
Re: vl-unload-com
« Reply #14 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.