Q. WS script to activate a MS button.

Technical questions, etc..
User avatar
Draise
Captain
Posts: 3200
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia

Q. WS script to activate a MS button.

Post by Draise »

I have a question.

I found a script that linked and activated the LUUV obj import pluging in the ModelSide through the WorkspaceSide. I then made a button that activated this script, thus running the LUUV plugin from the WS (only works with bridge ON).

I would love to replicate a similar script to other buttons in the MS through buttons on the WS.

For example (with bridge ON obviously), I would like to run Center-Obj-Axis (which WS doesn't have but MS does) through a button in the WS. The button will run the script activity which will then call for the funtion in the MS side and center the axis, without me having to change sides and sync the bridge.

I know how to make buttons, but now I don't know how to make a script that calls a MS function.

I found this code in the WS LUUV obj import call script:

Code: Select all

function Execute(params)
{
tSBridge.RunUserPluginByPath(System.GetMainDir() + "\\tsx\\luuv\\luuv.tsx")
}
How do I find the code to a certain MS tool, how do then activate it, and then how to program that into a script to then make into a WS button/funtion?

If I figure this out, this, I am sure, will revolutionize the WS and incorporate most MS tools into the WS.

is there a "tSBridge/Run[MSfunction]" command?
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: Q. WS script to activate a MS button.

Post by froo »

Hey Draise.
Fenerit may be a good person to ask about this since he has experience with the MS code.
As I understand, MS employs python scripting. I do not know if you can record a macro on MS; I know
you can in WS. A macro would be a series of steps you take to execute a process. For example, on MS, click the cube icon, and drop it into the scene. If it is possible to record a macro in MS, you could then save that macro as a file, and call that file from WS.
MS also uses Python for scripting, so that's another way to go: on MS, write a Python script to execute a series of actions, then call that python script from WS.
There may be an easier way - it would be much more convenient to call the MS command from WS directly. Since you already know how to call a MS .tsx (a MS plugin), you could make a tsx plugin for each item you want, and call them the way you do now. If Fenerit has released his source code you could study it. The catch there is, you need a compiler that will compile the tsx (a tsx is a dynamically linked library: dll) into a form acceptable to MS. I am not sure if modern-day compilers can be configured to compile for older-generation applications like that. I suspect it is possible, though I have never tried.
With python scripting, I don't think you have that problem. But the challenge is, can you call that python script?
I may very well be missing something really simple here - there may be a much simpler solution that someone else has already come up with .
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Q. WS script to activate a MS button.

Post by clintonman »

here's a quote from the wiki(http://www.clintons3d.com/w/index.php?t ... ript_Notes" )

sdk docs "structIRiTSBCommand.html" has "SuggestTSStateByAlias" command which is used to "Call to execute a Modeler's action(click on a Modeler's button)". download Hexplorer http://sourceforge.net/projects/hexplorer/"

and running it on the tsxapi.dll file. Do a search for "Button" and one by one you can find the aliases for all the modelside buttons. Also works with items found by searching for "Panel".

also check out IRiTSBCommand in the SDK docs

There is no modelspace recording that I know of and I don't see any easy way call a python script.
Last edited by clintonman on 10 Dec 2011, 02:28, edited 1 time in total.
Clinton Reese

http://clintons3d.com
stan
Master Chief Petty Officer
Posts: 584
Joined: 21 May 2009, 17:20

Re: Q. WS script to activate a MS button.

Post by stan »

if you have ts 7 all the model side icons in that version were there as "SuggestTSStateByAlias" commands too.
here is move axis to center : tSBridge.SuggestTSStateByAlias("CenterAxesButton")
User avatar
Draise
Captain
Posts: 3200
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia

Re: Q. WS script to activate a MS button.

Post by Draise »

Wow, this is fantastic news! I need to sit down and experiment, which I think I can kinda do with the holiday spirit of holidays going on. Thanks guys for some great tips.
If it all goes well, I will make a Layout with them all for Dual and Single monitor with the plugins I use and the MS buttons.

@Stan
Thanks for the code and sample! I'm gonna definately experiment!
User avatar
Draise
Captain
Posts: 3200
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia

Re: Q. WS script to activate a MS button.

Post by Draise »

This is a little script I quickly made with the "center axis" button. I also "copied" the icon and made a button for WS. found that I needed to flatten the axis before centering it.

RMB flattens axis.
LMB runs the script and centers the axis.

Place the script in:

Code: Select all

root(default)\scripts\custom scripts


Make a new custom toolbar and then add the button.

Now I can center the axis without changing sides and loosing textures!!

ONWARDS to integrating the old to the semi old to make something new!
Attachments
Center Axis WS.zip
(21.3 KiB) Downloaded 255 times

Return to “TechForum”