Access to the current Sketchup scene in C

Hello,

I am writing a plugin for Sketchup.
I need to get access to the current loaded scene in Sketchup through the SDK.
To get access to the entities, I need a valid SUModelRef which must be the current scene.

I saw: SU_EXPORT SUModelRef SUModelFromExisting(uintptr_t data);

But what is data parameters? Is it the right method ?

I also think to send a VALUE between ruby and C dll.

The ruby call would be:
MyPlugin.SendModel(Sketchup.active_model)

The C prototype would be:
VALUE SendModel(VALUE model)
{
…// But what to do with model and how to convert it to SUModelRef !

Any help would be greatly appreciated!

Thanks,
Manuel

Find out this! May be this is the answer.

Yea, that describes how to access the needed model pointer. This hasn’t been officially supported - but I think we should add an official way to get it directly from C for read only access.

Note - don’t attempt to modify the live model via C, only use it to read.

3 Likes