How to create a display tool for a current variable value?

How to create a display tool for a current variable value?

rapidcad
Collaborator Collaborator
3,031 Views
24 Replies
Message 1 of 25

How to create a display tool for a current variable value?

rapidcad
Collaborator
Collaborator

Hi everyone, I felt like I needed to proceed with this post even though I didn't research it much - because I'm not really sure how to describe it so here we go!

 

I am setting up a system of controlling a faux elevation property - one that only holds the value as a (real) variable (not actually using the AutoCAD elevation property due to users - some outside of our organization - experience level with 3D concepts). I am placing dynamic blocks which will have attributes and properties that adopt the current value of this "elevation" variable and calculate through lisp programs during insertion, what size support dynamic blocks will need to have their height range settings set to in order to hold our equipment at the right level. I already have a system to read the blocks in the drawing and collect their properties and set the new block properly to go with it.

 

What I want to do is find a way to have a button in a toolbar, tool palette or ribbon panel that could display the current value of this elevation variable. It would work just like the current layer or current dimstyle or current color control toolbar object. I'd like it to be a real-time editable button to always be in the user's interface to display the current value of my elevation variable and even change it on the fly. I would assume that .net has ways of doing this, but we are restricted to lisp methods since many users are outside the organization and using AutoCAD 2010 and anything newer.

 

Any ideas?

ADN CAD Developer/Operator
0 Likes
3,032 Views
24 Replies
Replies (24)
Message 21 of 25

rapidcad
Collaborator
Collaborator

Thanks again Scott. I eventually figured out that my troubles were that I had forgotten most of what I knew about DIESEL. Once I opened up the Customization Guide I was given enough examples of usage that I began to see some mistakes in my previous attempts.

First off, the examples put a space after commas, so I started doing so also. I saw that I could enter text first, then follow with $calls to code without codifying the text with a string command of any kind. But what I found worked for me best was the following..

$(eval, "TOR Elevation:
" $(rtos, $(getvar, USERR1), 2 , 6 ))

In the actual text of that code I placed a \n after the colon and used that for the Name of my Ribbon tool and here's what displays:

CaptureELEV.JPGCaptureELEV1.JPG

Whenever you place a \n into CUI names they show up in the editor when you type them in, but once you save the changes, the \n disappears from the editor but the newline actuaction does take place - so you don't see my \n in the picture above, but it is there.

It looks exactly what I want but alas, I am not able to get the ribbon tool to update to the current value of USER1 without going back into the CUI editor, so the setvar value does get updated, but the ribbon doesn't like live updating apparently - unless there is some way to force it to do so. Apparently there is some way, because selecting various AutoCAD commands forces various ribbon changes.

The pull-down menu (MENUBAR) does update continuously with exactly the same code, as does the MODEMACRO status bar element.

CaptureELEV2.JPG CaptureELEV3.JPG

if I could find a way, I'd like that ribbon tool to update, but if it isn't exposed to our tinkering, then I'll have to accept that. You've certainly gotten me a lot farther than I thought I'd get on this idea.

 

Oh, and BTW John, you've been drinking too much wine again - those are salad dressings, not functions!  Smiley Happy

ADN CAD Developer/Operator
0 Likes
Message 22 of 25

john.uhden
Mentor
Mentor

Okay, okay.  I'll have to develop a ranch function.

John F. Uhden

0 Likes
Message 23 of 25

scot-65
Advisor
Advisor
When the ribbon came out, and I started investigating,
I quickly discovered that it is only a glorified toolbar.
Plus it took up valuable space on the UI (before collapsing
came out). I had my doubts that it could perform "real-time"
updates like the menu bar can. The ribbon was even
stubborn enough to give me a hard time when starting
a new "container" that has only text inside. I shifted my focus
and never looked back.

Have you tried to place your line inside the "Other"
container? I know it will be hidden from plain view,
but I would be curious if it does update at this location?

Another thought is to begin a new menu bar column.
You would have to declare at least one line in it's pull-down,
but at least the value would be visible?

And yet another thought...
Expand the block of code that sets USERR1 to unload, then
reload an enterprise menu that only consists of this ribbon
category?

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 24 of 25

rapidcad
Collaborator
Collaborator

Some nice thinking outside the box there, scot. No, when I try to put the name of the ribbon panel in as code, all it does is treat the code as text. The result is the same for "Name" and "Display Text"

Capture4.JPG

Nice try though.

And when I try to rename the pull-down menu itself as code, no evaluation either, but the menu within it still works when you select it....

Capture5.JPG

What's interesting though, is that the same code will evaluate in the Customizations Pane of the CUI editor, just like the pull down menu evaluates in the same pane and on screen when dropping down is selected. But it is a no-worky when it comes to displaying on screen as a menu name. adding the code to Description did not help either..

Capture6.JPG

I also tried the same code as a substitution for an Icon, in the ribbon tool, a toolbar and a tool palette tool, but it doesn't evaluate, it just produces no image at all.

 

Yes, I could try this as a standalone CUI menu with only a name and  put the code in as the display text of the ribbon TAB, but that also does not evaluate.

Capture7.JPG

You have got me thinking though. If the CUI itself is XML, maybe I could use my XML editor to "Hack" it to get the job done... I've successfully hacked tool palettes before, but never departing form the structure of the categorical code within them, only replacing names of block paths and that sort of thing. I'd have to try on a copy I could wreck since success has a slim chance.

 

ADN CAD Developer/Operator
0 Likes
Message 25 of 25

scot-65
Advisor
Advisor
Looking at what you have,
I would try reducing the display to just the $(getvar,USERR1)
and go from there. If you need to reduce the decimal places,
then take the variable and convert to a string, then assign
USERS1 instead:
$(getvar,USERS1)

Diesel does not care if reals and integers are displayed "as is",
meaning one does not need to convert to a string.

Another thought is to turn off and then back on the primary
tab (container), as shown inside the CUI (green checkbox, top-left
pane after selecting the "Customize Workspace" button) in order
to invoke a refresh, but I do not know how to program this though.

Another idea is switch workspaces out, then back in where the
second workspace has the tab turned off?
(I was hinting earlier to try isolating that tab as a separate,
enterprise CUI - not sure if you understood that...).

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes