Script for X,Y,Z coordinates?

Next
 From:  Michael T. (MICTU_UTCIM)
7457.1 
Has anyone written a script that would display the x,y,z, coordinates of say a selected point?

I know I can use the CustomDistance script from the origin point, but I was just curious to see if something else existed.







Thanks,

Michael T.
Michael Tuttle a.k.a. mictu http://www.coroflot.com/DesignsByTuttle
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
7457.2 In reply to 7457.1 
Seems you can see them on middle bottom screen ? :)
Just move the mouse on other window for see the Z ! ;)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael T. (MICTU_UTCIM)
7457.3 In reply to 7457.2 
Thanks Frenchy.

Still not quite what I was thinking.

I can use the CustomDistance script.

Michael T.
Michael Tuttle a.k.a. mictu http://www.coroflot.com/DesignsByTuttle
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
7457.4 In reply to 7457.1 
Hi Michael T.

My amateur answer:

This would be very easy to do.
Code extracted from existing scripts:

var pointpicker = moi.ui.createPointPicker();

if ( !GetPoint( pointpicker ) )
return;

var PickedPt = pointpicker.pt;

Then do an Alert with
PickedPt.X
PickedPt.Y
PickedPt.Z

It would probably take me an hour, or a week :-)

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
7457.5 In reply to 7457.4 
Here is my humble offering:
PointCoordinates script, modified from the Points script.

- Brian

EDIT: This script is faulty. It does not work when (various) snaps are off.
So the script may be deleted or fixed...(?)

Edit 3/10/2016: See updated script at message 7457.13, below.

EDITED: 10 Mar 2016 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
7457.6 In reply to 7457.5 
I am affraid that you must make an another Alert message
when user select more or less than only one point! ;)
---
Pilou
Is beautiful that please without concept!
My Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
7457.7 In reply to 7457.6 
? I do not see a problem.
- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
7457.8 In reply to 7457.7 
When you select 2 points or more or nothing and call the function!
Nothing is done and you don't know why! ;)
An Alert message must say "Select just one point! "
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
7457.9 In reply to 7457.8 
Hi PILOU
No problem when snaps are all on.
There seems to be a problem when snaps are off.
I'll note that the script in the zip is faulty.

-Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael T. (MICTU_UTCIM)
7457.10 In reply to 7457.9 
Thanks Brian!

Michael T.
Michael Tuttle a.k.a. mictu http://www.coroflot.com/DesignsByTuttle
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
7457.11 In reply to 7457.10 
Here is a script Michael wrote awhile back that gets things on the clipboard.... Maybe someone wants to modify it to output with an html label or something....

code:
 code:// Gather up a list of the x,y,z coordinates of point objects and endpoints of
// curves and copy the list as text to the clipboard.

var str = '';

function AddNumber( num )
{
	// Use 6 decimal places.
	str = str + num.toFixed(6);
}

function AddCoordinate( pt )
{
	AddNumber( pt.x, str );
	str = str + ",";
	AddNumber( pt.y, str );
	str = str + ",";
	AddNumber( pt.z, str );
	str = str + "\r\n";
}

var pts = moi.geometryDatabase.getSelectedObjects().getPoints();
for ( var i = 0; i < pts.length; ++i )
{
	var ptobj = pts.item(i);
	AddCoordinate( ptobj.pt );
}

var crvs = moi.geometryDatabase.getSelectedObjects().getCurves();
for ( var i = 0; i < crvs.length; ++i )
{
	var crv = crvs.item(i);
	AddCoordinate( crv.getStartPt() );
	AddCoordinate( crv.getEndPt() );
}

moi.copyTextToClipboard( str );

EDITED: 20 Jun 2015 by BURRMAN

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
7457.12 
No more developpment ? :)
---
Pilou
Is beautiful that please without concept!
My Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
7457.13 In reply to 7457.12 
Here is an update for PointCoordinates script.

It was necessary to search for Snap documentation. The .js has two links to forum posts which proved helpful.

The state of the ObjectSnap button, and the button's SnapPt checkbox are saved, then they are both turned on or left on.
After one point is selected, they are both restored to their initial state.
(If the Cancel button is pushed before selecting the point, both are left active, which may not be their initial state, and the script terminates.)

After selecting a point, the script displays an alert of the x, y, z coordinates, hard coded to 6 decimal points.

Selecting in 3D view should help avoid confusion of points on top of each other in the other views.

- Brian

EDITED: 10 Mar 2016 by BEMFARMER


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  bemfarmer
7457.14 In reply to 7457.13 
Added in part of Michael's code for placing the coordinates in the clipboard.
Max's z88 program uses the clipboard.
Added parseFloat to remove trailing decimal zero's.

This script only does one point, which suits my current project for pasting to excel, but
perhaps the ability to add multiple points should be added.

- B

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All