tt_su
July 25, 2019, 3:02pm
#21
Ok. If you can provide us with a model and example to to repro then that’d be great. You can log it in the issue tracker: https://github.com/SketchUp/api-issue-tracker
(I’m thinking we should set up a basic hello world project that is easy to clone and use as an example for stuff like this.)
1 Like
tt_su
July 26, 2019, 9:41am
#22
I just made a quick test, using the Live C API with SU2019.2 and the SU2019.2 SDK on Windows. Using your example file in your first post I’m seeing SUFaceIsComplex
and the SUMeshHelperRef
return expected results.
The CPP file itself:
VALUE is_face_complex() {
auto model = GetActiveModel();
SUEntitiesRef root_entities = SU_INVALID;
SU(SUModelGetEntities(model, &root_entities));
size_t num_groups = 0;
SU(SUEntitiesGetNumGroups(root_entities, &num_groups));
if (num_groups == 0)
return Qnil;
SUGroupRef group = SU_INVALID;
SU(SUEntitiesGetGroups(root_entities, 1, &group, &num_groups));
SUEntitiesRef entities = SU_INVALID;
SU(SUGroupGetEntities(group, &entities));
size_t num_faces = 0;
SU(SUEntitiesGetNumFaces(entities, &num_faces));
This file has been truncated. show original
It grabs the root group, then the face in that group and checks if it’s complex and then how many triangles it consists of.
tt_su
July 26, 2019, 9:42am
#23
Not sure what you mean by that … ?
No the Live C API is read only. If you try to modify the model you’ll get unexpected behaviour, possibly cause a bad/invalid model, and quite likely run into crashes.
tt_su
July 26, 2019, 9:45am
#24
Just to be clear, you are linking only to sketchup.lib, right? For Live C API you should not link against SketchUpAPI.lib.
We need to get better documentation up for how to setup a Live C API project, but for now refer to this post:
For the record, in regard to the Live C API in general:
The read-only live C API wasn’t really complete until SU2019.2 that was just released. While the symbols has been exported on Windows a couple of versions ago, mac did not export the C API symbols from the SketchUp app.
People working with the live C API on mac up til now have been linking against the standalone SketchUpAPI.framework which have appeared to mostly work. But this isn’t the correct way to consume it, and will lead to incorre…