OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Lube on September 05, 2018, 07:52:41 AM

Title: Reload on changing drawing with modeless dialog
Post by: Lube on September 05, 2018, 07:52:41 AM
Hi there, I've a simple question :)

How do I accomplish that task?
"This event is triggered when the user switches to a different open AutoCAD drawing. Note that opening a new drawing will not trigger any event. An application that uses modeless dialogs must be installed so that its code is loaded into each newly created drawing document, and the application's initialization code must check for already active dialogs that it must manage."

I've a modeless dialog with that inside the code
(defun c:cordoli/cordoli#OnInitialize (/)
....
)


When I switch to another drawing it will be very cool if i dind't have to reload the *.fas

I've tried with that but of course it doens't work and I don't get how to check the already active dialogs :S
(defun c:cordoli/cordoli#OnDocActivated (/)
(c:cordoli/cordoli#OnInitialize)
)


Thank for your help !

Dennis
Title: Re: Reload on changing drawing with modeless dialog
Post by: AbuSimbel on September 05, 2018, 11:34:16 PM
Hello Lube.
You have to write the following code in the file ACAD.lsp, so that it is loaded in each drawing.

(defun c:cordoli/cordoli#Onanclajeactivado (/)  (load "cordoli") (c:cordoli) (princ))

(and (zerop (getvar "sdi"))
     (member "CORDOLI" (mapcar 'strcase (dcl_getprojects)))
     (dcl_form_isactive cordoli/cordoli)
     (c:cordoli/cordoli#Onanclajeactivado)
)
Title: Re: Reload on changing drawing with modeless dialog
Post by: Lube on September 11, 2018, 01:08:12 AM
Thank you mate!

Can I trigger the "OnInitialize" lisp part? Every drawing has a dictionary with items that need to be reloaded.

Thanks for your help :)
Title: Re: Reload on changing drawing with modeless dialog
Post by: Lube on September 21, 2018, 02:43:15 AM
Quote from: AbuSimbel on September 05, 2018, 11:34:16 PM
Hello Lube.
You have to write the following code in the file ACAD.lsp, so that it is loaded in each drawing.

(defun c:cordoli/cordoli#Onanclajeactivado (/)  (load "cordoli") (c:cordoli) (princ))

(and (zerop (getvar "sdi"))
     (member "CORDOLI" (mapcar 'strcase (dcl_getprojects)))
     (dcl_form_isactive cordoli/cordoli)
     (c:cordoli/cordoli#Onanclajeactivado)
)
Anyway I get this error
; error: no function definition: DCL_GETPROJECTS

I don't know how to fix that.. :S
Title: Re: Reload on changing drawing with modeless dialog
Post by: Peter2 on September 24, 2018, 12:12:23 AM
a) Both ways should be working, but (dcl-getprojects) is the current typing; (dcl_getprojects) is the older one.
b) ; error: no function definition: DCL_GETPROJECTS shows that you have not loaded opendcl. Check your installation if it is installed correctly, and call "opendcl" to load the software before you use functions from it