PDA

View Full Version : divide an object by material



Roland
05-12-2015, 12:30 AM
I would like to divide an object on the material, so that the parts are on different layers.
Is there a FREE plugin? Trueart is great, but expensive for me...

MonroePoteet
05-12-2015, 02:55 PM
If you mean split up the geometry based upon the Surface names, here's a simple LScript to do so. It only works on a single layer, splitting the geometry on that layer into subsequent empty layers based upon the Surface name, and naming the resulting layers to be the Surface name. It may be too simplistic for what you need to do.

Note that if your original object has multiple layers, you can apply the script to each subsequent layer but you may end up with multiple created layers with the same Surface name which would have to be manually combined.

mTp

erikals
05-12-2015, 03:25 PM
nice, thanks http://erikalstad.com/backup/misc.php_files/smile.gif


https://www.youtube.com/watch?v=7yRWqTdeaPg

JoePoe
05-12-2015, 06:16 PM
Thank you MonroeP

I know it's a quick script, and I appreciate it.... but I think I found a small bug.
All is well if every layer is occupied BEFORE the layer with geometry to be separated.
BUT if there is an empty layer... the script cuts ALL the geometry and puts it in that one (or the first descending/adjacent) unoccupied layer.

thanks again

JP

Roland
05-13-2015, 12:18 AM
it works perfect for me, thanks a lot ! :)

OnlineRender
05-13-2015, 02:29 AM
it works perfect for me, thanks a lot ! :)

well in lads , thanks very much ... wavers assemble :lwicon:

MonroePoteet
05-13-2015, 06:27 AM
Thank you MonroeP

I know it's a quick script, and I appreciate it.... but I think I found a small bug.
All is well if every layer is occupied BEFORE the layer with geometry to be separated.
BUT if there is an empty layer... the script cuts ALL the geometry and puts it in that one (or the first descending/adjacent) unoccupied layer.

thanks again

JP

Hi JP,

I can't reproduce this behavior. For example, if I have a multi-surface object in Layer 4 with Layers 1-3 empty, it still work fine for me. If you can post an object that demonstrates the behavior, I can try to fix the script.

mTp

JoePoe
05-13-2015, 10:15 AM
Hi Monroe,

I made a video of the behavior.
But on restart of Modeler everything seems to be okay :thumbsup:.
I can still post the vid if you want (1:30).

MonroePoteet
05-13-2015, 03:34 PM
I was able to reproduce the problem by hiding the polygons with the first surface name using the "-". Apparently, the selpolygon() call is able to select polygons by surface even if they're hidden. If I hide polygons of some other surface, all the polygons of that surface and the following surfaces are copied into the first empty layer.

It would make some sense that a Modeler restart would fix the problem for you, since any hidden geometry would have been eliminated upon shutdown.

Here's an updated SplitBySurface.ls which unhides all geometry before proceeding. If the hidden geometry problem was the issue, shouldn't happen again.

mTp

PeT
05-13-2015, 04:21 PM
hi guys ..
some more stuff :

http://www.rendering.de/forum/viewtopic.php?f=1&t=11645