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

    [HowTo?] Edit Components (or change "active level")

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 5 Posters 1.5k Views 5 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.
    • M Offline
      MarcioAB
      last edited by

      Now, on SU7, that one can get the full "genealogical instances path" from your current "active level" up to the model level ( with model.active_path ).
      How can I re-position my "active level" in one particular instance of this path (kind of "edit level") ? Example:

      print model.active_path
      #Sketchup::ComponentInstance:0x01Sketchup::ComponentInstance:0x02Sketchup::ComponentInstance:0x03

      That means my current "active level" is instance 0x03.
      How can I move up one level using Ruby API to make my "active level" at instance 0x02 ?

      Thank you

      PS1: It could be a pair of APIs like this:

      model.get_active_path ( exactly the same as model.active_path)
      model.set_active_path(n) where n is the number of "levels" to go up.

      In the example above, model.set_active_path(1) will move the "active level" to
      #Sketchup::ComponentInstance:0x01Sketchup::ComponentInstance:0x02

      PS2: Today I'm using the OUTLINER to get positioned in a particular "active level". How can I do the same using Ruby API ?

      Thank you
      Marcio

      1 Reply Last reply Reply Quote 0
      • M Offline
        Matt666
        last edited by

        Hi!
        I am also intersted by this request... How can you set active path to a defined componant instance?

        Frenglish at its best !
        My scripts

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          Don't think there is one... 😞

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            Sounds like model.close_active is what you're looking for. You can "move up", but not dig deeper.

            http://code.google.com/apis/sketchup/docs/ourdoc/model.html#close_active

            Hi

            1 Reply Last reply Reply Quote 0
            • M Offline
              Matt666
              last edited by

              Yes I know this method... But not its opposite! 😞

              Frenglish at its best !
              My scripts

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

                model.close_active ### will jump you up one 'level' out of the current edit session.

                You can only go in the direction of the base model...

                You can repeat x(model.active_path.length) to close the edit back to the base model 'level'.

                Alternatively...

                model.active_path[model.active_path.length-2] ### to get up 1 level, or use -3 for 2 levels etc...

                All of these physically close any current edit sessions...

                If you just want to do something with the entities found at a particular 'level' then just use...

                parent=model.active_path[model.active_path.length-2]

                i.e. the container of the current edit session's instance/group

                parent_entities=parent.definition.entities if parent.typename=="ComponentInstance"
                parent_entities=parent.entities if parent.typename=="Group"

                etc... there's no need to close edits etc, just specify the actual entities-set to work on...

                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