Access SketchUp SDK from C#/ .net project

Heh. I didn’t copyright it. Microsoft did. That’s machine-generated code. But, even if I take it out, I still have a copyright in it. You have a copyright in anything you create once it is “fixed in a tangible medium.”

I researched this while I was in law school. It’s a widely recognized, somewhat puzzling omission in the international conventions that govern copyrights. It used to be the case that you had to put a copyright notice on things. If you didn’t, they were public domain. When the Berne Convention adopted the “fixed in a tangible medium” standard, copyrights attached automatically. But no one bothered to consider the case where a person might be willing to abandon those rights. If you did put an “I abandon my copyrights” statement at the top of your code, I expect most judges would ask you to abide by it. But I wouldn’t bet my license on that.

Note that open-source licenses themselves tend to assert copyrights. Without that, you can’t enforce the terms of the license.

I actually would be willing to put my faith in that, but the question Kenny asked was about publishing them to public repos. That’s very slightly different, since it makes them readily available to anyone for download on their own. In a distributable product, they’d be somewhat obscured. (Any tech-savvy user could find them, but not everyone.) Regardless, the requirement would probably be there that we have to prohibit redistribution of Trimble’s file(s). Developers can distribute them (assuming that informal statement you’ve quoted is binding, which I think it is), but people not licensed by Trimble to be developers can’t.

However, like I said above, I think the right thing to do will be to ask Trimble for a review and get their blessing. I’m hoping Thom can point me towards the right people when we reach that point.

Still working on the higher-level stuff. Will have that ready to show you in a couple of days.

Thanks again!

And runs the risk of falling behind version-wise, if the repo owner doesn’t keep up with things.

I toyed with the idea of Trimble releasing a redistributable kit (like Microsoft does,) for specific runtime API support. (But the users of other 3rd party applications might install it when the application is not compatible with the version installed. I guess this is why these are distributed by the application developers.)

So I think anyone using the C# API would (and should) get the latest version release of the C API and install it alongside (sibling folders) of the C# API.

See more explanation in Issue #1 of Steve’s C# repo, for those with access and C# project know how.

I think this would be best. As a Trimble endorsed and moderated community SDK project.

This way there’d be no legal issues.

Also the main thing I’ve over the years, is that developers just will not put their trust in 3rd party libraries in order to develop extensions. They want “official” libraries that they can rely upon to be maintained, fixed, updated and expanded. They have been concerned that these projects will get abandoned.

1 Like

There’s soimething to be said for the repo including the library it is known to run with, but I think your next point actually dominates over that issue.

Yes, this! All issues about keeping current and not breaking any rules are solved this way.

Ah, someone who gets it. As a lawyer, I always tell my clients, “The best time to settle a dispute is before it comes up.” I’m confident that Trimble expects developers to be distributing the C API .dll files for reasons we’ve discussed above. But my confidence is no one else’s license. If we get their approval, all questions are settled in advance. That’s best.

Agreed. It does appear that those of us here in this discussion are fairly enthusiastic about this. If we can cobble up something that looks like it is in Trimble’s interests to endorse, we should be able to overcome this problem exactly as you have outlined. I’d really like to see that happen!

@tt_su and @kengey, I am pretty sure I can’t join you in Leeds (my wife read this discussion and said I should go, but I’m not going to England without her, and she can’t make it in October). If there is a break-out session, can you folks include me and Dan (assuming he’s on this side too) by teleconference?

Well I am not a C guru (but can read it,) and I would like to start using C# and compiling some plugins (perhaps also for other modelers that use C#.)


It’d be better to have just you 3 “C gurus” get your heads together over the implementation.
I’m more of the high level language kinda guy. I’m more interested in the OOP layer than the binding/wrapping part.


But I’ve said what I think an “official” C# API should strive for in the issue in steve’s private repo. I’ll quote that part here …

I don’t have a problem with transliteral named wrapping functions. (This is also done in Ruby when wrapping a FFI with the Fiddle class.)

But the OOP Layer should follow Sketchup OOP API namespace (module), constant, class and method naming convention. Ie, for the OOP “end coder”, the wrapping/binding part of the C# API would be transparent. They should’n ever need to know or care about how the binding to the C API was accomplished. Meaning they’ll never themselves use the SUModelRef identifier. They should interact with a Sketchup.Model C# class instance object.
The doc manual should hide the bindings from the OOP users. (Ie, separate manual for the OOP layer. The bindings possibly in their own namespace. Out of sight - out of mind.)

I’ll add to this, that as a Rubyist, I have a peeve when Ruby conventions are broken (which Ruby allows because it is flexible,) for Ruby libraries or APIs.

BUT, … a C# API is most likley to be implemented using the best practices of the C# language.
This means no SCREAMING_CONSTANTS even though both the C and Ruby APIs use them by convention.

After reading up on C# naming conventions, I remember now why I uninstalled Visual Studio, and decided to get into Ruby instead of any of the MS Visual langauges. All identifiers, for just about everything in these languages is PascalCase.
You cannot tell, at a glance what (kind or type of object) the identifier is referencing. This peeve is one of the things made me fall in love with Ruby. It uses different convention for different kinds of programming objects. Ie, namespaces (ModulesAndClasses), CONSTANTS, method_names, localVars, @instance_vars, @@class_vars, etc.
It is gonna be a bummer relearning my brain to program where almost everything is NamedLikeThis. :frowning:

But, as a realist, I cannot expect an “official” API to purposefully violate the conventions of the language it’s implemented in. (Ignoring the past API transgressions when Ruby conventions were broken. Ie, constants that were implemented in C# / JS PascalCase convention instead of SCREAMING_CAPS, or method names in either PascalCase or camelCase, instead of Ruby’s conventional snake_case.)

If the C# API for SketchUp’s conventions did not reflect industry language conventions for C#, it’d be rejected and ridiculed into disuse.

That might be doable. Virginia, US would be five hours behind UK? If we get something organized it would be at the end of the day, so at least it’d be day-time for you. But maybe in the midst of working hours…?

As for the C API binaries, for the moment I’d say that people should craft their projects such that the user of it plugs in their own version of the C API. It would be a bigger talk internally about bundling n projects like this.
I did something similar for an assimp fork where I was adding .skp file support:


I used their convention of putting the binaries (or symlink) in a contributing folder and the CMake system would pick it up when generating the project. I’ve seen other projects use environment paths.

No problem! I am self-employed, so can join you anytime. That would be great, if we can make it happen.

Well, I think Dan had a good point on that about version compatibility being a risk. I really don’t see how Trimble would think developers can develop anything with these .dll files if we’re not allowed to bundle them with our code. I will talk to Trimble’s legal people about this. Is there anyone in particular you suggest I talk to first?

I have put my OOP layer into a github repo and made it public. Hope you fellows will have a look and let me know what you think.

1 Like

And further to the above, I have made the GitHub wrapper repo public (after replacing the C API .dll files with a link to the developers’ page in my README.md file).

1 Like

Rather than have a bunch of crisscross talk on various aspects of the “Factory”, I opened discussion threads in the repo’s Issues list.

But it is as said in your readme … “The object model is loosely based on the SketchUp document object model.”

I’d say it was condensed and concise. Or is the word abridged ?
It isn’t quite as “high level” OOP as the Ruby API.

Good thinking. After this reply, let’s have further discussion of my repos take place on GitHub. (Am I correct that anyone can post an issue to a public repo?)

That is really gratifying to read. My goal is to provide something that benefits from, but does not require, knowledge of the SketchUp DOM. Since I am using it myself, it has to be simple, clean, and easy to reacquaint myself with after time away from it.

One thing I have learned as I try to become an independent game developer, is that doing it all on your own requires humility. You want to learn and use the most complex and sophisticated aspects of each of your tools. But the problem is that you tend to spend blocks of time on each one. That means you may work for a week or two intensely focused on your modeling tools (like SketchUp). Then, that can be followed by a month working with your game engine (like Unity). Maybe that leads to a programming project for an effect or library you need, so there’s a couple of weeks in pure C#. By the time you get back to SketchUp, you will have to re-learn the most advanced stuff you knew, because you will have forgotten it due to lack of use.

To help with this, whenever I do learn something that took any real time to master, I write a “white paper” with a title that starts “How to…” I have written a lot of white papers. Over the last 20 years, I’ve accumulated over 400 of them. Here’s a sample of their titles:

What that little subset doesn’t reveal, however, is that I have actually started writing a white paper a few times, only to discover later that I already had one on the same topic. But that’s what it means to be an indie: you do it all and, sometimes, you forget a lot of it.

The solution is humility. Let the specialists master the high-level stuff. Stick to what you can master quickly, make notes to help you re-learn what you forget, and put your faith in the power of creative constraints.

So, your assessment matches my objective. A concise implementation, but enough to get the job done.

Yes, as long as they have or create an account, and log in beforehand.

Why do you close discussion issues so fast ? Others may wish to chime in on the question.
(Closing them puts them on the “Closed” list, and people coming to the Issues list will not see by default.)

I know that they’ll be closed eventually, but usually when a decision is made, ie, it will not result in a coding issue or will be used to support a coding issue (with bag or enhancement label.)

Readers can filter easily by label (when more issues are in the list.) If they wish to browse only bug labeled issues, etc.

Just trying to stay focused on the immediate issue(s) of getting this working. You’ve brought up a number of valid considerations, but I think it will be a long time before they are addressed in code. I could add a label for such things instead of closing them. How about “Down the road” or something like that?

Well yeah repo owners have different tabs depending. “Question”, “Enhancement”, etc.

You asked for discussion, I’d think maybe keep it open for awhile.
Call it a review phase. You could even set a Milestone for the end of this “Peer Review” phase.
(Get your “licks” in now people :laughing:)

Yes! The more, the merrier. I welcome all feedback.