Updating Bundle

Updating Bundle

drew_dewit
Advocate Advocate
2,383 Views
20 Replies
Message 1 of 21

Updating Bundle

drew_dewit
Advocate
Advocate

What is the proper methodology for updating a plug-in bundle. I have a bundle that contains CUI files and LISP routines that the lisp routine has changed. We have a program that copies the bundle to the ApplicationPlugins folder. If I change the file the user doesn't see an updated LISP unless the folder is deleted. Is there a way around this?

0 Likes
2,384 Views
20 Replies
Replies (20)
Message 2 of 21

pbejse
Mentor
Mentor

@drew_dewit wrote:

What is the proper methodology for updating a plug-in bundle. I have a bundle that contains CUI files and LISP routines that the lisp routine has changed. We have a program that copies the bundle to the ApplicationPlugins folder. If I change the file the user doesn't see an updated LISP unless the folder is deleted. Is there a way around this?


 

Where is the file located? How do you go about updating the files on ApplicationPlugins folder?

 

0 Likes
Message 3 of 21

drew_dewit
Advocate
Advocate
I am copying the .bundle folder into the ApplicationData folder under C:/ProgramData. I tried having our utility delete the folder before copying it but our utility performs these just after launch and that folder gets locked down by AutoCAD
0 Likes
Message 4 of 21

pbejse
Mentor
Mentor

@drew_dewit wrote:
I am copying the .bundle folder into the ApplicationData folder under C:/ProgramData. I tried having our utility delete the folder before copying it but our utility performs these just after launch and that folder gets locked down by AutoCAD

Here's how  our bundles are setup. We keep the vlx/lsp on the server, what the plug-in loads are a call to load the programs from the server. Will that work for you?

 

0 Likes
Message 5 of 21

drew_dewit
Advocate
Advocate
Exactly what I am trying to do. Can you provide me an example of how you are loading the lisp?
0 Likes
Message 6 of 21

JamesMaeding
Advisor
Advisor

umm, this subject has been talked about before, and if you run tools from the server, laptops and anything not hooked to it cannot run them.

That is not a nice thing to do to users IMO. If they are allowed to work away from the office, its assumed the tools should work too.

Now, the big disadvantage of running off the server is any .net dll's get locked once loaded by one machine.

You must kick everyone off it and so on which makes you a policeman and that never goes well.

Instead, set up a folder on the server with whatever files you want to end up on the user machine.

Then make a windows script that calls (the free) robocopy util to copy files needed to the user computers.

They will run that on login, or by hand, but with acad closed.

That way they have a copy of the latest, and can run offline, and also mess it up and all they have to do is rerun the script to heal. I've been doing this for 20 years now and it solves so many problems you have never even thought of.

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 7 of 21

drew_dewit
Advocate
Advocate
This is basically what we are doing. Our utility robocopies the directories locally then looks at an XML file to launch auto cad and load the appropriate profiles and files. I am trying to have the XML file update the bundle folder but it happens post launch so I think AutoCAD is preventing it from being updated.
0 Likes
Message 8 of 21

JamesMaeding
Advisor
Advisor

@drew_dewit 

Surprisingly, most files acad uses can be overwritten even if loaded into acad.

.Net dll's cannot though, as well as arx files. .vlx can be though.

Anyway, not sure why you need the xml to do anything if you do in your login script.

You can condition the script based on folders, files, and registry entries existing so that allows it to only do what you want. I'd be surprised if acad is really locking any folders beyond what you could do in explorer when its open.

Obviously run the script with acad closed...

thx

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 9 of 21

pbejse
Mentor
Mentor

@JamesMaeding wrote:

umm, this subject has been talked about before, and if you run tools from the server, laptops and anything not hooked to it cannot run them. That is not a nice thing to do to users IMO. If they are allowed to work away from the office


 

Thats the idea. We dont recommend users working away from the office, 🙂 

 


@JamesMaeding wrote:

Now, the big disadvantage of running off the server is any .net dll's get locked once loaded by one machine.

You must kick everyone off it and so on ....

Instead, set up a folder on the server with whatever files you want to end up on the user machine.

Then make a windows script that calls (the free) robocopy util to copy files needed to the user computers.

They will run that on login, or by hand, but with acad closed.

 


 

Yes, dll is a whole another ball game. Hence my question was about vlx and lsp.

We do  use the same approach as you described above, difference is , it doesnt necessarrily need to be callled off a script, use XML instead.

 

 

 

 

0 Likes
Message 10 of 21

pbejse
Mentor
Mentor

@drew_dewit wrote:
Exactly what I am trying to do. Can you provide me an example of how you are loading the lisp?

For Lsp and/or vlx.

 

(and
  (or _sourceDriveAndFolder
      (setq _sourceDriveAndFolder "K:\\Placeholder\\LsporVlx")
  )

  (defun _process (sr tr / location Files fl_1 fl_2)
    (setq location (car tr)
	  Files	   (cadr tr)
    )

    (foreach itm (cadr sr)
      (setq fl_1 (strcat (car sr) "\\" itm))
      (setq fl_2 (strcat location "\\" itm))
      (cond
	((not (findfile fl_2)) (vl-file-copy fl_1 fl_2))
	((and (member (strcase itm) (mapcar 'strcase (cadr sr)))
	      (newer-p (setq fl_1 (strcat (car sr) "\\" itm))
		       (setq fl_2 (strcat location "\\" itm))
	      )
	 )
	 (vl-file-delete fl_2)
	 (vl-file-copy fl_1 fl_2)
	)
      )
    )
  )

  (setq	WhereToPlaceFiles
	 (vl-some '(lambda (pdata / _path)
		     (if (setq _path
				(findfile
				  (strcat
				    (getenv pdata)
				    "\\Autodesk\\ApplicationPlugins\\YourBundle.bundle\\Contents\\Windows"
					;< -- wherever the vlx/lsp files are located
				  )
				)
			 )
		       (strcat _path "\\")
		     )
		   )
		  '("PROGRAMDATA" "APPDATA")
	 )				;< -- wherever the bundles are intallled
  )


  (defun _ListFilesFromServer (sd_ / fileList)
    (setq fileList
	   (vl-remove-if
	     '(lambda (fl)
		(member	(strcase (vl-filename-extension fl))
			'(".PDB" ".FAS" ".XML") ; <--exclusion
		)
	      )
	     (vl-directory-files sd_ nil 1)
	   )
    )
    (list sd_ fileList)
  )


  (defun newer-p (f1 f2 / compare)
    (defun compare (a b)
      (cond
	((> (car a) (car b)))
	((and a b (= (car a) (car b)))
	 (compare (cdr a) (cdr b))
	)
      )
    )
    (apply 'compare
	   (mapcar '(lambda (x) (vl-list* (car x) (cadr x) (cdddr x)))
		   (mapcar 'vl-file-systime (list f1 f2))
	   )
    )
  )
  (_process (_ListFilesFromServer _sourceDriveAndFolder)
	    WhereToPlaceFiles
  )
  (princ "\n<<< Files checked/updated >>>")
  (princ)
)

HTH

 

Message 11 of 21

drew_dewit
Advocate
Advocate

So what calls this? What I have now is a lisp that calls a load of all the LISP routines I want to be loaded. That LISP is included in my bundle and added to the PackageContents.xml. But what i am finding is if I change my load LISP and have our utility copy the new bundle and contents down it isn't updating.

0 Likes
Message 12 of 21

drew_dewit
Advocate
Advocate

So what I found out this morning is that our utility can delete the bundle to unload it if I ask it to and can copy the updated one. It looks like something is preventing my LISP that loads the other files from being deleted or modified.

0 Likes
Message 13 of 21

_gile
Consultant
Consultant

Hi,

 Did you try to change the AppVersion and ProductCode of the ElementName node and (optional but recommended) the Version of the ComponentEntry node in the PackageContents.xml file?

You can see the Autoloader White Paper which the most exhaustive documentation about the Autoloader mechanism.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 14 of 21

drew_dewit
Advocate
Advocate

I have changed the version but not the product code. This is not updating the LISP. How is the product code changed? I currently am dumping them into here:

 

\AppData\Roaming\Autodesk\ApplicationPlugins

 

0 Likes
Message 15 of 21

_gile
Consultant
Consultant

Sorry but what you're doing is not totally clear to me.

The way I update a .bundle folder with a new application file (cuix, lsp, fas, vlx, dll) if you do not use an installer (msi) should be:

1. Copy the .bundle folder in another location to make the changes

2. In the PackageContents.xml file:

- Increment the AppVersion

- Create a new GUID (with Visual Studio or some in line GUID generator) to replace the ProductCode

- Increment the Version of the changed ComponentEntry (application file)

3. Replace the old application file (cuix, lsp, fas, vlx, dll) with the new one

4. Replace the old .bundle folder with the modified one.

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 16 of 21

dgorsman
Consultant
Consultant

Stupid question time: at launch, at open, etc., does that mean Windows?  Or AutoCAD?  Are you trying to update contents while running them?

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 17 of 21

drew_dewit
Advocate
Advocate

I think this is my problem. Here is the process:

 

  • User launches AutoCAD Lunch Utility
  • Librarys and support files are synced to C:\AutoCAD\Data
  • User selects profile to launch against
    • This determines which bundles are loaded and may contain different CUIs and LISPs
    • Changes registry values
    • Configured via XML
  • Launch utility launches AutoCAD and then copies bundles to %APPDATA%\Autodesk\ApplicationPlugins\
  • AutoCAD is loaded

If the files are updated prior to launch I am fine. I think the lisp routine I have is being access already and isn't being updated when I try to copy the new bundle over while AutoCAD is booting up

0 Likes
Message 18 of 21

JamesMaeding
Advisor
Advisor

@drew_dewit 

No, I overwrote loaded lisps for years, that is not it.

I used to have a "synch with server" lisp that updated all acad tools while acad was open, but could not use it if I had updated arx or dll files on the server, as those do "hook" to acad when loaded.

Since I used robocopy that only copies modified files, it would skip the arcx and dll's I did not change.

You need to mention specifically what files are not copying, and if you modified them, and if you are using robocopy and with what switches. I use the /mir with robocopy to truly match my local tools folders with server.

thx


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 19 of 21

drew_dewit
Advocate
Advocate

@JamesMaedingSo my file is making it to the C:AutoCAD/Data folder so the RoboCopy end of the launch utility works because the new file is making it from the server. It is the post launch Copy/Delete functions that aren't when the LISP is in the AppData folder. I did a test and told my launch utility to delete the .bundle folder after launch and the LISP was left behind.

0 Likes
Message 20 of 21

JamesMaeding
Advisor
Advisor

@drew_dewit 

Describe this launch utility. Is this something you made? what language is it in?

I can overwrite and delete lisp files all day with acad open, as acad does not hook to lisps.

It reads the text when loading, like (load "somelisp.lsp") but then forgets about the file.

It is likely your util is hooking to the file and preventing update, not acad.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes