I made a Skettchup to CityJSON converter, but it has some issues. The problem occurs mainly when surfaces are nested in groups with 3 or more levels deep. Then certain surfaces are offset in wrong direction / rotation, it really depends on the model.
It this a bug of the SDK?
Here is my code;
It’s a C# console app and you need Visual Studio 2022 and .NET 6 to get it to work.
I cannot see the code for the Transform.Add method you are using, but in SketchUp’s APIs, when walking the model hierarchy the transformation matrices need to be multiplied together as you dig down.
When making the code I used some simple selfmade Sketchup models like cubes. And that worked until I used other files.
I found out that when I use transform.GetTransformed(vertex) it helped. But not with other nested groups. So I was now experimenting doing GetTransformed traversing the group.
To do that I maintain a List of Transforms (line 198 of SketchupUtiliy.cs)
Then at line 210 I do GetTransformed using the list of Transforms. From top to down. The returned vertice is then transformed again. This worked better for some models but most fail.
What version were the files ? It looks as though the C# lib you’re using has not yet updated to use the SketchUp v22 SDK.
Yes it does not appear that the author wrapped much of the C API’s transformation functions.
I suppose you could do the wrapping yourself, or use core C# functions to do the matrix multiplication.