Personal Infofield in Statusbar

Personal Infofield in Statusbar

C.Utzinger
Collaborator Collaborator
2,333 Views
19 Replies
Message 1 of 20

Personal Infofield in Statusbar

C.Utzinger
Collaborator
Collaborator

 

HI

 

How is it possible to show an personal Info at the Statusbar?

 

We have a additional program for AutoCAD and they made it (see attached printscreen)

 

 

Happy new Year!

0 Likes
Accepted solutions (2)
2,334 Views
19 Replies
Replies (19)
Message 2 of 20

cadffm
Consultant
Consultant
There is one "field" you can customize with text abd diesel expressions
F1 for MODEMACRO and DIESEL

Befehl: Modemacro
Mein Layer $(getvar,clayer)

Sebastian

Message 3 of 20

C.Utzinger
Collaborator
Collaborator

Is there only one?

0 Likes
Message 4 of 20

cadffm
Consultant
Consultant
Accepted solution

Yes.

 

Example for Layer AND Layouttab

 

modemacro

Lay: $(getvar,CLAYER) | Tab: $(getvar,CTAB)

Sebastian

Message 5 of 20

C.Utzinger
Collaborator
Collaborator

In this case, the problem I have, that i must share this field with the other program.

 

From my side no problem with a lisp routine to add the Information to the existing text from the other program, but the other program will overwrite my Information when it changes the settings.

 

Grrrrrrr

0 Likes
Message 6 of 20

cadffm
Consultant
Consultant

Contact the program producers to change the software, he can handle it like you want to handle it.

 

save existing value

 

- replace with temorary information (during a command is active) and reset the old value after

 

- running informations should added to existing values

 

==

 

Sorry.
Plain AutoCAD are no custom fields possible, only with extensions .net/c++.

For example you can use a custom-PALETTE to display Informations, http://opendcl.com/wordpress/?tag=palette

If you want it better, the direction is C++ (or .net)

Sebastian

Message 7 of 20

DannyNL
Advisor
Advisor

Create a reactor that automatically adds your information to MODEMACRO again as soon as the information is changed by the other program. 

Message 8 of 20

C.Utzinger
Collaborator
Collaborator

 

Hi I just testet it

 

But AutoCAD crashes when i use it... Smiley LOL

 

When I just put a alert then it shows up 3 times.

 

 

(vl-load-com)
(setq VTFRXN (vlr-editor-reactor nil '((:VLR-sysVarChanged . VTF))))


(defun VTF (CALL CALLBACK)
   (if (= (strcase (car CALLBACK)) "MODEMACRO")
       (progn
         (setq info (getvar 'MODEMACRO)
               info (vl-string-left-trim " /SPI-:1234567890" info)
               info (strcat "SPI- 1:50 / " info)
         )
       (setvar 'MODEMACRO info)
       )
   )
)
0 Likes
Message 9 of 20

DannyNL
Advisor
Advisor

That actually makes sense since the reactor changes the MODEMACRO and thus triggers itself again.

You probably need to build some delay into it, something only to execute if the last change was more than, lets say 5 seconds ago. Maybe use the blackboard (vl-bb-set/ref) to write/read execution time for the reactor to check before executing again.

0 Likes
Message 10 of 20

C.Utzinger
Collaborator
Collaborator

 

It also crashes when I change the variable only one time...

0 Likes
Message 11 of 20

DannyNL
Advisor
Advisor

I've tested and can confirm I have the same issue and cannot seem to prevent it somehow.

 

But you say the MODEMACRO changes when the other program's settings are changed. Instead of using a reactor on the MODEMACRO variable, can't you use a reactor to catch the command used for changing the program's settings to modify the MODEMACRO back to what you want?

Message 12 of 20

ВeekeeCZ
Consultant
Consultant

You can try to use (grtext) if it helps you in your fight... But  it has its pros and cons... read THIS thread for more info...

 

 

Message 13 of 20

C.Utzinger
Collaborator
Collaborator

Please, do you have an example for a recator for a function?

0 Likes
Message 14 of 20

DannyNL
Advisor
Advisor
Accepted solution

Something like this? Example used for the OPTIONS command.

Although I'm not certain it will be able to capture the commands of your program.

 

(vl-load-com)
(setq VTFRXN (vlr-editor-reactor nil '((:VLR-commandEnded . VTF))))


(defun VTF (CALL CALLBACK)
   (if (= (strcase (car CALLBACK)) "OPTIONS")
       (progn
          (setq info (getvar 'MODEMACRO)
                info (vl-string-left-trim " /SPI-:1234567890" info)
                info (strcat "SPI- 1:50 / " info)
          )
          (setvar 'MODEMACRO info)
       )
   )
)

If this doesn't work you probably will need to create some test reactors for different reactor types just to see what reactors your program command triggers and what not. But be careful, it is really easy (as you have noticed with the SysVar reactor) to crash AutoCAD, so make sure to save your code before each test.

0 Likes
Message 15 of 20

ВeekeeCZ
Consultant
Consultant

Yes, but too complicated to share. (edit: oops, did not see that your reply was to Danny)

 

Here is your modified.

 

(defun c:sysvarReactor-OnLoad ()
  (if *sysvarReactor* (vlr-remove *sysvarReactor*))
  (setq *sysvarReactor* (vlr-sysvar-reactor nil '((:vlr-sysVarChanged . sysvarReactor-CallBack))))
  (princ "\nSysvarReactor is running")
  )

(defun c:sysvarReactor-UnLoad ()
  (if *sysvarReactor* (vlr-remove *sysvarReactor*)) (princ))

(defun sysvarReactor-CallBack (rea lst / ss)
  (if (= (strcase (car lst)) "MODEMACRO")
    (progn
      (setq info (getvar 'MODEMACRO)
            info (vl-string-left-trim " /SPI-:1234567890" info)
            info (strcat "SPI- 1:50 / " info)
            )
      (grtext -1 info)
      )))

(c:sysvarReactor-OnLoad)

 

Message 16 of 20

C.Utzinger
Collaborator
Collaborator

 

HI, good news

 

This way it seems to work perfect.

 

 

(vl-load-com)
(setq VTFRXN (vlr-editor-reactor nil '((:VLR-commandEnded . VTF))))


(defun VTF (CALL CALLBACK)
   (if (= (strcase (car CALLBACK)) "SETVAR")
       (progn
          (setq info (getvar 'MODEMACRO)
                info (vl-string-left-trim " /SPI-:1234567890" info)
                info (strcat "SPI- 1:50 / " info)
          )
          (vl-catch-all-apply 'setvar (list "MODEMACRO" info))
       )
   )
)

 

Thank you! Kind regards

Message 17 of 20

C.Utzinger
Collaborator
Collaborator

Hi BeekeeCZ

 

your solution works also, but the grtext doesn't convince me.

 

Thank you anyway.

 

Kind regards

0 Likes
Message 18 of 20

C.Utzinger
Collaborator
Collaborator

HI

 

Some of my users have the following message:

 

Fehler: no function definition: VLR-EDITOR-REACTOR

 

 I could not find the problem why this happens. Perhaps you know a solution for it.

 

 

Best regards

 

 

0 Likes
Message 19 of 20

DannyNL
Advisor
Advisor

Hi,

 

Assuming you did (vl-load-com) on those PC's and other VL-commands like (vlax-get-acad-object) work correctly, I've no idea.

All PC have the latest updates installed for your AutoCAD version?

0 Likes
Message 20 of 20

C.Utzinger
Collaborator
Collaborator

HI

 

I will check the updates.

 

But I remember there was a similar case, and until reinstallation of AutoCAD we could not fix it.

 

 

Thank you

 

Regards

0 Likes