CAD file separation?

20 views
Skip to first unread message

Steve Davy

unread,
Nov 7, 2024, 3:22:23鈥疨M11/7/24
to Maya Group
I'm sure I could fathom out how to script this myself with time, but figure there's gotta be something in existence to do it already that I don't know about.

Working with STEP files in Maya, I'm often presented with a monolithic model with one transform and a million individual shape nodes underneath. Sometimes this is beneficial, sometimes it's not and often I need to extract individual groups of NURBS trims which make up a separate surface.

By default there's no easy way to do this that I know of. You can pick shape nodes in the Hypergraph (tedious) but you can't pick in the viewport as they are all under the single transform. Does anyone know of a script (or other method) to extract the individual shapes and give them their own transforms?

Already checked Highend 3D and don't see anything, surprisingly.

I'm also surprised I didn't solve this 20 years ago. 馃槣

Fred Lewis

unread,
Nov 7, 2024, 10:18:54鈥疨M11/7/24
to maya...@googlegroups.com
Hi Steve!

It does sound like a job for scripting, given that there are a lot of them as you say. If I were in that situation I'd write a relatively simple script that does something like: For each selected node, get each shape under that node one at a time (so that's a for loop, inside another for loop), and for each shape, make a new transform (parented to nothing) and parent the shape to the new transform. Maya's regular parent command (in mel or Python) works this way for shapes I believe.

I agree about your comment. Seems like I've had to write a lot of scripts for "missing features".

Fred
--
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 visit https://groups.google.com/d/msgid/maya_he3d/DS0PR11MB77685FE8F087FB60F3EE2DF4DD5C2%40DS0PR11MB7768.namprd11.prod.outlook.com.

joiec...@gmail.com

unread,
Nov 8, 2024, 5:49:20鈥疉M11/8/24
to maya_he3d
But you do work with CAD files as they are, in NURBS format?
Or do you convert them to polys or what?
I usuarlly work with CAD data and in poligon form because NURBS are not welded at render time, which is a shame.
So I use Aruba tesellation via custom script. Very convenient convert method I must say. Autodesk did a good job with that one.
But if you still need to work as they are in NURBS format, I'd recommend use Rhino in order to separate in parts. If the model is well done (not guaranteed) in source, Rhino will separate into objects or groups of objects, each time you explode the model. Then you can reexport to STEP or SAT or something like that (not IGES because it doesn't retain groups information) and reimport into MAYA.
Cheers.

Steve Davy

unread,
Nov 8, 2024, 12:42:15鈥疨M11/8/24
to maya...@googlegroups.com
Hi Fred, how are you?


Yes, that's exactly how it would work, I just didn't want to reinvent the wheel as it seems like there's gotta be a script that already can do it.

I'm sure for a MEL or Python whiz this would take about 10 seconds (versus a couple of hours of experimentation and frustration for me 馃槈)







From: maya...@googlegroups.com <maya...@googlegroups.com> on behalf of Fred Lewis <fle...@movingmedia.com>
Sent: Thursday, November 7, 2024 7:18 PM
To: maya...@googlegroups.com <maya...@googlegroups.com>
Subject: Re: [maya_he3d] CAD file separation?

Steve Davy

unread,
Nov 8, 2024, 12:49:53鈥疨M11/8/24
to maya...@googlegroups.com
I convert to polys, and yes the Aruba tessellation tool is great if the model comes in separated in the way that you need it. Other times it may come in in a monolithic state but you can then run a "separate" on it and find that you have the chunks that you need.

But there are also times when that doesn't work, so it's necessary to import as STEP and convert by hand. The pieces are usually there, but often grouped under a single transform.


Despite working with CAD on and off for a couple of decades, I've never really got a good understanding of the factors that cause one situation or another, but I assume it's related to which CAD app files came from and how those files were set up with layers or groups. Ultimately as you say it's good to have a CAD program which may allow you access to layers and the ability to export them separately, but sometimes that's not possible and you have to just work with Maya's capabilities.



From: maya...@googlegroups.com <maya...@googlegroups.com> on behalf of joiec...@gmail.com <joiec...@gmail.com>
Sent: Friday, November 8, 2024 2:49 AM
To: maya_he3d <maya...@googlegroups.com>

Subject: Re: [maya_he3d] CAD file separation?

joiec...@gmail.com

unread,
Nov 11, 2024, 2:07:54鈥疉M11/11/24
to maya_he3d
It always depend on the CAD software used to model and who modeled it. Because many CAD softwares keep versions inside the same file, so you end up with dozens of surfaces almost in the same place and it is a nightmare to remove (because you never know which one is the correct one). Above all that, many engineers model in an "untidy" way, so everything is a mess. So I always end up telling the engineer to remove everything not needed in the file, export it in STEP format, and reopen it to be sure everything is in place, welded or solidified, and then send it to me.

Steve Davy

unread,
Nov 11, 2024, 11:53:35鈥疉M11/11/24
to maya...@googlegroups.com
Yup, well that's a whole other set of problems when you have multiples in the file!

I've had to deal with that when there's been no means to request a cleaned up file from the source. Fun.

Sent: Sunday, November 10, 2024 11:07 PM

joiec...@gmail.com

unread,
Nov 14, 2024, 4:20:08鈥疉M11/14/24
to maya_he3d
I really feel your pain LOL

stephenkmann

unread,
Nov 14, 2024, 1:44:12鈥疨M11/14/24
to maya...@googlegroups.com
Hey Steve,聽 聽I must admit I didn't read all that.聽

so it's multiple nurbs shapes under 1 transform聽 or multiple polys under 1 transform?聽






--

stephenkmann

unread,
Nov 14, 2024, 1:50:13鈥疨M11/14/24
to maya...@googlegroups.com
never mind, doesn't seem to matter if it's nurbs or polys




import maya.cmds as cmds

def reparentShapes():
聽 聽 sel = cmds.ls(sl = True)
聽 聽 for each in sel:
聽 聽 聽 聽 shapes = cmds.listRelatives(each, shapes = True)
聽 聽 聽 聽 print(shapes)
聽 聽 聽 聽
聽 聽 聽 聽 for sh in shapes:
聽 聽 聽 聽 聽 聽 grp = cmds.createNode('transform' , name = ("trs_" + sh))
聽 聽 聽 聽 聽 聽 cmds.parent(sh,grp, r = True, s = True)
聽 聽 聽 聽 聽 聽
聽 聽 聽 聽
reparentShapes()

Steve Davy

unread,
Nov 15, 2024, 3:42:32鈥疨M11/15/24
to maya...@googlegroups.com
Awesome Steve, thanks so much.

I ended up going thru Rhino to solve the issue I had in hand, but I'll have uses for this in future without a doubt! Works like a charm.

From: maya...@googlegroups.com <maya...@googlegroups.com> on behalf of stephenkmann <stephe...@gmail.com>
Sent: Thursday, November 14, 2024 10:49 AM
To: maya...@googlegroups.com <maya...@googlegroups.com>
Reply all
Reply to author
Forward
0 new messages