TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Kerry on July 17, 2015, 02:42:48 AM

Title: AutoLoading bundle for Vlisp
Post by: Kerry on July 17, 2015, 02:42:48 AM

Salutations,

Does anyone have a sample bundle for demand loading visualLisp (.lsp & .vlx)  & dotnet dll's into AutoCAD (2014 / 2015 / 2016 )

I want to load some on startup and the majority as demand loaded.

Also,  a link to any understandable documentation would be of assistance and really appreciated.

Regards,
Kerry


Title: Re: AutoLoading bundle for Vlisp
Post by: Patrick_35 on July 17, 2015, 02:58:40 AM
Hello

You have the autoload function to save the function without loading (but I think you know)
You also have registers that load at boot a lisp.

an example that lists all lisps loaded on boot up via _appload
Code - Auto/Visual Lisp: [Select]
  1. (defun c:app( / cle fin deb val)
  2.   (setq cle (strcat "HKEY_CURRENT_USER\\"
  3.                     (vlax-machine-product-key)
  4.                     "\\Profiles\\"
  5.                     "\\Dialogs\\Appload\\Startup"
  6.             )
  7.         deb 0
  8.   )
  9.   (and (setq fin (vl-registry-read cle "numstartup"))
  10.     (while (< deb (atoi fin))
  11.       (setq deb (1+ deb)
  12.             val (vl-registry-read cle (strcat (itoa deb) "startup"))
  13.       )
  14.       (princ (strcat "\n" val))
  15.     )
  16.   )
  17.   (princ)
  18. )

@+
Title: Re: AutoLoading bundle for Vlisp
Post by: Kerry on July 17, 2015, 03:08:16 AM

Thanks for the post Patrick.
I currently use a fairly sophisticated personalised autoloader.

I was looking for a construction similar to that used for/by  Autodesk Exchange Apps Store

Regards
Title: Re: AutoLoading bundle for Vlisp
Post by: BlackBox on July 17, 2015, 03:21:19 AM
Here's the only documentation I've needed for the past few years:

Autoloader White Paper (http://adndevblog.typepad.com/autocad/2013/01/autodesk-autoloader-white-paper.html)

2015 | Autoloader RegistryEntries, SystemVariables, and EnvironmentVariables (http://www.theswamp.org/index.php?topic=47842.0)



This is more than I usually include, as you can see from my Exchange apps, but *should* cover what you're after... Pseudo-code for PackageContents.xml file:

Code - XML: [Select]
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <ApplicationPackage
  3.         AppVersion="1.0.0" Author="" Description="<YourApp> for AutoCADŽ" HelpFile="./Contents/Resources/<YourHelpFile>.html" Icon="./Contents/Resources/<YourIcon>.ico" Name="<YourApp> for AutoCADŽ" ProductCode="<YourGuid01>" ProductType="Application" SchemaVersion="1.0" UpgradeCode="<YourGuid02>" >
  4.         <CompanyDetails Name="<YourCompany>" Phone="<YourPhone>" Url="<YourUrl>" Email="<YourEmail>"/>
  5.         <Components>
  6.        
  7.                 <!-- OS, Platform, SeriesMax, SeriesMin XmlAttributes not needed for vanilla LISP, Cuix per-se; just show as example, if you needed to limit LSP, CUIx to be version-specific -->
  8.                 <RuntimeRequirements OS="Win32|Win64" Platform="AutoCAD*" SeriesMax="R20.1" SeriesMin="R19.1" SupportPath="./Contents/Resources" />
  9.                 <ComponentEntry AppDescription="<YourAppDescription>" AppName="<YourCompany>\<YourApp>" LoadOnAutoCADStartup="true" ModuleName="./Contents/Resources/<YourCuixFile>.cuix"  Version="1.0.0" />
  10.                
  11.                 <!-- autoload at document open -->
  12.                 <ComponentEntry AppDescription="<YourAppDescription>" AppName="<YourCompany>\<YourApp>" ModuleName="./Contents/Resources/<YourLispFile01>" PerDocument="true" Version="1.0.0" />
  13.                
  14.                 <!-- demand-load on command invocation -->
  15.                 <ComponentEntry AppName="<YourCompany>\<YourApp>" Version="1.0.0" ModuleName="./Contents/Resources/<YourLispFile02>" AppDescription="<YourAppDescription>" LoadOnAppearance="True" LoadOnAutoCADStartup="False" LoadOnCommandInvocation="True" LoadOnRequest="True">
  16.                         <Commands GroupName="<YourGroup>">
  17.                                 <Command Local="<YourLocal>" Global="<YourGlobal>" />
  18.                         </Commands>
  19.                 </ComponentEntry>
  20.         </Components>
  21.        
  22.         <Components>
  23.                 <RuntimeRequirements OS="Win32|Win64" Platform="AutoCAD*" SeriesMax="R19.1" SeriesMin="R19.0" />
  24.                
  25.                 <!-- autoload assembly at session start -->
  26.                 <ComponentEntry AppDescription="<YourAppDescription>" AppName="<YourCompany>\<YourApp>"ModuleName="./Contents/<YourDwgFormat>/<Your19NetFile>" LoadOnAutoCADStartup="true" Version="1.0.0" >
  27.                 </ComponentEntry>
  28.         </Components>
  29.         <Components>
  30.                 <RuntimeRequirements OS="Win32|Win64" Platform="AutoCAD*" SeriesMax="R20.1" SeriesMin="R20.0" />
  31.                
  32.                 <!-- autoload assembly at session start -->
  33.                 <ComponentEntry AppDescription="<YourAppDescription>" AppName="<YourCompany>\<YourApp>"ModuleName="./Contents/<YourDwgFormat>/<Your20NetFile>" LoadOnAutoCADStartup="true" Version="1.0.0" >
  34.                 </ComponentEntry>
  35.         </Components>
  36. </ApplicationPackage>
  37.  



HTH
Title: Re: AutoLoading bundle for Vlisp
Post by: Kerry on July 17, 2015, 03:54:13 AM

Thanks BB. That will be a great start.

Regards,
Title: Re: AutoLoading bundle for Vlisp
Post by: Patrick_35 on July 17, 2015, 04:01:43 AM
You try to make a customized installation of an executable with your lisps ?
Personally, I use NSIS (http://sourceforge.net/projects/nsis/files/) with a change in the AcadxxxDoc.lsp that loads a lisp with all my customizations (subroutine, autoload, etc ...)

@+
Title: Re: AutoLoading bundle for Vlisp
Post by: BlackBox on July 17, 2015, 09:01:23 AM

Thanks BB. That will be a great start.

Regards,

Happy to help. :beer:

The only issue I've experienced to-date with LISP-like files and Autoloader, is MNL - they just seemed to behave oddly, some loading four times, etc. some not loading at all (as Autoloader replicates the CUIx to ..\Support\ when out of date, and then doesn't remove them if the App is removed), so back when I first observed this, and reported to Fenton, I ended up finding it simpler to just load LSP PerDocument instead, and included the SupportPath XmlAttribute for any additional resources.

Cheers