Call an Extension Programmatically?


#1

Is it possible? Say, for example, you have a script were you do a few things then upon completion, you want to activate TIG’s SectionCutFace Tool to prompt the user to create a section?


#2

SectionCutFace is encrypted…
You could poke about in the various modules and methods, and test some examples…
e.g.

TIG::SectionCutFace.new() if TIG::SectionCutFace.ok()

So if a section-plane is preselected the tool runs…

Don’t wrap it in a commercial Extension !


#3

Building on @TIG’s point, a SketchupExtension instance registers various metadata with SketchUp’s ExtensionManager object when it loads. That metadata includes the path to the so-called “outer .rb file” that sets up the extension to run. But that outer file can do almost anything and can name its classes and modules any way the author chooses. The ExtensionManager has no idea how the extension actually works. Without inspecting the source code, you can’t know how to get a new instance object to attempt to activate it, and if the source is encrypted you can’t (legitimately) inspect it! TIG generously dropped a hint for this specific case, but you can’t conclude anything general from it.


#4

OK, sounds like a soft NO. Thanks, its back to the drawing board.

BTW, I would never consider it for something commercial. I write little scripts here and there to help with my own productivity. As an architect, there are many things I do OVER and OVER.

TIG, I would love to see under the hood of SectionCutFace to learn how it works but I understand its IP!


#5

if the ‘tool’ your after has menu item and a command object, and has a shortcut key assigned to it…

you can use cliclick or mousetools [bin scripts for a mac] to send those keys…

if you want I’ll PM you an example for an AC type ‘Move Copy’ I made recently…

all it does is activates ‘Move Tool’ and then sends to invoke copy…

john


#6

Bam! Yes please! That is exactly what I was wondering.

I am ok with it being a little hacky because I can control the user environment.