Author Topic: Zoom to box  (Read 24169 times)

Offline Rodneyk

  • Droid
  • **
  • Posts: 62
    • View Profile
Zoom to box
« on: January 12, 2013, 18:48:00 pm »
Update 01/18/2013 @ 2224pst Version 1.4.

This plugin adds Zoom functionality. Two new buttons will appear in the UI. One for zooming with a marquee, and the other will zoom to fit the selected objects. It works best in top down view since it relies on screen coordinates.  I wrote this because I saw someone else request it.

To install the plugin unzip the files and copy them into the plugins directory.<br>
            This is normally found at :C:\Program Files (x86)\CamBam plus 0.9.8\plugins

The plugin installs an icon on the UI that looks like a magnifying glass and a
        menu item on the view menu. The plugin also has a hotkey <ALT>+Z.

Read the included helpfile for details and latest revisons.

Good luck.
« Last Edit: January 19, 2013, 05:56:16 am by Rodneyk »

Offline Dragonfly

  • CNC Jedi
  • *****
  • Posts: 2425
    • View Profile
Re: Zoom to box
« Reply #1 on: January 12, 2013, 19:41:02 pm »
I am the one requesting the magnifying glass tool and I'll give it a try. Many thanks.

Offline pixelmaker

  • CNC Jedi
  • *****
  • Posts: 1799
    • View Profile
    • pixelmaker
Re: Zoom to box
« Reply #2 on: January 12, 2013, 21:37:04 pm »
Thank you for this great plugin.
Only the color of the ZoomIcon I change a bit ;-) Look a bit like a piece of candy there.

One wish, perhaps for the second release: I would prefer a place for the button in the "view-section" of the toolbox, beside Grid and axis, like in the attachment.

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8394
    • View Profile
Re: Zoom to box
« Reply #3 on: January 12, 2013, 21:47:54 pm »
Works great! Tastes fine.  Less filling!

Thanks for a good one!

(ps... can you post the source?  I'm slowly working my way up from scripts to plugins ;))

LLoyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline Rodneyk

  • Droid
  • **
  • Posts: 62
    • View Profile
Re: Zoom to box
« Reply #4 on: January 12, 2013, 23:49:17 pm »
Updated the plugin with the requested changes - See initial post for the updated zip file.

I am sharing the source, but please don't complain it you don't like the style. I hacked this together in less than an hour and did not really consider sharing the source when I did it. It is using undocumented behaviors in the cambam interface.

Essentially there are two classes, the Zoom class and the ZoomEditMode class. The magic is all in the ZoomEditMode class which basically takes over control of the IO and impliments the basic behavior of the zoom box. 

Use of the Editmodes is a VERY powerful undocumented feature of Cambam.  They basically made it possible to do almost anything by exposing this interface. With great power comes great responsibility. If you choose to play with custom edit modes you have been warned. The edit mode interface has not been documented and you have to figure it out yourself.  This plugin shows ONE way to use it, but not necessarily the best way. If you play with custom edit modes and the interface changes you will likely have to re-write the code in the future.

I will not be held responsible for any damage you may do you your system or software by using the sample code to build plugins.

I hope you enjoy.

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8394
    • View Profile
Re: Zoom to box
« Reply #5 on: January 12, 2013, 23:58:44 pm »
I will treat it with suitable caution, and would NEVER chide someone about their programming style.

I was a professional firmware programmer for decades, and raled about others' styles and documentation.  But now, with object-oriented languages, I'm a pure amateur -- any style that works is good enough for me (well... maybe I'm a stickler for proper indentation, but that's about all)!

Thanks for your contributions.

Lloyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline blowlamp

  • CNC Jedi
  • *****
  • Posts: 1183
    • View Profile
Re: Zoom to box
« Reply #6 on: January 13, 2013, 11:39:44 am »
Thanks for making this plugin  :)

I'm getting an error message as shown in the picture... However, I am running Windows 8, so this may be the cause.

Thanks again.


Martin.
« Last Edit: January 13, 2013, 11:41:17 am by blowlamp »

Offline pixelmaker

  • CNC Jedi
  • *****
  • Posts: 1799
    • View Profile
    • pixelmaker
Re: Zoom to box
« Reply #7 on: January 13, 2013, 14:01:33 pm »
Hello Rodneyk,

thank you for updating the plugin. But when I replace the dll file nothing arrives in cambam. Also the shortcut don´t work (0.9.8.rc7 on win7 ultimate)
Also, the new and the old version are only different in the date, not in the version number (both have 1.0.0.0). I prefer to link a new version under a new link and not to change the first link. A version controll is in this case not possible, and in the case I replace the dll with the new one I can´t dl again the old one for going back. I think a version controll is  fundamental when programing.
But I like this plugin and now have to live with the candy button ;-)


ralf

Offline Rodneyk

  • Droid
  • **
  • Posts: 62
    • View Profile
Re: Zoom to box
« Reply #8 on: January 13, 2013, 15:27:00 pm »
I use version control. I put the code together quickly and just forgot to put the version constant into the Assembly.cs attributes so the version is not shown in the file manager correctly.

I am looking into what is making the DLL not load correctly and will post an update shortly.

Hello Rodneyk,

thank you for updating the plugin. But when I replace the dll file nothing arrives in cambam. Also the shortcut don´t work (0.9.8.rc7 on win7 ultimate)
Also, the new and the old version are only different in the date, not in the version number (both have 1.0.0.0). I prefer to link a new version under a new link and not to change the first link. A version controll is in this case not possible, and in the case I replace the dll with the new one I can´t dl again the old one for going back. I think a version controll is  fundamental when programing.
But I like this plugin and now have to live with the candy button ;-)


ralf

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8394
    • View Profile
Re: Zoom to box
« Reply #9 on: January 13, 2013, 16:00:37 pm »
It works fine on my setup.  I noticed that most .dlls go in the program folder, but this one goes in the plug-ins folder.

I know this is a stupid question to ask of Ralf, who is more experienced than I; but... did you put the .dll in the plug-ins folder?

LLoyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline Rodneyk

  • Droid
  • **
  • Posts: 62
    • View Profile
Re: Zoom to box
« Reply #10 on: January 13, 2013, 16:26:00 pm »
I cannot explain why the dll does not load on some systems but I one thing I found when investigating is that at some point yesterday while developing a different plugin (the centroid plugin for complex objects) VS restarted due to an error. When this happened some of the settings of the projects were not saved so VS was not compiling the plugin to where I normally package them. Meaning it is entirely possible that what I put in the .zip file was a version that had not been tested. (I hate that about VS that some settings are not saved until the solution is closed - I have multiple projects in that same solution).

Anyways. I added more error handling and a few minor tweaks/improvements like making the version number reflect in the file info page and some general code cleanup.

As always use at your own risk. I have tried to make sure it is functioning as is should, but let's face it you are the testers :)

If you encounter error please let me know.  It should work on Win7 (that is what I am testing using today) and that is nothing to stop it from working on Win8.

This was developed with the developement release, not the stable release.

Offline pixelmaker

  • CNC Jedi
  • *****
  • Posts: 1799
    • View Profile
    • pixelmaker
Re: Zoom to box
« Reply #11 on: January 13, 2013, 16:39:14 pm »
Quote
Anyways. I added more error handling and a few minor tweaks/improvements like making the version number reflect in the file info page and some general code cleanup.

And where I can find it?

ralf

Offline Rodneyk

  • Droid
  • **
  • Posts: 62
    • View Profile
Re: Zoom to box
« Reply #12 on: January 13, 2013, 16:44:03 pm »
The new on is at the on the first post (I updated the post).

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6307
    • View Profile
    • Cambam V1.0 French Doc
Re: Zoom to box
« Reply #13 on: January 13, 2013, 17:52:49 pm »
Hello,

Thanks for this plugin, very usefull  ;D

++
David

Offline Dragonfly

  • CNC Jedi
  • *****
  • Posts: 2425
    • View Profile
Re: Zoom to box
« Reply #14 on: January 13, 2013, 20:39:17 pm »
Great!
Finally I tested it too and it is exactly what I needed as described in my feature request.