• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ 30% Off | Artisan 2 on sale until April 30th Buy Now

[REQ] remove backface materials (selected)

Scheduled Pinned Locked Moved Plugins
10 Posts 5 Posters 5.7k 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.
  • P Offline
    pbacot
    last edited by 21 Apr 2021, 19:23

    Does anyone know of a plugin that can remove backface materials from a selection. I use TT's Material tools which are excellent. But the actions seem to work on the whole model instead of selections, and removing materials from ALL backfaces is a problem when I just need to work on a specific selection.

    MacOSX MojaveSketchUp Pro v19 Twilight v2 Thea v3 PowerCADD

    1 Reply Last reply Reply Quote 0
    • P Offline
      pilou
      last edited by 21 Apr 2021, 20:01

      If you inverse Selection / Hide then Remove that works not ? (not tested)

      Frenchy Pilou
      Is beautiful that please without concept!
      My Little site :)

      1 Reply Last reply Reply Quote 0
      • R Offline
        rv1974
        last edited by 22 Apr 2021, 09:05

        put selection in separate file, run TT tools and paste it back- what's the problem?

        1 Reply Last reply Reply Quote 0
        • B Offline
          Box
          last edited by 22 Apr 2021, 09:55

          If you are within a group you can use the Specific Material option to remove the backface material without effecting other backfaces.
          Edit: actually you don't need to be in groups, Remove Specific works on selection not entire model.


          Specific.gif

          1 Reply Last reply Reply Quote 0
          • P Offline
            pbacot
            last edited by 22 Apr 2021, 15:35

            Thanks going into every group is what I was hoping to avoid. If there's nothing out there, I can deal with it these different methods.

            MacOSX MojaveSketchUp Pro v19 Twilight v2 Thea v3 PowerCADD

            1 Reply Last reply Reply Quote 0
            • B Offline
              Box
              last edited by 22 Apr 2021, 23:57

              You don't have to go into each group, if the material is only on the back faces you can select groups components and raw geometry and it will remove the chosen material from anywhere in the selection while leaving the rest of the model alone. If the material is both back and front then this wouldn't work.

              1 Reply Last reply Reply Quote 0
              • P Offline
                pbacot
                last edited by 23 Apr 2021, 00:16

                Now i see what you mean--that's a different approach to the same solution. Thanks!

                MacOSX MojaveSketchUp Pro v19 Twilight v2 Thea v3 PowerCADD

                1 Reply Last reply Reply Quote 0
                • D Offline
                  dezmo
                  last edited by 23 Apr 2021, 10:25

                  @pbacot said:

                  Does anyone know of a plugin that can remove backface materials from a selection... I just need to work on a specific selection.

                  Dezmo_remove_back_materials.rbz
                  Here are a quick one...This will remove Back Face Material from selection recursively. You can undo it.
                  Start by toolbar icon or context menu after selection.

                  The result will be printed out to Ruby Console e.g.:
                  "Back Face Material removed from 11 faces."
                  or
                  "Back Face Material removed from 0 face."

                  Quickly tested only on Windows. No responsibility... but should be okay on MAC too.
                  (Sorry about the ugly icon 😳 )


                  rbfm1.gif


                  
                  #main.rb
                  module Dezmo
                    module Remove_Back_Mat
                      @@loaded = false unless defined?(@@loaded)
                      extend self
                  
                      def remove_back_materials
                        model=Sketchup.active_model
                        model.start_operation('Remove Back Face Materials', true)
                        @count = 0
                        remove_back_materials_recursively
                        plural = @count > 1 ? "s" ; ""
                        p "Back Face Material removed from #{@count} face#{plural}."
                        model.commit_operation
                      end
                  
                      def remove_back_materials_recursively(ents = Sketchup.active_model.selection)
                        ents.each { |e|
                          case e
                          when Sketchup;;Face
                            if e.respond_to?( ;back_material ) && e.back_material
                              e.back_material = nil
                              @count += 1
                            end
                          when Sketchup;;ComponentInstance, Sketchup;;Group
                            remove_back_materials_recursively(e.definition.entities)
                          end
                        }
                      end
                      
                      unless @@loaded
                        cmd1 = UI;;Command.new("Remove Back Face Materials") {remove_back_materials}
                        cmd1.small_icon = File.join(File.dirname(__FILE__), "/rbm.png")
                        cmd1.large_icon = File.join(File.dirname(__FILE__), "/rbm.png")
                        cmd1.tooltip = "Remove Back Face Materials"
                        cmd1.status_bar_text = "Remove Back Face Materials (Selection required)"
                        cmd1.set_validation_proc {
                          if Sketchup.active_model.selection.empty?
                            MF_GRAYED | MF_DISABLED
                          else
                            MF_ENABLED
                          end
                        }
                  
                        UI.add_context_menu_handler do |context_menu|
                          context_menu.add_item(cmd1) unless Sketchup.active_model.selection.empty?
                        end
                        toolbar1 = UI;;Toolbar.new("Remove Back Face Materials")
                        toolbar1.add_item(cmd1)
                        toolbar1.restore
                        @@loaded = true
                      end
                    end
                  end
                  
                  

                  Man can do everything. Only a matter of time and money.

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    Box
                    last edited by 23 Apr 2021, 13:47

                    Nice one Dezmo.
                    I really must learn to code one day.

                    1 Reply Last reply Reply Quote 0
                    • P Offline
                      pbacot
                      last edited by 23 Apr 2021, 15:53

                      Wow! Thanks so much for writing that! It works great! πŸ‘ πŸ‘ πŸ‘

                      MacOSX MojaveSketchUp Pro v19 Twilight v2 Thea v3 PowerCADD

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

                      Advertisement