[Plugin] Convert DWG Layer Names to Materials

[Plugin] Convert DWG Layer Names to Materials

Postby Al Hart » Mon Apr 18, 2011 6:00 am

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]
1
Last edited by Al Hart on Tue Apr 19, 2011 5:31 am, edited 2 times in total.
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Convert DWG Layer Names to Materials

Postby lexmonteiro » Mon Apr 18, 2011 1:54 pm

:berserk:
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!!!
0

lexmonteiro 
 

Re: [Plugin] Convert DWG Layer Names to Materials

Postby Didier Bur » Mon Apr 18, 2011 5:42 pm

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,
0
Didier Bur
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: [Plugin] Convert DWG Layer Names to Materials

Postby Al Hart » Tue Apr 19, 2011 5:30 am

Thanks Didier - it is good to have the original working again - with its additional options to convert materials to layer names as well.
0
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Convert DWG Layer Names to Materials

Postby Ian.Kidston » Tue Jun 14, 2011 7:25 am

Great Plugin - works like a charm. Sweeeet! :D
0

Ian.Kidston 
 

Re: [Plugin] Convert DWG Layer Names to Materials

Postby ek12 » Tue Apr 24, 2012 8:32 am

ek12 wrote: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?
0

ek12 
 

Re: [Plugin] Convert DWG Layer Names to Materials

Postby Gabbiano » Tue Apr 09, 2013 11:44 am

A GREAT plugin! It saved me hours of work.
Thanks a thousand times, Al!
0

Gabbiano 
 

Re: [Plugin] Convert DWG Layer Names to Materials

Postby function » Mon Sep 01, 2014 3:59 am

Can someone post a mirror for dbur's script? This would be very handy right now!
0

function 
 

Re: [Plugin] Convert DWG Layer Names to Materials

Postby TIG » Mon Sep 01, 2014 9:55 am

function wrote: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 ? viewtopic.php?p=323280#p323280
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Convert DWG Layer Names to Materials

Postby function » Mon Sep 01, 2014 3:40 pm

are the download links working for you?
http://rhin.crai.archi.fr/rld/download. ... erials.zip

the ruby depot downloads haven't been working for me recently
0

function 
 

Re: [Plugin] Convert DWG Layer Names to Materials

Postby TIG » Mon Sep 01, 2014 6:00 pm

They must have a problem with their servers ?

Does anyone have a copy they could send to 'function' by PM ?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Convert DWG Layer Names to Materials

Postby function » Wed Sep 03, 2014 9:24 am

:thumb: the depot is back online :enlight:
0

function 
 

Re: [Plugin] Convert DWG Layer Names to Materials

Postby gparadis » Wed Nov 01, 2017 3:48 pm

Hey guys,
Quickly edited this plugin to also convert the layer colors, instead of assigning a random color per material.

Very useful ! Thanks
0

gparadis 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: zul6041 and 23 guests

Visit our sponsors: