sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Edges, faces, etc to layers

    Scheduled Pinned Locked Moved Plugins
    3 Posts 2 Posters 413 Views 2 Watching
    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.
    • K Offline
      KrisM
      last edited by

      I know what I am asking for violates one of the cardinal rules of SU. I do model with all objects (edges, faces, etc) on layer 0 with groups and components on appropriately named layers.
      I also work with Revit and have the need to control visibilty of the imported SU objects. I can bring the layers from SU into Revit but cannot play with visibilty because all the actual edges and faces are on layer 0.
      Is there a plugin which will take all the objects (edges & faces) within a group or component and put those objects on the groups layer. This would only be used in a copy of the model which would be saved for the Revit export.
      Any ideas?

      KrisM

      1 Reply Last reply Reply Quote 0
      • K Offline
        KrisM
        last edited by

        That works like a charm. This will save me a lot of tedious work. Thank you.

        KrisM

        1 Reply Last reply Reply Quote 0
        • sdmitchS Offline
          sdmitch
          last edited by

          @krism said:

          I know what I am asking for violates one of the cardinal rules of SU. I do model with all objects (edges, faces, etc) on layer 0 with groups and components on appropriately named layers.
          I also work with Revit and have the need to control visibilty of the imported SU objects. I can bring the layers from SU into Revit but cannot play with visibilty because all the actual edges and faces are on layer 0.
          Is there a plugin which will take all the objects (edges & faces) within a group or component and put those objects on the groups layer. This would only be used in a copy of the model which would be saved for the Revit export.
          Any ideas?

          KrisM

          This works from the Ruby Console on a selection of components or groups.

          mod = Sketchup.active_model
          ent = mod.entities
          sel = mod.selection
          
          sel.each{|corg|
            ents = corg.entities if corg.class==Sketchup;;Group
            ents = corg.definition.entities if corg.class==Sketchup;;ComponentInstance
            ents.each{|e|
              if e.class==Sketchup;;Edge || e.class==Sketchup;;Face
                e.layer = corg.layer
              end
            }
          }
          
          

          or this from the context menu when you right click on a component or group

          unless file_loaded?(__FILE__)
          	mod = Sketchup.active_model
          	ent = mod.active_entities
          	sel = mod.selection
          	UI.add_context_menu_handler do |menu|
          		unless sel.empty? || (sel.first.class != Sketchup;;ComponentInstance && sel.first.class != Sketchup;;Group)
          			menu.add_separator
          			menu.add_item("Move Entities To Comp/Group Layer") {
          				corg = sel.first
          				ents = corg.entities if corg.class==Sketchup;;Group
          				ents = corg.definition.entities if corg.class==Sketchup;;ComponentInstance
          				if ents
          					ents.each{|e|
          						if e.class==Sketchup;;Edge || e.class==Sketchup;;Face
          							e.layer = corg.layer
          						end
          					}
          				end
          			}
          		end#unless sel
          	end#do
          	file_loaded(__FILE__)
          end#file
          
          

          Nothing is worthless, it can always be used as a bad example.

          http://sdmitch.blogspot.com/

          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