• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

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 2 Feb 2010, 15:14

    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 3 Feb 2010, 06:21

      @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
      • C Offline
        Chris Fullmer
        last edited by 3 Feb 2010, 07:28

        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 3 Feb 2010, 11:17

          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 3 Feb 2010, 20:34

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

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

            Advertisement