I am currently working on designing my own plugin in Sketchup using the Ruby API. I was wondering whether there was any tool/extension that would allow me to record whatever I do in the program as a Ruby macro so that it would make it much easier to produce code to recreate exactly what I want. Any help would be appreciated.
No. I loved to have that feature when I started learning the sketchup ruby API years ago.
The problem is that the built-in operations in the GUI do not run Ruby, they are compiled functions. So, converting a sequence of them to a Ruby script could be quite difficult.
SketchUp creates an Undo file in the TEMP folder. It could be read and converted into Ruby statements.
Realmente Ă© uma boa ideia para uma extensĂŁo, gostei.
How to do it?
Reading and parsing text files is a basic coding skill.
In Ruby it is done with the IO
and File
classes.
looks like it’s a task for pro players only. Thanks Dan
You never said what this would be for …
Since this topic was opened, SketchUp had its Ruby observers overhauled so they only fire after the fact. So there is no way for example to know during the tool use what the user is clicking on, what the vertices they are manipulating using native tools.
If you were thinking about recording macros to “play back” later, this cannot be done with SketchUp’s Ruby and its native tools. Custom tools might play nice if they were programmed to announce the vertices and objects, etc. as they were manipulated.
So doing automated geometry tasks is constrained to Live Components and its graph trees.