Autoloader lisp PerDocument

Autoloader lisp PerDocument

marcin.sachs
Advocate Advocate
900 Views
13 Replies
Message 1 of 14

Autoloader lisp PerDocument

marcin.sachs
Advocate
Advocate

Hi All,

I have problem with autoloader.
I created very simple packageContext.xml to load lisp at every document. The problem is that the lisp is loaded only at startup.

PackageContext.xml:

<?xml version="1.0" encoding="utf-8" ?>
<ApplicationPackage 
  SchemaVersion="1.0"
  AutodeskProduct="AutoCAD"
  ProductType="Application"
  AppVersion="1.1"
  Author="---------"
  Name="LISP"
  Description="LISP"
  Icon="./logo.ico"
  HelpFile="./Help.htm"                    
  ProductCode="{7C1EEA79-B0DD-400D-9D10-8D9DA92FD4CA}"
>
  <CompanyDetails 
    Name="---"
    Url="---"
    Email="---" 
  />  
  <RuntimeRequirements Platform="AutoCAD*" />
  <Components>
    <RuntimeRequirements SupportPath="./Support/Lisp/" />
    <ComponentEntry AppName="MainLISP"
                ModuleName="./Support/Lisp/_load.lsp" PerDocument="True" LoadOnAutoCADStartup="True" LoadOnCommandInvocation="True" />
  </Components>
</ApplicationPackage>
0 Likes
Accepted solutions (1)
901 Views
13 Replies
Replies (13)
Message 2 of 14

john.uhden
Mentor
Mentor

Check out how acaddoc.lsp works.

John F. Uhden

0 Likes
Message 3 of 14

hak_vz
Advisor
Advisor

Personally I don't have experience with using Autoloader but as @john.uhden  has suggested, for working with lisp files, you can either edit acaddoc.lsp and add your code there, or use startup suite (tools->load application->startup suite).  If for some reason you need to use autoloader, I hope someone will provide answer, or you later try your luck at .NET forum. I guess guys at that forum have more experience about this topic.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 4 of 14

Sea-Haven
Mentor
Mentor

Autoloader or a Bundle ? 

 

A Bundle lets you have all your code in 1 spot, load on start up only those required, sets support paths and loads menu's. Super simple to make, just need 1 to look at. 

 

SeaHaven_0-1635988499476.png

 

0 Likes
Message 5 of 14

marcin.sachs
Advocate
Advocate

@Sea-Haven 
by Autoloader I mean Bundle folder...

I have .net plugin which will be loaded using bundle folder but I also need load lisp functions. I know added to the sturtup suite is easy but not in this case. I need this for more users.
generally lisp is loaded but only in first drawing. 

0 Likes
Message 6 of 14

hak_vz
Advisor
Advisor

@marcin.sachs  In searching for more details about this topic  I' have found that some of Expert Elite members posting in .net forum have worked on this.

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 7 of 14

Sea-Haven
Mentor
Mentor

It may be a simple rearrange order, works for me.

 

<ComponentEntry LoadOnAutoCADStartup="True" ModuleName="./Contents/Programs/Multi Radio Buttons.lsp" AppName="Lisp File to Load"/>

0 Likes
Message 8 of 14

marcin.sachs
Advocate
Advocate

@Sea-Haven 
Unfortunately not work. Lisp is still loaded only in first drawing.

0 Likes
Message 9 of 14

hak_vz
Advisor
Advisor

If I understood what is written in Autoloader white paper try to remove LoadOnAutoCADStartup  parameter and only leave PerDocument = true. On the other hand this sounds weird It also stands:

LoadOnAutoCADStartup – Load when AutoCAD starts up. If this is specified, then it has precedence over all other LoadReasons. We recommend only using LoadOnAutoCADStartup when none of the other load reasons are suitable – i.e. you should explicitly disable it (set to False) whenever possible. If the LoadOnAutoCADStartup parameter is omitted, then it defaults to True; unless LoadOnCommandInvocation is True, in which case LoadOnAutoCADStartup defaults to False

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 10 of 14

pbejse
Mentor
Mentor

@marcin.sachs wrote:

I created very simple packageContext.xml to load lisp at every document. The problem is that the lisp is loaded only at startup.


I use the packageContext.xml as posted and it loads on every drawing.

_load.lsp as

(alert "I loaded")

The only time it did not load is when there's  missing or invalid <ComponentEntry..> , it only takes one of the those errors to halt the bundle from loading.

 

I suggest you check the rest of the Component Entries.

 

0 Likes
Message 11 of 14

marcin.sachs
Advocate
Advocate

I try using lisp as

 

(alert "I loaded")

 

 

and it's work.
I'm back to my lisp and again lisp is loaded only in first drawing.
_load.lsp:

 

(setq *LSP-Path* "C:/Program Files/Autodesk/ApplicationPlugins/KingspanCADTools.bundle/Support/Lisp/")
; --------------------------------------------------------------------------- ;
(load (strcat *LSP-Path* "CADPL-Pack-v1.lsp") -1)
(load (strcat *LSP-Path* "Kingspan-LISP-Tools.lsp") -1)
; --------------------------------------------------------------------------- ;


(autoload 
  (strcat *LSP-Path* "BS-Steel.lsp")
  (list 
    "STE" "STE-A" "STE-M"     ; 
  )
)
; --------------------------------------------------------------------------- ;
;(autoload 
;  (strcat *LSP-Path* "SteelBackup.lsp")
;  (list 
;    "QW"      ; Makes a backup of steel files
;  )
;)
; --------------------------------------------------------------------------- ;
(autoload 
  (strcat *LSP-Path* "Kingspan-LISP-Tools.lsp")
  (list 
    "FF"     ; Opens folder an active drawing
    "LP"     ; Layer Manager Palette ON/OFF
    "TECH"   ; Opens TECHNICAL folder
    "TIMS"   ; Opens a TimeSheet
    "BKG"    ; change background
    "BTN"    ; toolbar manage
    "ANN"    ; freeze/thaw the G-Anno-NPlt layer in active Vport
    "INN"    ; the same but for a Invisible later
    "MLEVEL"
    "DM"
    "DRAWMODE"
    "ELEV-N"
  )
)
; --------------------------------------------------------------------------- ;
(autoload 
  (strcat *LSP-Path* "Std-Wood-Packer.lsp")
  (list 
    "PACKS"    ; Packer & Insulation counter
    "MASS"     ; Steel % Packer weight calculator
    "TXTSUF"   ; Add prefix / suffix to TEXT
    "TXTPRE"   ; Add prefix / suffix to TEXT
  )
)
; --------------------------------------------------------------------------- ;
(autoload 
  (strcat *LSP-Path* "Std-Dimensions.lsp")
  (list 
    "DIME"     ; Main command of dimensions edit
    "DIM-RE"   ; Restore dim
    "DIM-FI"   ; Add a diameter symbol to text
    "DIM-EQ"   ; Change text to equal symbol
    "DIM-MA"   ; Match of dimensions text
    "DIM-AR"   ; Change arrows (architectural / standard) 
    "DIM-ED"   ; Dimensions editor
    "DIM-FL"   ; Flip dimensions
    "DIM-SF"   ; Scales a selection dimension
    "DIM-EL"   ; Extended line ON/OFF
    "DIM-TF"   ; Text dimension frame ON/OFF
  )
)
; --------------------------------------------------------------------------- ;
(princ)

 

 


 





0 Likes
Message 12 of 14

pbejse
Mentor
Mentor
Accepted solution

@marcin.sachs wrote:

I'm back to my lisp and again lisp is loaded only in first drawing.
_load.lsp:

I could be wrong but AFAICT autoload only works thru acaddoc.lsp and/or *.mnl.

This bit on the other hand works well, 

 

(load (strcat *LSP-Path* "CADPL-Pack-v1.lsp") -1)

 

If you want loading on demand you can however make your own Autoload.

Holler if you need help with that.

 

 

Message 13 of 14

marcin.sachs
Advocate
Advocate

Right, it seems the autoload not work. I modified my PackageContents.xml to use "LoadOnCommandInvocation="True"" and I added commands. Now it's working.
Thank you all very mach for assist.

0 Likes
Message 14 of 14

Sea-Haven
Mentor
Mentor

Hi Pbe in my lisp called autoload.lsp by coincidence which is in Appload startup suite. These plus more are demand loaded. Work in every dwg. A different Autoload function.

 

 

(autoload "COPY0" '("COPY0"))
(autoload "COPYCOMMAND" '("ZZZ"))
(autoload "COVER" '("COVER"))
(autoload "DIMFLIP" '("DIMFLIP"))

 

 

0 Likes