Extracting Coordinates From Nulls


#1

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!


#2

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.


#3

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.


#4

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.)


#5

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.


#6

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/u9y4gpn18vgt7he/Global%20Coords%20to%20Text%2001A.c4d?dl=0


#7

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 :slight_smile:


#8

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.


#9

Totally forgot to thank everyone for all the help.

Really appreciate your input guys! Thank you!