Create Null as Parent at First Point of a Curve

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  05 May 2010
Create Null as Parent at First Point of a Curve

As the title says. This was handy for the logo I imported from AI. Works on multiple curves.

/*--------------------
    User Input
    --------------------*/
    var oRoot = Application.ActiveProject.ActiveScene.Root;
    var oSel = Application.Selection;
    
    var oCurveList = XSIFactory.CreateActiveXObject("XSI.Collection");
    
    /*--------------------
    FUNCTIONS
    --------------------*/ 
    fCollectCurves(oSel);
    
    function fCollectCurves(oSel){
      
    	for(var en = new Enumerator (oSel); !en.atEnd(); en.moveNext())
    	{
    		oEn = en.item()
    		oCurveList.Add(oEn);
    	}
    	
    	for(k=0; k < oCurveList.Count; k++)
    	{
    			fTranslateNull(oCurveList(k));
    	}
    }
    
    function fTranslateNull(inPath)
    {
    	var oPntX = new Array();
    	var oPntY = new Array();
    	var oPntZ = new Array();
    	var oNull = oRoot.AddPrimitive("null");
    	
    	oVB = new VBArray(inPath.ActivePrimitive.Geometry.Points.Pos  itionArray);
    	oPntArray = oVB.toArray();
    	
    	for(i=0; i < oPntArray.length; i += 3)
    	{
    		oPntX[i] = oPntArray[i];
    		oPntY[i] = oPntArray[i+1];
    		oPntZ[i] = oPntArray[i+2];
    	
    		if(i == 0){
    			 oNull.Kinematics.Local.PosX.Value = oPntX[0];
    			oNull.Kinematics.Local.PosY.Value = oPntY[0];
    			oNull.Kinematics.Local.PosZ.Value = oPntZ[0];
    		}
    	}	
    
    	oNull.AddChild(inPath);
    
    }
__________________
maya and zbrush training
creating CG3D since 2001

3D Models
@ Turbosquid

my Scripts

Last edited by Stoehr : 05 May 2010 at 09:49 AM.
 
  05 May 2010
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
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 08:52 AM.


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