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

    Escaping out of editing a component

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 340 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.
    • F Offline
      Frankn
      last edited by

      Sorry if this has been asked before but I searched and can't find an answer... though admittedly I'm not sure what to search for so I'll explain it best as I can...

      When editing a group or component we can use the escape key to exit 'edit mode'... is there a way to do this with ruby? I tried

      @model.selection.clear 
      

      but that doesn't work. I included a picture to help explain what I mean.
      selection.jpg

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

        Something like:
        model.close_active
        Which goes up one level...
        To go all the way back to the model.entities context use:
        model.close_active until model.active_entities==model.entities

        TIG

        1 Reply Last reply Reply Quote 0
        • F Offline
          Frankn
          last edited by

          UUgghhh never thought of searching for something with 'close' in it kept thinking 'escape'!

          Thanks Tig! You da man... well tiger!

          This is the code I'm using... anything more efficient?

          while @model.active_entities!=@model.entities
                 @model.close_active
          end
          
          1 Reply Last reply Reply Quote 0
          • tt_suT Offline
            tt_su
            last edited by

            Note that if only close the currently open instance. If you are deeply nested you need to loop until you are back in the root - (if that's what you desire). And before SU2014 the method was bugged and could mess up geometry if the close was undone. (The method actually creates an undo item)

            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