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

    Need some help again.

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 295 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.
    • S Offline
      Skastafari
      last edited by

      A few months ago, Tig helped me with some syntax for exploding walls in my model grouped by name, The specific line of code was:

      Sketchup.active_model.active_entities.grep(Sketchup;;Group).each{|e| e.explode if e.name=~/^[Ww]all/ }
      

      I now have to explode components by the same naming system, starting with 'wall'.
      I was thinking I could add another line to the module and simply switch (Sketchup::Group) with (Sketchup::ComponentInstance) and everything should work fine... but it does not. I found myself frustrated again and decided to come back to the pros and ask for some help here.

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

        Unless the Instance itself is named 'wall' it needs to refer to the Definition thus:

        Sketchup.active_model.active_entities.grep(Sketchup;;ComponentInstance).each{|e| e.explode if e.definition.name=~/^[Ww]all/ }
        

        However, to delete Instances which are themselves named 'wall' use

        Sketchup.active_model.active_entities.grep(Sketchup;;ComponentInstance).each{|e| e.explode if e.name=~/^[Ww]all/ }
        

        TIG

        1 Reply Last reply Reply Quote 0
        • S Offline
          Skastafari
          last edited by

          Thanks again TIG! I am very grateful. I knew I was missing something, but was pretty much stumped. Thanks for putting me back on track, and so quickly. Cheers

          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