• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Selecting all components on a given layer.

Scheduled Pinned Locked Moved Developers' Forum
1 Posts 1 Posters 353 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.
  • P Offline
    peweuk
    last edited by 17 Mar 2008, 14:30

    I am using CutListAndMaterials.rb to produce a cutting list.

    This script works on 'selected' items only.

    All the cabinets are in different layers called 'Base Units'/'Wall Units' etc.

    I want to simplify the process of selecting the items and came across this 'script' which supposedly allows you to choose a layer from the layers in the scene and then selects everything on that layer

    #This example adds a menu item to select things in the model 
    # based on Layer or Material.  The also demonstrate putting a popup list
    # in an input box
    
    def select_by_layer
        # First get a list of all of the layers in the model
        model = Sketchup.active_model
        layers = model.layers
        names = layers.collect {|l| l.name}
        
        # Display a dialog to pick the layer to select
        prompts = ["Layer"]
        values = [names[0]]
        enums = [names.join("|")]
        results = inputbox prompts, values, enums, "Select By Layer"
        return if not results
        
        # Now select everything on the selected layer
        layername = results[0]
        do_select {|e| e.layer.name == layername}
    end
    
    

    I have no experience of Ruby Script and wondered if anyone could assist me by explaining how I could add this to the Cutlist script so that it produced the cutting list for all the items chosen in a selected layer without having to go through separate procedures to get there.

    I was going to ask the author of CutListAndMaterials.rb if he was prepared to do it, but cannot find any way of contacting him.

    Thanks in advance for any offers of assistance.

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

    Advertisement