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

    Method to identify what context the user is in?

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 7 Posters 334 Views 7 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.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      active_path = Sketchup.active_model.active_path

      returns nil if they are not in a component. If they are inside a component, or drilled down a few levels, it will return each component they are within.

      Chris

      Lately you've been tan, suspicious for the winter.
      All my Plugins I've written

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

        model.active_entities will return the entities of the editing context. Contrast to model.entities which will return all of the top-level entities.

        model.active_path will return an Array containing the sequence of entities the user has double-clicked on for editing. Or nil if none.

        Maybe one of those is what you need?

        Hi

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

          Thank you both very much. I believe that's exactly what I need.

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

            In order to accomplish what I need, I use the info given above to get out of the context of the group back into the overall context:

            while !Sketchup.active_model.active_path.nil?	
            	Sketchup.active_model.close_active
            end
            

            It would be nice if I could save the position somehow, go to the global context as shown in the code but then go back to the context when I'm done. That way the user doesn't have to re-double-click back to where they were.

            I'm not seeing anything in the model class that would appear to do that. Anyone have any ideas?

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

              Why do you need to go out and back in the nested entities ? You can always get the user to pick something within a group (say), do things to it within it's entity set without having to open that entities set for editing ?

              TIG

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

                You sure you have to exit the current context, can't you take the model.edit_transform into account when doing your operations?
                http://code.google.com/apis/sketchup/docs/ourdoc/model.html#edit_transform

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

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

                  @thomthom said:

                  You sure you have to exit the current context, can't you take the model.edit_transform into account when doing your operations?
                  http://code.google.com/apis/sketchup/docs/ourdoc/model.html#edit_transform

                  That was super helpful. I used that transformation matrix to adjust my data and it worked perfectly. Much obliged!

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

                    @thomthom said:

                    You sure you have to exit the current context, can't you take the model.edit_transform into account when doing your operations?

                    Could this be used to calculate scaled face areas in a Component?

                    reference: http://forums.sketchucation.com/viewtopic.php?f=180&t=16075

                    Hi

                    1 Reply Last reply Reply Quote 0
                    • R Offline
                      RickW
                      last edited by

                      @fizgig said:

                      It would be nice if I could save the position somehow, go to the global context as shown in the code but then go back to the context when I'm done. That way the user doesn't have to re-double-click back to where they were.

                      I'm not seeing anything in the model class that would appear to do that. Anyone have any ideas?

                      It was requested, but hasn't made an appearance yet. I reaffirmed the request.

                      RickW
                      [www.smustard.com](http://www.smustard.com)

                      1 Reply Last reply Reply Quote 0
                      • L Offline
                        leixing
                        last edited by

                        [quote="fizgig"]
                        If the user does double-click into a group, the active context is that group and the local coordinate system associated with that group.
                        yes,I want this too.I ask the same qus here
                        http://forums.sketchucation.com/viewtopic.php?f=180&t=22915&p=193698#p193698

                        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