Return SU_ERROR_NO_DATA when call SUApplicationGetActiveModel in Sketchup 2022

Sketchup Version : 22.0.354
Windows Version : win10
SDK Version : 2022.0.354

Return SU_ERROR_NO_DATA when call SUApplicationGetActiveModel in Sketchup 2022 · Issue #1039 · SketchUp/api-issue-tracker

C/C++ code


#include <ruby.h>
#include <SketchUpAPI/sketchup.h>
#include <SketchUpAPI/application/ruby_api.h>

VALUE async_edge_data(int argc, VALUE* argv, VALUE self) {
	SUModelRef model = SU_INVALID;
	SUResult res = SUApplicationGetActiveModel(&model);
	return rb_int2inum(res);
}
VALUE example= rb_define_module("Example");
rb_define_module_function(example, "async_edge_data", VALUEFUNC(async_edge_data), -1);

Ruby code

Example.async_edge_data
=>9

Just want to enquire further on this issue. I am struggling to get SUApplicationGetActiveModel() working myself. I know it needs to be linked against the Bundle Loader of the Sketchup Application (I’m on MacOS). I am also getting a SU_ERROR_NO_DATA issue. I have other parts of my Ruby C Extension working ok, but not this.

Is SUApplicationGetActiveModel working as expected currently? And on Mac?

According to the issue thread (linked in the first post) in the GitHub tracker, Kalpana recreated the bug in SU2025 last June.

The GitHub issue is not closed and I do not see a fix listed in any version release notes since.

1 Like