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

    How to pass ISketchUpDocument from SU into c++

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 735 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.
    • Z Offline
      zsacul
      last edited by

      Hi,
      I am working with SU sample plugin from TBD (many thanks for that).
      I have c++ dll with function:

      extern "C" int GetNum2(void * spApp)
      {
      sketchup::ISketchUpDocument* pDoc = (sketchup::ISketchUpDocument*)spApp;

      return pDoc->IsValid();
      

      }

      suddl.def:
      EXPORTS
      GetNum2

      In .rb file I have:

      mydll = path + "/SUDLL.dll"
      IleD = Win32API.new(mydll,"GetNum2",["P"],"I");
      UI.messagebox IleD.call(Sketchup.???)

      Is it possible to pass ISketchUpDocument pointer from Sketchup, to manipulate current view by c++ plugin?
      For example to write a c++ function that will move all points by Vector(10,0,0)?

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

        @zsacul said:

        Is it possible to pass ISketchUpDocument pointer from Sketchup, to manipulate current view by c++ plugin?
        For example to write a c++ function that will move all points by Vector(10,0,0)?

        To get ISkpDocument from Ruby you can do-
        Sketchup.active_model.skpdoc
        But you can't modify the model from the SU C++ API.

        1 Reply Last reply Reply Quote 0
        • Chris FullmerC Offline
          Chris Fullmer
          last edited by

          But you could do calculations inside C++ and send the results back to Ruby to then apply to the model, yeah?

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

          1 Reply Last reply Reply Quote 0
          • Z Offline
            zsacul
            last edited by

            Thanks for answer.
            Reading only would be fine.

            When I execute:

            
            UI.messagebox IleD.call Sketchup.active_model.skpdoc
            
            extern "C" int GetNum2(sketchup;;ISketchUpDocument*pDoc)
            {
            	return pDoc->IsValid();
            }
            

            it crashes, so I assume pDoc pointer is wrong.

            when I change it for
            return 2;

            it shows 2.

            Any ideas, what may be wrong?

            1 Reply Last reply Reply Quote 0
            • Z Offline
              zsacul
              last edited by

              My fault, it is ISkpDocument*, not ISketchUpDocument*.
              Now it works!
              Thank you very much!

              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