sketchucation logo sketchucation
    • Login
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Count / selection count

    Scheduled Pinned Locked Moved Plugins
    3 Posts 3 Posters 1.0k Views 3 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.
    • onzkiO Offline
      onzki
      last edited by

      Hi guys, is there a way to count selected objects? For example: I have parking slots, (each slot is a component). When I select a part or the area containing these objects, an info feedback will return, something like "100 objects selected". For those familiar with CAD interface, it's the same found on command box.

      Thanks!


      [/hr]Dell Alienware Area-51. SKU 2021 Pro. AutoCAD 2023. Landscape design firm

      1 Reply Last reply Reply Quote 0
      • renderizaR Offline
        renderiza
        last edited by

        right click on selection and select entity info which will open a window and at the top you will see how many you have selected.

        [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          If you want to extract the count of specific objects within a larger selection you need to filter the results.
          A one-liner typed or copy+paste into the Ruby Console +<enter> can so this.
          This example counts all instances of a component named 'parking' within a broader selection:

          c=0;Sketchup.active_model.selection.grep(Sketchup;;ComponentInstance).each{|i|c+=1 if i.definition.name=='parking'};p c;
          

          If you have several to count en mass like 'Parking', 'parking#1', 'parking#2' etc use a regex test like i.definition.name=~/^[Pp]arking/ to match more than one name...
          If you want to count ALL instances of a given component [with selection] use

          puts(Sketchup.active_model.definitions['parking'].instances.length)
          

          There are many possibilities ...

          TIG

          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