Extracting Coordinates From Nulls

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Display Modes
  02 February 2018
Extracting Coordinates From Nulls

Sounds like it should be easy. Does anyone know how to extract the world coordinates from multiple nulls?

Alternatively - Does anyone know how to thread a spline through multiple null points to create a path?

Thanks!
 
  02 February 2018
Originally Posted by Trauts23: Sounds like it should be easy. Does anyone know how to extract the world coordinates from multiple nulls?

Alternatively - Does anyone know how to thread a spline through multiple null points to create a path?

Extract where? Coordinate manager? XPresso? Python? C++?
(The trivial answer is "select object, look into coordinate manager under "World"" but I suppose that is not your goal.)

For the spline, you can link the nulls to the points of the spline through XPresso, but there are restrictions: you need to define the tangents somehow (either through their own nulls or through calculation, or you use a tangent-less spline type), and the nulls would need to coincide with spline points. Controlling the position of arbitrary spline segments apart from control points through separate nulls may be a tad difficult.
 
  02 February 2018
Apologies for the lack of info.

I'd ideally like a list of the null coordinates. Either in a text file. Or as a ASCII data that usually appears in the 'structure' tab (when points of a spline are selected).

Cheers.
 
  02 February 2018
I still don't see what you're working at. A Python script? A C++ plugin?

Naturally, as long as you have a programming language, you can put your data into a text file or a text box in a user data GUI, and then parse the content into xyz coordinates and apply it to the spline. But you'd need to program your parser for the desired format. (Applying is easy but for arbitrary splines you may need to look out for the segmentation!)

If you want an XPresso solution, you could put the nulls into a selection object and then address the in/exclusion list in the XPresso to extract the global positions of the nulls. Then you feed these into a spline point: First, feed the Selection's List output into an ObjectList node's Iteration List input. Then use the Instance output to access the elements of the selection. (I'm not sure about the spline points, you may need to look that up elsewhere.)
 
  02 February 2018
okay, I just was curious and checked:

Start with a Selection object containing all the nulls you want.
Drag selection object into the XPresso editor, also one of the Nulls to create a node of the correct type.
Create an Object List node.
Create an Object Index node.
Connect Selection node output List to Object List input Iteration List.
Connect Object List output Instance to Null node Object input.
Connect the same output to Object Index node Instance input.

Now drag your Spline into XPresso editor. Create a Point node.
Connect:
- Spline output Object to Point node input Object.
- Object Index output Index to Point node input Point Index
- Null node output Global Position to Point node input Point Position.

That's it already. Your Null list will now control the spline's points.
Feel free to refine the XPresso.
 
  02 February 2018
another possible solution.
Put all the nulls as children of the XPRESSO null, and open the Console from the "Script" menu.
Clear the Console (top right "x" button) and press "G" on your keyboard to advance 1 frame.
Now you have all the Global XYZ coordinates. Copy and Paste!

https://www.dropbox.com/s/u9y4gpn18...%2001A.c4d?dl=0
__________________
Follow me on Twitter@nosemangr - Watch me on Noseman's Youtube Channel
 
  02 February 2018
Select your object, open the console (shift + F10) write op.GetMg().off => Enter and you got your global coordinate.
op is a variable pointing to the current selected object. Wich will return you a BaseObject
GetMg() will return you the global matrix of this object.
A matrix is an object that hold position, rotation and scale.
.off parameter correspond to the translation in the space (aka the position from 0,0,0 the origin of the scene since we are speaking of a global matrix)

Hope it's help
__________________
http://graphos.xyz/
https://github.com/gr4ph0s

Last edited by gr4ph0s : 02 February 2018 at 09:31 PM.
 
  02 February 2018
You could also put all your nulls in a tracer object, and set the Tracing Mode to either "Connect Elements" or "Connect All Objects" (not sure which one, and that will generate a spline for you.
 
  03 March 2018
Totally forgot to thank everyone for all the help.

Really appreciate your input guys! Thank you!
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 11:59 AM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.