Author Topic: MeasureXYZ - same as Measure but gives XYZ offsets too  (Read 21335 times)

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4847
    • View Profile
MeasureXYZ - same as Measure but gives XYZ offsets too
« on: May 26, 2015, 17:57:19 pm »
In response to this post; http://www.cambam.co.uk/forum/index.php?topic=4093.msg28167#msg28167
please find attached a plugin that;

1. Measures length the same as  Tools -> Measure
2. Also shows the XYZ offsets from first point to second point
3. Adds a new menu item, Tools -> MeasureXYZ


Please note, you will not get an updated Z value until you click on the second point.

In response to this thread; http://www.cambam.co.uk/forum/index.php?topic=5213.msg41041#msg41041
I've added a new version that also shows the angle.
If you look at the picture it shows the convention used, also the angle is relative to the frist point selected.

The < symbol is used for "Angle" as it should be universal for different systems.

Edit: new version attached, v4
Has been compiled with .NET version 3.5 assemblies so works with CamBam v0.9.8 and CamBam v1.0

It copies all values to CamBam's Message Log window and from there can be copied to Windows clipboard if desired using this plugin; http://www.atelier-des-fougeres.fr/Cambam/Aide/Plugins/MessageLogCopy.html

If you want to clear the Message Log Window first, use Tools->Clear messages

Edit: 31 March 2020
-------------------

New version attached, ( version 4.1 ) it can be invoked from the menu or SHIFT + M
Tested on 0.9.8 and v1.0 64bit

Edit: 3 April 2020
----------------

Translation code added
Shortcut key text added to menu

version 4.1.1 attached. Tested on 0.9.8 and v1.0 64bit
« Last Edit: April 03, 2020, 08:22:13 am by EddyCurrent »
Made in England

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6680
    • View Profile
    • Cambam V1.0 French Doc
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #1 on: May 26, 2015, 19:30:35 pm »
Hello,

Nice ;)

All the code is in Class1.cs  or there is another file that I don't found ? ... because I really don't understand how that works.  :-[ :'(

Where is the mouse management (mouse down, mouse move etc ..) and the code that draw the rubber line between the 2 points .. ?

++
David

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4847
    • View Profile
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #2 on: May 26, 2015, 19:32:53 pm »
That's all there is  ;D

This line here;

 public class MeasureXYZEditMode : MeasureEditMode
{
}

means  MeasureXYZEditMode 'is derived from' the normal MeasureEditMode, but I added a few things in the OnPaint() method.

http://www.tutorialspoint.com/csharp/csharp_inheritance.htm
« Last Edit: May 26, 2015, 19:40:31 pm by EddyCurrent »
Made in England

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4847
    • View Profile
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #3 on: May 26, 2015, 19:51:21 pm »
David,
Remember I said we needed access to the Display3D to draw 3DIcons ? well we do have access here.


//  add this line in at the bottom.

d3d.DrawIcon(pDrawing, Display3DIcons.Triangle, 10f);

now look at the centre of the rubber band line while you drag it.
10f is the size, so try making it bigger, e.g. 20f

.Circle
.Cross
.Dot
.Square
.Triangle

I've shown the three lines that it should be placed after.

Code: [Select]
d3d.DrawText("X = " + (line3F.p2.X - this._p1.X).ToString("#0.00000"), myfont, CamBamConfig.Defaults.ViewTextColor, CamBamConfig.Defaults.ViewBackgroundColor, (double)(pointF.X + 5f), (double)(pointF.Y + 25f), true);
d3d.DrawText("Y = " + (line3F.p2.Y - this._p1.Y).ToString("#0.00000"), myfont, CamBamConfig.Defaults.ViewTextColor, CamBamConfig.Defaults.ViewBackgroundColor, (double)(pointF.X + 5f), (double)(pointF.Y + 45f), true);
d3d.DrawText("Z = " + (line3F.p2.Z - this._p1.Z).ToString("#0.00000"), myfont, CamBamConfig.Defaults.ViewTextColor, CamBamConfig.Defaults.ViewBackgroundColor, (double)(pointF.X + 5f), (double)(pointF.Y + 65f), true);

d3d.DrawIcon(pDrawing, Display3DIcons.Triangle, 10f);
« Last Edit: May 27, 2015, 07:01:59 am by EddyCurrent »
Made in England

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4847
    • View Profile
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #4 on: May 26, 2015, 20:47:52 pm »
Hang on a minute, I tested this first and thought it was reporting the correct dimensions, I now find it seem to be giving me 1/2 of what it should, I'm removing the attachments until this is sorted out.

Edit: now updated, please let me know if it's working rgiht now.
« Last Edit: May 26, 2015, 21:00:36 pm by EddyCurrent »
Made in England

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1533
    • View Profile
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #5 on: May 26, 2015, 22:14:36 pm »
HI Eddy
Works fine Great Idea could have used this many times over the years.
Dave.

Offline BR52

  • Wookie
  • ****
  • Posts: 362
    • View Profile
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #6 on: May 26, 2015, 23:52:18 pm »
Hello David,

I did not have access to the first "MeasureXYZ.zip" file.
You have a copy of it?
WHAT not understand you talked about Class1.cs  ???

   Armando

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6680
    • View Profile
    • Cambam V1.0 French Doc
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #7 on: May 27, 2015, 13:05:38 pm »
Hello,

Quote
This line here;

 public class MeasureXYZEditMode : MeasureEditMode
{
}

means  MeasureXYZEditMode 'is derived from' the normal MeasureEditMode, but I added a few things in the OnPaint() method.

Ah yes !!! ; It's what I searched for ; the link between your new edit mode and the normal MeasureEditMode !!

I Did not know this ':' operator ... I have to look what is the VB syntax for that ... thanks ;) (if it is possible to do in VB)

And I assume that your OnPaint replaces the one in the MeasureEditMode  ? or is called in addition of the one in MeasureEditMode ?

++
David

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4847
    • View Profile
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #8 on: May 27, 2015, 13:32:46 pm »
David, Yes, in addition,

At the start or end of the, override OnPaint() ,  this line should be included to call the original (base) code.

base.OnPaint(iv, d3d);

I think there is a method with VB but if I were you I'd switch to C# all the time.
« Last Edit: May 27, 2015, 13:36:35 pm by EddyCurrent »
Made in England

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6680
    • View Profile
    • Cambam V1.0 French Doc
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #9 on: May 27, 2015, 13:49:20 pm »
Re

Ok, I look your dll with Reflector and it seems that the VB syntax for

public class MeasureXYZEditMode : MeasureEditMode

is

Public Class MeasureXYZEditMode
    Inherits MeasureEditMode


Hum, and if I try to look the same in ILspy, it works for C but crash if I switch to VB display ..

I often see the 'Inherits' in reflector, but without understand what is it ...

it becomes a bit clearer ... thanks  :D

++
David

Offline coolant slinger

  • Wookie
  • ****
  • Posts: 312
    • View Profile
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #10 on: May 28, 2015, 19:05:17 pm »
Eddy,
Do you have a version that works on 098N?

Offline Jeff_Birt

  • CNC Jedi
  • *****
  • Posts: 821
    • View Profile
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #11 on: May 28, 2015, 19:22:18 pm »


I often see the 'Inherits' in reflector, but without understand what is it ...

it becomes a bit clearer ... thanks  :D

++
David

'Inherits' means that you are building on a base class.
Code: [Select]
Public Class MeasureXYZEditMode
    Inherits MeasureEditMode

The class 'MeasureXYZEditMode' builds upon the base class 'MeasureEditMode'. Think of it like a tangible object. You want to build a custom car and start out by buying a Ford Fiesta (your base car). There are things about the base car that are fixed and not possible to change and things that are possible to change.

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6680
    • View Profile
    • Cambam V1.0 French Doc
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #12 on: May 28, 2015, 19:38:41 pm »
Hello,

Ok Eddy, thanks for explanations ;) ...

And for the N version, It's the same problem with the DimArrow plugin, the reason is that the MeasureEditMode Class does not exists in N dll's.

@coolant slinger, why you always use the N .. ? the P beta2 works well .. and will be set as 'stable version' in some days.

++
David

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4847
    • View Profile
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #13 on: May 28, 2015, 19:45:38 pm »
Hello,

Ok Eddy, thanks for explanations ;) ...


I think you mean Jeff   ;)


@coolant slinger, why you always use the N .. ? the P beta2 works well .. and will be set as 'stable version' in some days.

I like the sound of that  ;D

Also @coolant slinger, no sorry I don't have a version for N

From here; http://www.cambam.info/downloads/

It looks like bugs in N version were fixed in P so even more reason to upgrade.
« Last Edit: May 28, 2015, 19:50:31 pm by EddyCurrent »
Made in England

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6680
    • View Profile
    • Cambam V1.0 French Doc
Re: MeasureXYZ - same as Measure but gives XYZ offsets too
« Reply #14 on: May 28, 2015, 20:04:41 pm »
Quote
I think you mean Jeff   ;)

Oh yes, sorry guys... I still have paint in the eyes   ;D !! (5 painted walls, 2 remaining)

++
David