CamBam

Resources => Scripts and Plugins => Topic started by: EddyCurrent on February 02, 2019, 19:32:32 pm



Title: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: EddyCurrent on February 02, 2019, 19:32:32 pm
As requested here; http://www.cambam.co.uk/forum/index.php?topic=7496.msg60260#msg60260
and here; http://www.cambam.co.uk/forum/index.php?topic=7671.msg61488#msg61488

Please find attached a plugin to display the selected object or objects extrema in the Status Bar.

Works with CamBam 0.9.8 and 1.0

When the left mouse button is released, it checks to see if any objects have been selected then displays the extrema.
It works ONLY in the main drawing window, if an object is selected in the left hand Tree View it will not work.

Edit:
Version2 attached.

1. Added a form to select various parameters to display
2. The form is found in menu item, Plugins->ShowExtrema Options
3. Added an option to select number of decimal places for numbers
4. All settings on the form are saved to Windows Registry


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: Dragonfly on February 03, 2019, 11:43:25 am
Your last two plugins add very significant convenience to the work process!
I am one who wanted the constant display of extremas.
IMHO rounding the values to a reasonable number of digits after the decimal point will be good. And I think it will not be difficult.
Many thanks!


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: EddyCurrent on February 03, 2019, 14:17:06 pm
IMHO rounding the values to a reasonable number of digits after the decimal point will be good. And I think it will not be difficult.
Many thanks!

Version2 attached to first post, it should cover all requested requirements.  ;)


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: Dragonfly on February 03, 2019, 16:45:21 pm
We definitely need a "thumb up" and a "standing ovation" smilies  for the forum.
:)


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: Dragonfly on May 16, 2019, 10:59:48 am
Tested today on my Linux version. Works. :)


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: EddyCurrent on May 16, 2019, 11:02:47 am
Excellent, thanks for testing and feedback.


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: Garyhlucas on May 16, 2019, 14:32:38 pm
I have never used extremas. What do you need them for?


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: Mark81 on May 16, 2019, 15:12:44 pm
I have never used extremas. What do you need them for?

To know the dimensions and the positions of the selected item(s).


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: Dragonfly on May 16, 2019, 15:18:15 pm
After I installed this plugin I never used the original 'show extremas'. So much that I had forgotten about it :)  In the Linux version I wanted to see the size of a 3D object and, because I didn't remember the 'show extremas' function, decided to try the plugin and it worked.
I use it to determine the minimum stock size, to place and align objects or groups of objects  at exact coordinates relative to the centroid or the corners of the other, to check the correctness of sizes, etc.
The data is always in front of my eyes and it is very convenient. Just click-select or drag-select object(s).


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: lloydsp on May 16, 2019, 18:36:49 pm
This isn't a criticism of the plugin, which I can see would be VERY valuable in certain design 'regimens'.  But after trying it, I removed it (still have the plugin, in 'case').  I very seldom need to see an object's extremas, and it would be for me a distraction to have them displayed every time I select an object.  I just use the menu version, when I need it.

But, then, I do almost entirely 2.5D tasks.

So... different tastes for different tasks!

Lloyd


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: pixelmaker on May 17, 2019, 10:48:24 am
This is a very helpfull plugin for me.

A translation works only in the Plugin Window, but not in the status bar. Please, if you go over there again, you could correct that.

ralf


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: EddyCurrent on May 17, 2019, 18:56:07 pm
Ralf,

try this version.


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: pixelmaker on May 18, 2019, 11:54:57 am
Thank you, now I can translate it.
It looks as if the width of the display in the status bar is limited and not everything is displayed.

Ralf


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dh42 on May 18, 2019, 21:22:22 pm
Hello

Thanks eddy ..

Same problem as Ralf about display length ..

++
David


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: EddyCurrent on May 18, 2019, 23:00:42 pm
I'm not seeing that problem, can you change to "English" and try it ?
I changed my CamBam to Deutsch, the plugin text is not translated but everything is working okay.


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dh42 on May 18, 2019, 23:26:01 pm
Re

Attached is a picture of both EN and FR ; on both the texts are not complete.

Win7 - 64 ultimate & CB V1 r16

++
David


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: lloydsp on May 19, 2019, 00:14:07 am
Eddy,
My guess is that the German translation is longer than the English.  In any case, I'd suspect that either the string length is not adequate for the German, or that the 'display window' is too narrow.

Lloyd


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dh42 on May 19, 2019, 00:22:43 am
Hello Lloyd

The problem is the same for me with EN version ; if you have a look on the picture, the english text ends with "TopLeft(2" ; (this must be "TopLeft(2D): xx.xx , yy.yy ") and all other corners info are missing.

The max overall text length seems to be the same with all languages.

++
David


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: EddyCurrent on May 19, 2019, 10:38:47 am
This is how it looks for me. (CamBam v1.0 rel.16)

And also to 12 decimal places.

Edit: It also works for me with CamBam 0.9.8

All tested on Windows 10 / 64bit


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: lloydsp on May 19, 2019, 13:00:04 pm
Ok... wow!  Yours works, and nobody else's does!  Is there a setting in CB (that I've never fooled with) that controls the maximum length of a status line message?

Lloyd


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: Bubba on May 19, 2019, 14:00:49 pm
All is well here.. Win10 64bit, CB 1.0 Rel16


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: pixelmaker on May 19, 2019, 21:13:06 pm
It is the same
It's the same in english.
The line is cropped after the dot.
Text Size in Windows (7 64bit) is 100%.
CamBam is V1 R16


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dh42 on May 19, 2019, 21:15:40 pm
Hello

Ralf, what is you OS ?

tested on Win XP and Win 7, CB 0.98 and 1.0, and I get the same result as you on both OS ...

++
David


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: Bubba on May 19, 2019, 22:26:17 pm
That's curious, the plugin act as it should in Win 10,but behaves differently in other os.. ;)


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dh42 on May 19, 2019, 22:35:18 pm
That's curious, the plugin act as it should in Win 10 but behaves differently in other os.. ;)

Yes, I've same kinds of problems with my plugins that sometimes are not working on W10 but works on W7 and XP ... (example, the previous version of NumMove crash on W10 but works on 7 and XP)

++
David


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: EddyCurrent on May 25, 2019, 19:10:57 pm
David,

Visual Studio project attached, maybe you can have a play and see what the problem is ?


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dh42 on May 25, 2019, 19:55:52 pm
Hello Eddy

Just tried ; unfortunately, I can't open the file (.sln) ; It said it as been done on a newer version of visual studio (I use V 2010)

++
David

edit: ah ah ! it open if i use the .csproj file ...


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: EddyCurrent on May 25, 2019, 20:38:54 pm
I'm on VS 2017


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dh42 on May 25, 2019, 20:55:59 pm
Re

Nothing to do ... even with VB script in CB, the text displayed seems to be limited to 127 chars on W7/XP.

The sb.Panels[0].Text variable contain the full text, even if more that 127 chars are used, but only the first 127 are displayed as you can see on the picture with a 200 chars text.

the VB script used.

Code:
' New CamBam VBScript

sub main
    dim sb as System.Windows.Forms.StatusBar = CamBamUI.MainStatusBar
    
    dim tx as string
    
    for n as long = 0 to 199
        tx = tx & "X"
    next n
        
    sb.Panels(0).Text = tx

    app.log("Text length :" & len(tx))
    app.log("Text length in the bar :" & len(sb.Panels(0).Text))  
    
    app.log(tx)
    
end sub

seems it's a W7/XP limitation ...

++
David


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dave benson on May 26, 2019, 01:29:23 am
Hi David.
It's a .net limitation not the os.
Dave.


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dh42 on May 26, 2019, 03:33:19 am
Hello Dave

It's on Win 7 ?

I tried to compile Eddy's code with .net 4.0, and same result, text is truncated too.

++
David


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dave benson on May 26, 2019, 04:29:06 am
Hi David.

Yes Win7 32 Bit, David with Eddy's VS solutions, I have to re-reference the CB .dll's, as I run VS, So that I can run the Debugger ->which automatically compiles the code to the plugin's dir and opens CB and then enters the debugger all at once. I did try to update and roll back the .NET libs for CB ver .98, But no joy I'm afraid.
Perhaps you look at the method that display's the text string in the panel and see if it has an overload.

Dave


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dh42 on May 26, 2019, 21:58:53 pm
Hello

Quote
Yes Win7 32 Bit, David with Eddy's VS solutions, I have to re-reference the CB .dll's, as I run VS, So that I can run the Debugger


Yes, me too (but 7 - 64bits), I remove the reference to net 3.5 and cambam.cad / cambam.geom then I add the reference to the 1.0 dll and the net 4.0 and generate the plugin ...

The result is in attachment ; same result as the version compiled with net 3.5

Quote
Perhaps you look at the method that display's the text string in the panel and see if it has an overload.

I don't know what is it ... ;)

++
David


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dave benson on May 27, 2019, 11:36:22 am
HI David

I got a chance to run the code through the Debugger and using intellisense did some checking, the string is fine both before and after the assignment to the  sb.panels(0).text, (meaning it's a display in the status bar issue) so I tried to see if there was a way to change the panel settings to display the longer text lines but could not find a way to do it. maybe because this is a CB panel\status bar, there might not be a way to increase this value?

Dave


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: EddyCurrent on May 27, 2019, 15:40:40 pm
Put this line in somewhere;

 CamBam.ThisApplication.AddLogMessage("width = " + sb.Panels[0].Width);

On my system I get a width of 2194


There's also, sb.Panels[0].Autosize

Autosize and Width have both a 'get' and a 'set' method.


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dh42 on May 27, 2019, 21:38:18 pm
Hello

Quote
On my system I get a width of 2194

On mine, I get 1554 when the CB windows is used at full screen (my screen resolution is 1920 x 1200 pixels) ... the value is smaller (of course) if I use a reduced window.

Can't find how to use the Autosize ... (I don't know get/set method) ; I tried sb.Panels[0].Autosize = true but I get an error.

++
David




Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: EddyCurrent on May 27, 2019, 22:19:52 pm
My screen is 2560 x 1440

Options for AutoSize are;

sb.Panels[0].AutoSize = StatusBarPanelAutoSize.Contents;
sb.Panels[0].AutoSize = StatusBarPanelAutoSize.None;
sb.Panels[0].AutoSize = StatusBarPanelAutoSize.Spring;

Some info;
https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-set-the-size-of-status-bar-panels

Edit: However, I have two monitors connected so I opened CamBam on the other monitor that is 1900 x 1200 and sb.Panels[0].Width = 1554  ;D

BUT  I'm still not seeing the text being cut off.  ??? maybe it's to do with text size ?


Title: Re: Display Object(s) Extrema in the Status Bar, "ShowExtrema" Plugin
Post by: dh42 on May 28, 2019, 01:11:00 am
Hello,

Quote
maybe it's to do with text size ?

I'm using 120% for text size on my main PC .. but I just test on another PC with Win 7 - 64 and text size = 100% ... and no change.

Also tried the 3 autosize options > no change.

A mystery ...  ???

++
David