How to pass ISketchUpDocument from SU into c++
-
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
GetNum2In .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)? -
@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. -
But you could do calculations inside C++ and send the results back to Ruby to then apply to the model, yeah?
-
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?
-
My fault, it is ISkpDocument*, not ISketchUpDocument*.
Now it works!
Thank you very much!
Advertisement