• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[Plugin] Convert DWG Layer Names to Materials

Scheduled Pinned Locked Moved Plugins
16 Posts 11 Posters 20.2k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    Al Hart
    last edited by Al Hart 18 Apr 2011, 05:00

    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.

    http://api.ning.com/files/rwHAupJLUy8K723X2HrE4QpKwum6s*6O1ioYaZib2M0Y1CHHsHxuXRtdrVOiLnO0T8tbqebQX91pNNDghdcm8UTnxv549BBp/ConvertLayerNamestoMaterials.jpg?width=721

    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]

    Al Hart

    http://wiki.renderplus.com/images/e/ef/Render_plus_colored30x30%29.PNG
    IRender nXt from Render Plus

    1 Reply Last reply Reply Quote 0
    • L Offline
      lexmonteiro
      last edited by 18 Apr 2011, 12:54

      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!!!

      1 Reply Last reply Reply Quote 0
      • D Offline
        Didier Bur
        last edited by 18 Apr 2011, 16:42

        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,

        DB

        1 Reply Last reply Reply Quote 0
        • A Offline
          Al Hart
          last edited by 19 Apr 2011, 04:30

          Thanks Didier - it is good to have the original working again - with its additional options to convert materials to layer names as well.

          Al Hart

          http://wiki.renderplus.com/images/e/ef/Render_plus_colored30x30%29.PNG
          IRender nXt from Render Plus

          1 Reply Last reply Reply Quote 0
          • I Offline
            Ian.Kidston
            last edited by 14 Jun 2011, 06:25

            Great Plugin - works like a charm. Sweeeet! πŸ˜„

            1 Reply Last reply Reply Quote 0
            • E Offline
              ek12
              last edited by 24 Apr 2012, 07:32

              @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?

              1 Reply Last reply Reply Quote 0
              • G Offline
                Gabbiano
                last edited by 9 Apr 2013, 10:44

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

                1 Reply Last reply Reply Quote 0
                • F Offline
                  function
                  last edited by 1 Sept 2014, 02:59

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

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    TIG Moderator
                    last edited by 1 Sept 2014, 08:55

                    @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

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • F Offline
                      function
                      last edited by 1 Sept 2014, 14:40

                      are the download links working for you?
                      http://rhin.crai.archi.fr/rld/download.php?file=Layers_materials.zip

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

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        TIG Moderator
                        last edited by 1 Sept 2014, 17:00

                        They must have a problem with their servers ?

                        Does anyone have a copy they could send to 'function' by PM ?

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • F Offline
                          function
                          last edited by 3 Sept 2014, 08:24

                          πŸ‘ the depot is back online β˜€

                          1 Reply Last reply Reply Quote 0
                          • G Offline
                            gparadis
                            last edited by 1 Nov 2017, 14:48

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

                            Very useful ! Thanks


                            Update to also convert the layer color.

                            1 Reply Last reply Reply Quote 0
                            • J Offline
                              JGA
                              last edited by 25 Jun 2020, 08:29

                              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.

                              Regards,
                              JGA

                              1 Reply Last reply Reply Quote 0
                              • jujuJ Offline
                                juju
                                last edited by 25 Jun 2020, 16:54

                                @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.

                                Save the Earth, it's the only planet with chocolate.

                                1 Reply Last reply Reply Quote 0
                                • J Offline
                                  JGA
                                  last edited by 26 Jun 2020, 08:20

                                  @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.

                                  Regards,
                                  JGA

                                  1 Reply Last reply Reply Quote 0
                                  • 1 / 1
                                  • First post
                                    Last post
                                  Buy SketchPlus
                                  Buy SUbD
                                  Buy WrapR
                                  Buy eBook
                                  Buy Modelur
                                  Buy Vertex Tools
                                  Buy SketchCuisine
                                  Buy FormFonts

                                  Advertisement