Author Topic: Plugin to find Z level of a surface at the cursor position  (Read 11685 times)

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5262
  • Made in England
    • View Profile
Plugin to find Z level of a surface at the cursor position
« on: October 06, 2018, 16:48:30 pm »
Please find attached plugin, tested on both CamBam v0.9.8 and CamBam v1.0

Press the lower case 'z' ( and keep it pressed) while moving the mouse over a surface, no need to click any mouse buttons.
Displayed in the bottom message window will be the Z value of a surface point that is directly under the mouse cursor.

Remember you will likely have to 'unblock' it; http://www.cambam.co.uk/forum/index.php?topic=6294.msg50090#msg50090


Edit:
Version 3 attached

Tested on CamBam 0.9.8 and 1.0

It should work on;

Polyline
Polyrectangle
Circle
Arc
Spline
Pointlist
Surface

A simple test file is also attached.

For the Pointlist you have to zoom in quite close then wiggle the mouse over a point until it is detected.
« Last Edit: October 29, 2018, 17:20:35 pm by EddyCurrent »
Filmed in Supermarionation

Offline dwc

  • CNC Jedi
  • *****
  • Posts: 549
    • View Profile
    • corson.ch
Re: Plugin to find Z level of a surface at the cursor position
« Reply #1 on: October 06, 2018, 18:17:14 pm »
Hi Eddy,
Great idea. I assume it works with stl surfaces, will it for from a step model too?
If it does I would finally see a reason to use the step import.
Thanks,
Don
« Last Edit: October 06, 2018, 18:28:14 pm by dwc »

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3355
    • View Profile
Re: Plugin to find Z level of a surface at the cursor position
« Reply #2 on: October 06, 2018, 19:01:44 pm »
Thanks Eddy. I'm sure find use for it.
My 2ยข

Win11, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, 4th Axis, Endurance Laser.

Offline Bob La Londe

  • CNC Jedi
  • *****
  • Posts: 4484
  • ^ 8.5 pounds on my own hand poured bait.
    • View Profile
    • CNC Molds N Stuff
Re: Plugin to find Z level of a surface at the cursor position
« Reply #3 on: October 13, 2018, 16:45:23 pm »
I will have to try this one out soon.  It will save me a great deal of time laying out molds since I am often working with cavities generated from organic shapes.  Often in the past I had to go back to the source CAD file and take slices to find thickness/depth.  Hopefully my design computer is fast enough to use it effectively. 
Getting started on CNC?  In or passing through my area?
If I have the time I'll be glad to show you a little in my shop. 

Some Stuff I Make with CamBam
http://www.CNCMOLDS.com

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8969
    • View Profile
Re: Plugin to find Z level of a surface at the cursor position
« Reply #4 on: October 13, 2018, 18:29:54 pm »
Eddy,
I installed the unzipped .dll in my 9.8 plugins folder, and unblocked it.

I get nothing, and don't remember how to tell what plugins are actually active in a session.

FWIW, I'm running 9.8 under XP-pro.

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

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5262
  • Made in England
    • View Profile
Re: Plugin to find Z level of a surface at the cursor position
« Reply #5 on: October 13, 2018, 19:33:22 pm »
Please find attached to the first post, version 2, it's optimised as far as I can.
You may find it faster if 'snap to object' is OFF

Don,

Yes it works on STL surfaces but It does not appear to work on STEP files.
I'm using an internal CamBam function to get the Z value so I have no real control over it's operation.

Lloyd,

You won't see it any menu.
The keyboard 'Z' key acts as a 'push to make' switch, the plugin works only when the 'switch' is ON.
While keeping that key depressed, move the mouse over a surface you created or loaded first.
Z values will appear in the bottom log window, they appear as fast as you move the mouse to a new coordinate, so if your PC is on the slow side, move the mouse slowly or release the 'z' key while you move to another area of interest on the surface.
« Last Edit: October 13, 2018, 19:47:49 pm by EddyCurrent »
Filmed in Supermarionation

Offline Bob La Londe

  • CNC Jedi
  • *****
  • Posts: 4484
  • ^ 8.5 pounds on my own hand poured bait.
    • View Profile
    • CNC Molds N Stuff
Re: Plugin to find Z level of a surface at the cursor position
« Reply #6 on: October 13, 2018, 20:41:50 pm »
Step files are imported as a bunch of mesh elements.  It should work. 
Getting started on CNC?  In or passing through my area?
If I have the time I'll be glad to show you a little in my shop. 

Some Stuff I Make with CamBam
http://www.CNCMOLDS.com

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8969
    • View Profile
Re: Plugin to find Z level of a surface at the cursor position
« Reply #7 on: October 13, 2018, 21:17:18 pm »
Eddy, I understood all that.  But I might have not understood one thing.

Does this only work on 'surfaces', but not on drawing objects?

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

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5262
  • Made in England
    • View Profile
Re: Plugin to find Z level of a surface at the cursor position
« Reply #8 on: October 13, 2018, 21:19:41 pm »
Title of thread = "Plugin to find Z level of a surface at the cursor position"   ;)

not on other entities
« Last Edit: October 13, 2018, 21:28:16 pm by EddyCurrent »
Filmed in Supermarionation

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8969
    • View Profile
Re: Plugin to find Z level of a surface at the cursor position
« Reply #9 on: October 13, 2018, 21:30:09 pm »
I understood the name, but for some reason thought it might work on all primitives (at least hoped so!).

Lloyd
« Last Edit: October 13, 2018, 21:37:13 pm by lloydsp »
"Pyro for Fun and Profit for More Than Fifty Years"

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8969
    • View Profile
Re: Plugin to find Z level of a surface at the cursor position
« Reply #10 on: October 13, 2018, 21:36:22 pm »
And it works fine on a surface.

(I wish it worked on any primitive!  I have a number of files where defining elements are down below Z, and rotated from flat.)

Thanks, Eddy!

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

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5262
  • Made in England
    • View Profile
Re: Plugin to find Z level of a surface at the cursor position
« Reply #11 on: October 13, 2018, 21:39:01 pm »
I'll change the code and try other entities

Edit: No, the CamBam function, GetZAtPoint, works with Surfaces only.
« Last Edit: October 13, 2018, 21:44:37 pm by EddyCurrent »
Filmed in Supermarionation

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8969
    • View Profile
Re: Plugin to find Z level of a surface at the cursor position
« Reply #12 on: October 13, 2018, 21:58:03 pm »
Well, thanks for trying!

Andy!  Oh, ANDY!  ;)

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

Offline Dragonfly

  • CNC Jedi
  • *****
  • Posts: 2652
    • View Profile
Re: Plugin to find Z level of a surface at the cursor position
« Reply #13 on: October 14, 2018, 10:05:02 am »
While we are at it I'd very much like to have something like what I drew on the attached picture.
An information function displaying coordinates and size of a selected object or a group of objects.  Anchor point (corners or center of selection) is selected by the user.
It can be incorporated in the toolbar, the status bar, a docker or a floating window. It will be very helpful when positioning objects relative to machining coordinates origin when doing CAM preparation work.
Such functionality is implemented one way or another in many drawing programs.
'Get object extremas' works but why it must be called explicitly every time when it can be always active when at least one object is selected?

(Side note: If, eventually,  David adds anchor point selection to the absolute coordinate positioning in his 'Num muve' plugin it will be invaluable. :)  'Num move' and 'Aligner' are the most used by me plugins and I can't imagine now working without them.)
(Side note 2: CamBam's 'Align' function actually does the absolute positioning and perhaps the coordinate info with selectable anchor points can be incorporated into it. So that the user can enter the needed values based on that info.)

On the attached picture I need to move all objects so that the upper left corner of the selected rectangle is at X/Y 0/0. Currently I have to read the rectangle lower left corner coordinates and it size, then do some calculations in my head or with a calculator to determine the coordinates of the upper left corner,  and then do a move or align entering the calculated value. By selecting the upper left corner and reading its coordinates from the info window I can enter the movement value without much hassle.
And those are action every one of us does constantly while working on a project.

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5262
  • Made in England
    • View Profile
Re: Plugin to find Z level of a surface at the cursor position
« Reply #14 on: October 14, 2018, 10:39:53 am »
Until then, did you try this plugin ? http://www.atelier-des-fougeres.fr/Cambam/Aide/Plugins/CBubble.html

What you propose is okay but what happens when there are many points in the object ? as you say David's plugin with anchor points is the best answer.
« Last Edit: October 14, 2018, 10:42:52 am by EddyCurrent »
Filmed in Supermarionation