TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: domenicomaria on May 25, 2021, 05:28:01 AM

Title: I need to PROPAGATE defuns . . .
Post by: domenicomaria on May 25, 2021, 05:28:01 AM
I wrote an application that uses some modeless forms of Open DCL.
Every button, has its associated defun.

I need that this modeless form,
has to work in every open DWG, in every DOC.

So I need to PROPAGATE defuns.
A lot of defuns ... ! (more then 500 defuns !)

So I tried this :

(vl-propagate 'DEFUN-NAME)

but NOTHING HAPPENS !

I need to PROPAGATE a DEFUN , not a VARIABLE . . .

any suggestion ?
Title: Re: I need to PROPAGATE defuns . . .
Post by: VovKa on May 25, 2021, 06:33:20 AM
Every button, has its associated defun.
the button defines a function or the button calls a function?
Title: Re: I need to PROPAGATE defuns . . .
Post by: domenicomaria on May 25, 2021, 06:41:17 AM
the button defines a function or the button calls a function?

The defuns are defined onInitialize event.
When the form is shown.

Every button calls a function defined from a defun.

When the user clicks on that button, the associated defun is executed.
Title: Re: I need to PROPAGATE defuns . . .
Post by: VovKa on May 25, 2021, 08:59:23 AM
the button defines a function or the button calls a function?
The defuns are defined onInitialize event.
you may try (vl-load-all) and OnDocActivate event
Title: Re: I need to PROPAGATE defuns . . .
Post by: domenicomaria on May 25, 2021, 09:31:18 AM
Quote
you may try (vl-load-all) and OnDocActivate event

vl-load-all is good only the first time . . .
. . .
it is not easy to explain . . .
. . .
Defuns are redefined at run time frequently.
. . .
I cannot load all, all the time a defun is redefined . . .
. . .
When the user switches from
DIMENSIONs to TEXT UTILITIES[2]
all the 25 defuns associated to these 25 buttons,
are REDEFINED at RUN TIME.
. . .
All the time, have I to reload (all) every thing ?
. . .
Just to give you an idea, take a look to the attached images.

Title: Re: I need to PROPAGATE defuns . . .
Post by: VovKa on May 25, 2021, 09:55:53 AM
i see that initially you functions are strings
you can build a list of all those strings, then vl-propagate this list and then read-eval items from this list upon OnDocActivate event
Title: Re: I need to PROPAGATE defuns . . .
Post by: domenicomaria on May 25, 2021, 11:56:51 AM
i see that initially you functions are strings
you can build a list of all those strings, then vl-propagate this list and then read-eval items from this list upon OnDocActivate event

thank you

i will give it a try
Title: Re: I need to PROPAGATE defuns . . .
Post by: domenicomaria on May 26, 2021, 10:14:28 AM
Vovka thanks.

You always help me.

It works !

1- vl-load-all
2- an onDocActivated defun
3 - create a list of strings representing the code of all the run-time re-defined defuns
4 - vl-propagate this list of strings
5 - when the event onDocActivated happens, then mapcar, read , eval . . .

. . . if you come to Italy, I will offer you a case of beer. . .
we will drink it, you and my Ukrainian friend from Kharkiv (Харьков)

. . .

grazie

ciao
Title: Re: I need to PROPAGATE defuns . . .
Post by: VovKa on May 26, 2021, 02:25:38 PM
. . . if you come to Italy, I will offer you a case of beer. . .
we will drink it, you and my Ukrainian friend from Kharkiv (Харьков)
:smitten:
say 'hi' to him from Lutsk (Луцьк)
Title: Re: I need to PROPAGATE defuns . . .
Post by: domenicomaria on May 26, 2021, 02:31:16 PM
her
Title: Re: I need to PROPAGATE defuns . . .
Post by: VovKa on May 26, 2021, 02:42:24 PM
her
oops
then Salutala :)
Title: Re: I need to PROPAGATE defuns . . .
Post by: ribarm on June 27, 2022, 11:56:44 PM
@VovKa,
fast fingertips?
Tell us something from your IRT experiences...
Was it fun to write it?
How are your legs?