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

    Edit_transform not available in the C-API?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 11 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.
    • pixelcruncherP Offline
      pixelcruncher Extension Creator
      last edited by

      Hey folks,

      SketchUp offers the edit_transform instance model for the model: https://ruby.sketchup.com/Sketchup/Model.html#edit_transform-instance_method - However, it seems that there's no equivalent in the C-API. I checked the documentation of the SUModelRef: https://extensions.sketchup.com/developers/sketchup_c_api/sketchup/struct_s_u_model_ref.html.

      Am I not looking in the right place, or is there an alternative way to get the edit_transform?

      Cheers,
      Thomas

      I'm the developer of Rayscaper: https://rayscaper.com/ - Fast and easy rendering for SketchUp.

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        The C API is mainly written to act upon files.
        There is only some limited things you can do with "live" models.
        Currently, the C API cannot be used to modify the active model.


        You can get the active edit path via: SUModelGetActivePath()
        ... and from it the transform via: SUInstancePathGetTransform()

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • pixelcruncherP Offline
          pixelcruncher Extension Creator
          last edited by

          @dan rathbun said:

          The C API is mainly written to act upon files.
          There is only some limited things you can do with "live" models.
          Currently, the C API cannot be used to modify the active model.


          You can get the active edit path via: SUModelGetActivePath()
          ... and from it the transform via: SUInstancePathGetTransform()

          Thanks, Dan, for the information! I solved it in my code by having a ModelObserver, implementing onActivePathChanged, and passing it to my C-extension code.

          Even though you cannot modify the active model, you still need to know the edit transformation for some cases. If a user opens a model to edit, if you query the instance transformation, it will be a world-coordinate transformation instead of a transformation relative to the parent. My C code assumes transformations relative to the parent, so I must calculate that using the edit transformation. You probably already knew this, but I'm putting it here for posterity.

          Cheers,
          Thomas

          I'm the developer of Rayscaper: https://rayscaper.com/ - Fast and easy rendering for SketchUp.

          1 Reply Last reply Reply Quote 1
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement