سؤال

I have few .arx applications for AutoCAD. In these applications few are menu based and others are command line. Now what I am trying to do is,

  1. Load the .arx app,
  2. run it and then
  3. unload it once the .arx application runs through a LISP command. .arx applications run once the user clicks on the tabs that are provided. .arx applications are written in VC++.

Now I have a lisp file, which gets loaded once the user starts AutoCAD. In the lisp files I have declared these functions for various .arx applications;

(defun c:XYZ_program() (command) (command) (arxload "C:/ABC/XYZ.arx") (command "XYZ_program") (arxunload "XYZ.arx") )

It works fine for Programs which need input data from Menu based forms, but says error unloading xyz.arx for programs which need command line input.

I was wondering if there were any commands in LISP that will make sure arxunload "XYZ.arx" will execute only once (command "XYZ_program") is executed.

I am not sure on how to approach this problem. Any help with the same would be greatly appreciated.

Code I am currently using is this ;

(
  defun c:XYZ_program() (command) (command)
   (arxload "C:/Example/Folder/XYZ.arx") 
   (command "XYZ_program") 
   ads_queueexpr( (arxunload "XYZ.arx") ) 
)
هل كانت مفيدة؟

المحلول

It's not clear from your question, but it sounds like the module cannot be unloaded because it is actively executing a command that is waiting for user input. So, I think you are asking how to postpone the unloading until the command is finished executing. The answer to that question is to use ads_queueexpr() to queue the (arxunload "XXX") function from within the command itself.

However, you are creating much bigger problems for yourself by attempting to unload the module. Unloading takes time, so it most certainly does not help performance. The correct solution to your problem is to not unload your modules and leave the unloading to AutoCAD.

نصائح أخرى

http://docs.autodesk.com/ACD/2013/ENU/index.html?url=files/GUID-3FF72BD0-9863-4739-8A45-B14AF1B67B06.htm,topicNumber=d30e502824

(defun c:Load()
    (arxload "the\\file\\path")
    ; run the app
)

Try this:

(arxload "C:/ABC/XYZ.arx" nil) 

(defun c:XYZ_program() 
    (command) 
    (command)
    (command "XYZ_program")
    (arxunload "XYZ.arx" nil) 
);

Good luck.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top