Author Topic: Reload on changing drawing with modeless dialog  (Read 124 times)

Lube

  • Member
  • *
  • Posts: 25
Reload on changing drawing with modeless dialog
« 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
Code: [Select]
(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
Code: [Select]
(defun c:cordoli/cordoli#OnDocActivated (/)
(c:cordoli/cordoli#OnInitialize)
)

Thank for your help !

Dennis

AbuSimbel

  • Member
  • *
  • Posts: 4
  • Draftsman Draughtsman
Re: Reload on changing drawing with modeless dialog
« Reply #1 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)
)

Lube

  • Member
  • *
  • Posts: 25
Re: Reload on changing drawing with modeless dialog
« Reply #2 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 :)

Lube

  • Member
  • *
  • Posts: 25
Re: Reload on changing drawing with modeless dialog
« Reply #3 on: September 21, 2018, 02:43:15 AM »
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
« Last Edit: September 21, 2018, 08:06:52 AM by Lube »

Peter2

  • Sr. Member
  • ****
  • Posts: 463
Re: Reload on changing drawing with modeless dialog
« Reply #4 on: Today at 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
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10