Need some help with building a mesh from an obj.

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  10 October 2006
Need some help with building a mesh from an obj.

Hey folks,
I'm in the middle of learning mel, and I'm having a hard time finding resources to find out how to read from an external file.

So here is the idea:
I want to create a mel script that will take a .obj file from a directory of obj files, and build a mesh from the info held within the .obj. Then, in the rest of my script I'm planning to have the ability to build 3 types of objects from the associated obj files, randomize their size, and their position in X,Z. The type of mesh generated from the obj files will be based on user input from a window.

So, I've been able to track down fread, but I can't figure out how to get fread to read from a folder, let alone to build a mesh from obj data.

I'm also leaning toward having the folder added into the scripts folder in the maya 7.0 folder found in the particular user's my docs. Any suggestions?



Here is a simplistic version of a user interface window I plan on starting with:

	
  	window -t "GeneratorScript" -tb true -rtf true -w 300;
  
  		rowColumnLayout -numberOfColumns 4;
  
  			button -label "Make Rock" -rs true -command "makeRock";
  			button -label "Make Bush" -rs true -command "makeBush";
  			button -label "Make Tree" -rs true -command "makeTree";
  			button -label "Delete All" -rs true -command "deleteAll";
  
  	showWindow;
  
 
  10 October 2006
file -import "somefile.obj"

assuming you have the obj export plugin loaded
 
  10 October 2006
Originally Posted by Robert Bateman: file -import "somefile.obj"

assuming you have the obj export plugin loaded


Thanks Robert. I'm coming up against a small problem now, and I think it's due to my relative newness to mel... but I haven't been able to figure out how to get the script to open a file in another folder.

Suggestions? I wanted to get it from something like C:\scripts\somefile.obj

Thanks.
Dave
 
  10 October 2006
try this..

hi dbmata,

u can try this:


string $filePath="C:/whatever/whateverDocs/Desktop/tingobj.obj";
 file -import $filePath;
// change the above $filePath to what ever is ur required file path


-rgds,
__________________
|| Loka samastaa sukhino bhavantu ||
ash
 
  10 October 2006
Originally Posted by dbmata: Hey folks,
I'm in the middle of learning mel, and I'm having a hard time finding resources to find out how to read from an external file.

[/CODE]



I'm a big fan of:



global proc fileCallback(string $fileName,string $type)
{
print($fileName +"\n");
}

fileBrowser( "fileCallback", "buttonMessage", "", 0 );

so that you can see how directories and files are described in MEL on your system. It also makes for a nice generic file open interface...
 
  10 October 2006
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 11:20 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.