[Plugin] Convert DWG Layer Names to Materials
-
I have a client who was having a hard time making windows in a Revit model imported into SketchUp transparent.
There was an older script layers_materials.rb, by Didier, which would have helped a lot, but I couldn't get it to work properly in SU 8
I took a look at getting the old script ruby working, and created a new version
*It would not run for me because of loading and run time errors in SU 8.
*I added some options to not change materials which are already assigned.
*I added some logic to only process each component definition once.I have attached the result.
convert_materials_to_layer_names.rb
Put this in the plugins folder and give it a try.
After loading SketchUp, and importing a DWG file, select Convert Layer Names to Materials from the Plugins menu.
Create new materials for all layers (except Layer0) - If this is Yes, then new materials will be created to match all layers, except Layer 0. If it is No, then no new layers will be created, and only existing layers will be used. Only material names which match the layer names will be used.
Do not change existing, non default, material names - If this is cYes, then only faces with no material set will be set to the material with the same name as the entity's layer,. If it is No, then exiting materials will be overridden with the layer materials.
A report will be provided of new materials created and how many faces had their materials changed.
Let me know what goes wrong. (The first person to try a new plugin will undoubtedly find a problem or two)
[Edit - changed name of original script]
-
I always lose a lot of time matching the material with layers of cad drawings in SU and now I can do this with a few clicks!
This will help me a lot!
Thanks!!! -
Hi,
That's what my layers_materials.rb script was supposed to do, but someone mailed me it doesn't work in SU8.Have fixed it here: http://rhin.crai.archi.fr/rld/plugin_details.php?id=219
Regards, -
Thanks Didier - it is good to have the original working again - with its additional options to convert materials to layer names as well.
-
Great Plugin - works like a charm. Sweeeet!
-
@ek12 said:
I use AutoCAD to generate most of my architectural model information, then do some tweaking, or design refinements in SketchUP, export images and do some post-production render in Photoshop. Since I have been doing this over 30 years (straight AutoCAD in early years) I have always controlled my model and materials by layer as that is how I work/think in ACAD.
I have a lot of models with materials applied by layer and would like to simply convert the model to have the same materials applied/painted to the same surfaces to render with SU, or plug in rendering software. Anybody know of a quick solution? Thanks. EK
Above is my original post in the materials section. I tried to use the 'convert_materials_to_layer_names.rb' and it simply made a lot of materials with the layer names, but the original materials/textures assigned to those layers were replaced by random colors without textures. Then I tried 'layers_materials.rbs' which has a lot more options, which looked like it should do the trick. But when I run the "paint faces from layers" option, it simply states: "parsed 8,109 faces, 0 changed, 8,109 inchanged" & I get the same result from all models I tried, it just reports different number of faces parsed. Using the "create materials from layers" option acts similar to the first plugin, and simply makes new materials, but doesn't assign the material properties from my layers in my 'color by layer' model to the faces. It looks like you guys are getting this to work. What am I doing wrong?
-
A GREAT plugin! It saved me hours of work.
Thanks a thousand times, Al! -
Can someone post a mirror for dbur's script? This would be very handy right now!
-
@function said:
Can someone post a mirror for dbur's script? This would be very handy right now!
What is wrong with the link which Didier gave a little earlier in this thread ? http://sketchucation.com/forums/viewtopic.php?p=323280#p323280 -
are the download links working for you?
http://rhin.crai.archi.fr/rld/download.php?file=Layers_materials.zipthe ruby depot downloads haven't been working for me recently
-
They must have a problem with their servers ?
Does anyone have a copy they could send to 'function' by PM ?
-
the depot is back online
-
Hey guys,
Quickly edited this plugin to also convert the layer colors, instead of assigning a random color per material.Very useful ! Thanks
-
just wanted to thank Didier Bur for creating a great plugin, Al Hart for keeping it updated & gparadis for the finishing touch of recreating the layer colour on the material.
The only thing missing is that a texture assigned to a layer colour is not carried over, but that's a minor quibble.Didier's site http://rhin.crai.archi.fr/rld seems to be down at the moment, by the way.
-
@jga said:
Didier's site http://rhin.crai.archi.fr/rld seems to be down at the moment, by the way.
Didier announced that he will no longer teach SketchUp nor will he develop new extensions or maintain any of his existing extensions. That's probably why his site is down then.
-
@juju said:
Didier announced that he will no longer teach SketchUp nor will he develop new extensions or maintain any of his existing extensions. That's probably why his site is down then.
I'm not surprised, Trimble seem to be out of touch with SketchUP's core customers.
Didiers site & plugins were a revelation when I started out with SketchUP as a way to increase my productivity with the tool. It was a great service to the community.
Advertisement