Separate out multiple NURBS shape nodes?

193 views
Skip to first unread message

Steve Davy

unread,
Jun 10, 2021, 3:53:50 PM6/10/21
to Maya Group
Can't believe I've never solved this but it hardly ever comes up.... until it does, like now.

Does anyone have a simple script that will separate out multiple NURBS shape nodes coming from CAD?

bobrobertuma

unread,
Jun 10, 2021, 4:25:37 PM6/10/21
to maya...@googlegroups.com

Unsure of original author.  Bryan Ewert helped with this script.

 

for ($obj in `ls -sl`){

string $shapes[]=getShapes($obj);

for ($shape in $shapes){

string $transform = `createNode transform -n ($shape+"_GEO")`;

print ("Unparenting shape: " + $shape + "");

parent -s -r $shape $transform;

}

}

 

//This code thanks to Bryan Ewert

proc string[] getShapes( string $xform )

{

string $shapes[];

$shapes[0] = $xform;

if ( "transform" == `nodeType $xform` )

// If given node is not a transform, assume it is a shape

// and pass it through

{

$shapes = `listRelatives -fullPath -shapes $xform`;

}

return $shapes;

}

 

Works great on CAD crapola.

--
You received this message because you are subscribed to the Google Groups "maya_he3d" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maya_he3d+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/maya_he3d/BYAPR07MB5861442386589DF193A657F1DD359%40BYAPR07MB5861.namprd07.prod.outlook.com.

Steve Davy

unread,
Jun 10, 2021, 7:00:55 PM6/10/21
to maya...@googlegroups.com
I'd actually found a version of that online but it was spitting out errors I couldn't unravel. This one seems to work though, so thanks!

As it turns out, converting any one of these objects to polys works too, which is what I'm ultimately doing, but this may still come in handy.


From: maya...@googlegroups.com <maya...@googlegroups.com> on behalf of bobrobertuma <bobrob...@gmail.com>
Sent: Thursday, June 10, 2021 1:25 PM
To: maya...@googlegroups.com <maya...@googlegroups.com>
Subject: RE: [maya_he3d] Separate out multiple NURBS shape nodes?
 

bobrobertuma

unread,
Jun 10, 2021, 8:51:39 PM6/10/21
to maya...@googlegroups.com

If you study the code you’ll see the actionable part is simply making a transform node and piping the shape node into a new transform node.

Should do what you need without worrying yet about polys..?

 

string $transform = `createNode transform -n ($shape+"_GEO")`;

print ("Unparenting shape: " + $shape + "");

parent -s -r $shape $transform;

 

 

Steve Davy

unread,
Jun 11, 2021, 1:31:14 PM6/11/21
to maya...@googlegroups.com
Right, well I also now discovered the STP file import options which can convert to polys on import (not sure how long those have been there?), and also separate things out in the process. So I actually really no longer need to retain NURBS. Thanks for the script though -- definitely one to keep.


Sent: Thursday, June 10, 2021 5:51 PM

joiec...@gmail.com

unread,
Jun 13, 2021, 11:18:27 PM6/13/21
to maya_he3d
I believe that was included when MAYA integrated the Aruba tesellator a few versions ago, which, by the way, works pretty well for such things.
Reply all
Reply to author
Forward
0 new messages