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

    Layer name as if-condition ?? possible ???

    Scheduled Pinned Locked Moved Developers' Forum
    1 Posts 1 Posters 194 Views 1 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.
    • artmusicstudioA Offline
      artmusicstudio
      last edited by

      hi,
      this one does not seem to work. i wonder, if a layer.name can be a condition? no info in api....

      
      model = Sketchup.active_model
      entities = model.entities
      
      entities.each { |m|
      puts "iterating m"
      	if m.is_a?(Sketchup;;Group)
      		e = m.entities
      			e.each { |f|
      			puts "iterating f"
      			    if f.is_a?(Sketchup;;Group) and f.layer == "layername"
      					puts f.layer
      						entities2 = f.entities
      							entities2.each { |g|
      							puts "moving entities"
      							newlayer = g.layer = "Layer0"
      								
      									}
      					end				
      					}#f
      		end
      	}#m
      end#def
      
      

      thanx
      stan

      edit: just found out, that

      @unknownuser said:

      if f.is_a?(Sketchup::Group) and f.layer.name == "layername"

      works.

      stan

      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