instance Target Spot

Become a member of the CGSociety

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

Thread Tools Search this Thread Display Modes
Old 03 March 2012   #1
instance Target Spot

Hi guys,
I'm trying to create instances of a "target spot" that is selected through a pickbutton but I have difficulty in creating the instances with its relative target.
Can you help?
Old 03 March 2012   #2
Use "maxOps.cloneNodes".
For example, with just the spot selected, this code works :

maxOps.cloneNodes $ clonetype:#instance
Old 03 March 2012   #3
Thanks MrPingouin for your help
the command works perfectly
but now, how can write a different position for the new object instantiated?
I saw that there is only the "offset" parameter in the function maxOps.cloneNodes
Old 03 March 2012   #4
Just store the cloned nodes to an array. Then from there you can just call up those objects whenever you want and do whatever you want to them.
____________ ___ __ _
John A. Martini
Old 03 March 2012   #5
Currently i have solved my problem in this way:

maxOps.cloneNodes SelectedOBJ clonetype:#instance newNodes:&nnl 
nnl.position = [0,0,0]

Now I do not know how to control even his relative target

Last edited by Skylab82 : 03 March 2012 at 05:43 PM.
Old 03 March 2012   #6
The variable nnl returned by line:
maxOps.cloneNodes SelectedOBJ clonetype:#instance newNodes:&nnl
is an array. It might be an array with only one element but it is still an array. So you should use:
nnl[1].position = [0,0,0]
to set position of the light.

Then you can change the position of the light's target with:
nnl[1].target.position = [100,0,0]
or if you want to set the position of the target relative to the light then:
nnl[1].target.position = nnl[1].position + [100,0,0]
Old 03 March 2012   #7
check the full signature of clonenodes :

maxOps.CloneNodes <&node array>nodes offset:<point3> expandHierarchy:<boolean> cloneType:<enum> actualNodeList:<node array> newNodes:<node array>

The positional offset that will be applied to the cloned nodes.

so providing a point3 value will offset the clones nodes automatically!

Which means you can do really useful stuff like create an army of teapots: :-)

	delete $*GridifyClone_*
	t = Teapot radius:2.0 wirecolor:yellow prefix:"GridifyClone_"
	select t
	--specify the grid size
	Ngrid = 4
	Numclones = 33
	for d = 1 to Numclones do
        --grab the bounding box of the selection
	Bounds = (selection.max- selection.min)	
	--calculate the offset according to the grid
	offset = -[(Bounds.x * (mod d Ngrid)), (bounds.y * floor (d/Ngrid)), 0]
	maxops.clonenodes (selection as array) actualNodeList:&OrigNodes newNodes:&ClonedNodes offset:offset

But obviously if you removed the first three lines and ran this with a light and target selected, it would clone them correctly with an offset. It's just that I like teapots more than I do lights.

Read my technical blog -

Last edited by LoneRobot : 03 March 2012 at 11:16 AM.
Old 03 March 2012   #8
if you are using maxops.clonenodes with expandHierarchy:on you don't need to select the target. only light might be selected. the same behavior is for all nodes with defined target.
Old 03 March 2012   #9
Thank you all for your help
Old 03 March 2012   #10
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed 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
Society of Digital Artists

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

All times are GMT. The time now is 08:05 PM.

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