PDA

View Full Version : script manager help


Shane W
10-25-2007, 08:24 PM
I posted this in the scripting/coding section but didn't get any bites. Is it possible to define a file path in a script manager script? I would like to set up a script to automaticaly merge in a obj from a specific directory. I import alot of objects from Rhino and would like a one click solution to bring them into Cinema.

Thanks,


-Shane

JamesMK
10-25-2007, 08:48 PM
The safe way is to start with a call to GeGetRootFilename() which returns a Filename object corresponding to the script location.

EDIT: Turns out that it's better to use GeGetStartupPath() instead, as otherwise you only get the name of the script rather than a path. /EDIT

Then use AddLast(string) and RemoveLast() on that object to carve your way towards a fully qualified path and filename - send the result off to your loader code.




.

Shane W
10-26-2007, 01:01 PM
Hi James, I tryied your suggestions but I have to admit I have no idea how to write the code. What I need to do is merge this file "C:\temp\temp.obj" into Cinema. I have a script in Rhino that exports a seleced object and saves is as temo.obj and I would like a single button is Cinema to go retrieve the temp.obj. file. Could someone give me an example of what the code would look like?

-Shane

Katachi
10-26-2007, 02:15 PM
if you want to use the script on PC only then itīs no problem to use a hardcoded version of your path like:

var file = "C:/temp/temp.obj"
LoadDocument(file);

Should work.
Hope that helps

JamesMK
10-26-2007, 02:25 PM
The problem with LoadDocument(...) however is that it doesn't actually merge the referenced file, it opens it as a separate scene.

As far as I've been able to find out from the SDK, there is no way to access the merge function from coffee unless you write the whole thing as an import plugin...

You could of course use CallCommand(12096), but that only gets you to the standard fileselector, which basically doesn't help one bit at all here.

JamesMK
10-26-2007, 02:26 PM
// double-post //

Katachi
10-26-2007, 03:10 PM
yep, merging is not possible. missed that he wants to merge the obj file.

Shane W
10-26-2007, 08:12 PM
Bummer! Thanks for all your help.

CGTalk Moderation
10-26-2007, 08:12 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.