sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Model.active_path uses global coordinates?

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

      I want to manipulate the component definition for the component the user is currently editing (which is nested 2 layers deep). If I do this:

      ci = model.active_path.last 
      cd = ci.definition
      

      I get a valid component definition of the type I am expecting, but if I examine the geometry in the cd, all of the locations returned are in the global coordinate system - I expected them to be in the local system: relative to the origin of the component I'm editing. This is strange. Can anyone explain what's going on here?

      Clark Bremer
      http://www.northernlightstimberframing.com

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

        I think that as a component/group is opened for editing, all co-ordinates are made global.

        Su7.0 introduced a method to help on this matter: 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
        • C Offline
          cjthompson
          last edited by

          the way I solve this problem is with entities.transform_entities(entities.to_a,model.edit_transform.inverse), which effectively reset the definition.

          Then, when you are done editing, just do the same thing without the .inverse

          1 Reply Last reply Reply Quote 0
          • daikuD Offline
            daiku
            last edited by

            @thomthom said:

            I think that as a component/group is opened for editing, all co-ordinates are made global.

            That explains much.

            @thomthom said:

            Su7.0 introduced a method to help on this matter: http://code.google.com/apis/sketchup/docs/ourdoc/model.html#edit_transform

            And I'll have to transform them all back myself, I guess. Thanks, Thomas.

            Clark Bremer
            http://www.northernlightstimberframing.com

            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