Create Null as Parent at First Point of a Curve

 05 May 2010 Stoehr Expert   portfolio Matthew L Stoehr Professor & Dept. Chair American River College, Art New Media Sacramento, USA 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. share quote
 05 May 2010 CGTalk Moderation Expert 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. share quote

 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 vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.