Hello,
I’m new to developing Sketchup and come from a c# background. I am looking for general guidance or advice about developing my first SketchUp plugin / extension with a GUI interface.
My questions are:
Are there any XMAL methodologies for creating a SketchUp GUI - for example do people use the XAML tools provided by UWP methodologies or are other methodologies better -
Before I begin my work are there methodologies useful for developing cross platform (Mac / Windows) SketchUp plugins that I should know about or consider leveraging?
I’m assuming that it’s still best to use Visual Studio but if there are other IDE that people recommend please feel free to mention them.
Appreciate all thoughts and recommendations - thanks in advance.
One important question: your forum profile says you are using SketchUp Free. Are you aware that Free cannot run extensions? If you actually have Pro, please update your profile.
Generally, SketchUp extensions are coded either in Ruby atop the built-in SketchUp Ruby extension API and runtime interpreter, or in C/C++ with hooks into the Ruby API for cases when Ruby is too slow at bulk data operations. There is a C SDK, but it is mainly for creating standalone apps to manipulate SketchUp files, or importers and exporters for file types that are not supported by SketchUp natively. It does not provide separate GUI capabilities. See https://developer.sketchup.com for more information.
If an extension has a GUI, it is normally built using objects from the UI module of the Ruby API. It provides several basic dialogs and a more flexible HtmlDialog class. There is an event-driven protocol called “Tool” that handles most user event interaction with an extension and also allows drawing to the model view window without affecting the SketchUp model itself.
I suspect that using something like XAML to create a GUI within SketchUp would cause clashes over handling of the user event stream and management of the display. But perhaps someone who has actually tried it will jump in and either confirm or correct this statement.
In general, extensions only run into Windows vs Mac portability issues if they draw directly on system libraries from a specific platform, such as Win32 or rely on C code compiled for a specific platform. If you stick to Ruby and generic C/C++ libraries, there should be no problem aside from likely needing to compile separately for each platform.
Any IDE that supports both Ruby and C should work. Choice among them is largely a matter of familiarity and comfort level.
For cross platform “live” C extensions, you’ll need to know Ruby anyway.
(Ruby itself is coded in C, so it also has a C API.)
For Windows, you’ll likely use either Visual Studio or VS Code. (The SketchUp has explanations of setting up a project and how to hook up the SketchUp Debugger library.)
For Mac, it would be Xcode I believe. (I’m not a Apple consumer myself.)
If you need to dive into more low level stuff Ruby itself has a C API: The Ruby C API
You can use the SketchUp C API from a Ruby C extension, but only for read only operations. (Unless you are writing a render engine that needs to read the whole model frequently I’d recommend just sticking with the Ruby API for extension work.)
You can then use anything that can interop with C from within a Ruby C extension:
Hello community. I’m new to developing and starting to learn Ruby as well. I’d like to ask if there is a tool or something that record our movements, commands and clicks inside SketchUp and write the code like in Excel Macros and VBA. Thanks!