Another Sketchup constants list

I’m not quite sure why I decided to do it, but I wrote some code to scrape all the constants defined by Sketchup (SU) into txt files. The only constants added from ‘native Ruby’ are the constants prefixed by ‘RUBY_’.

The files start with constants defined on Object, then constants scoped to SU class/module objects, then SU class/module objects with no constants.

I created four files, two for SU8 and two for SU2014. The _constants files are laid out in columns, the _constants_tab files are tab delimited. Same info, just different format.

They’re located at –

What I did –

First, I created a text file of all the constants defined by Ruby 2.2.3. Or, said another way, in a Ruby environment without SU.

Then, in SU, I created a hash from the items in that file, found all the constants in existence in SU, then removed any that were in the hash from the ‘Ruby only’ file.

Hence, everything left is from SU…

Some may find this helpful,

Greg

1 Like

While we have documented all public API, there are a bunch of useful constants that never seemed to have been documented. I’ve done what you just did a few times myself - to discover that constants are hidden in the system.

We got an issue open internally to improve this. I’m adding a link to this thread for reference.

Thomas,

Cool.

I’ve added a markdown file at RubyDoc, Sketchup Constants
[edit]
Now versioned with SU

SketchUp 2014 Constants

SketchUp 8 Constants

I’ve been converting some txt files into md files for RubyDoc, etc.

Root URLS are

RubyDoc

GitHub txt files
[/edit]

The table with the RenderingOptions info is generated totally by code. It shows the link between RenderingOptions and RenderingOptionsObserver. I ran it in SU2014.

I’ve started a md template, and I’ll write code to populate the sections with constant tables, using the environment and the tab delimited file generated by find_su_constants.rb.

As I said ‘started’, so the md file has a few sections that have placeholders for the constant tables. I should also be able to include a list of constants that aren’t listed r yet categorized.

I added the file ‘find_su_constants.rb’ at GitHub. I doc’d it pretty well, if you want to run it (generate files for SU2015?), let me know. FWIW, all my development is under Windows.

Thanks,

Greg

By the way, Jim Foltz has been maintaining a a repo that include stubs for the SketchUp Ruby API with its classes, modules and constants: GitHub - jimfoltz/SketchUp-Ruby-API-Doc: Help Document the SketchUp Ruby API using Yard

I’ve been using it as a way for RubyMine to gain insight and knowledge about the SketchUp API.

Thomas,

Got a little deeper into RenderingOptions constants, etc. Some very interesting things…

Anyway, see the below files on RubyDoc.info

SketchUp 2014 Constants

SketchUp 8 Constants

for info on some quirks. Also added example code to that section.

Now I’ll move on to the rest of it. When I finish it, I’ll add all the generator code.

I guess we’re both having fun with Yard,

Greg

1 Like