How to use SUEntityToRuby and SUEntityFromRuby

Since SU 2020.2, there has been a new file in the C API: ruby_api.h . There is also the related SUApplicationGetActiveModel. These seem a great way to develop extensions that use the C API for the hard core processing.

However, I cannot find any documentation on these other than what is on the SDK . There are no sample projects that use these functions.

Neither can I see these being used here: GitHub - SketchUp/ruby-c-extension-examples: Ruby C extension examples

Can anyone shed some light on how these functions can be used? I am trying to add the functionality to the C++ Wrapper project here: GitHub - TommyKaneko/Sketchup-API-C-Wrapper: A complete set of C++ Wrapper classes for SketchUp C API objects

They can only be used for a “live” application extension as they are exposed by SketchUp itself.

There is a bit of explanation on the C API main page (for lib linking).
SketchUp C API: SketchUp C API

This is echoed on the README of the Live C API example repository …
GitHub - SketchUp/sketchup-live-c-api: Examples demonstrating how to use the SketchUp Live C API

From this dedicated “Live API” example repository, see this file:
https://github.com/SketchUp/sketchup-live-c-api/blob/main/cext/ruby_extension/example_extension.cpp

ADD: This repo also has a Using the SketchUp Live C API Wiki page …
https://github.com/SketchUp/sketchup-live-c-api/blob/main/docs/using-live-c-api.md

1 Like

@tt_su @DanRathbun This is excellent! Thank you! Now we all know where to look.

2 Likes