Batch create SubD from File

Next
 From:  stanDM
10255.1 
Hi,

just wondering if it is possible to batch open OBJ SubD files and save them to 3dm using JavaScript. I can do it manually (and it works), but I have dozen of such files and it would take hours to do so. I have some scripts to batch open STEP files and it woks great, but OBJs cannot be opened in a standard way like other formats ...

Thanks a lot for any help!

Stan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10255.2 In reply to 10255.1 
Hi Stan, so for opening a STEP file you were probably using moi.geometryDatabase.open() ?

For opening a sub-d file same as the SubD > Create > From file on the side pane, use this:

moi.geometryDatabase.fileImportSubD();

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  stanDM
10255.3 In reply to 10255.2 
Hi Michael,

this sounds very cool! For STEP I use the following code (plus the code which retrieves files from the folder and calls Convert function) :

function Convert( FileName )
{
var gd = moi.geometryDatabase;
gd.open( FileName, true );
var xFileName = FileName.substr( 0, FileName.lastIndexOf('.') ) + '.3dm';
gd.saveAs( xFileName );
gd.fileNew( true );
}


So is that like instead of

gd.open( FileName, true );

I would use just

gd.fileImportSubD( FileName, true );


Thanks thousand times!

Stan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10255.4 In reply to 10255.3 
Hi Stan,

re:
> I would use just
>
> gd.fileImportSubD( FileName, true );

That will probably work but it's actually expecting just the filename, so just put:

gd.fileImportSubD( FileName );

The additional parameter on open() is for not showing the "save changes" dialog.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  stanDM
10255.5 In reply to 10255.4 
Hi Michael,

I got it working with True param as well, but I will modify it so it gets just file name. This will save me tons of time, thank you very much once again. Great support!

Stan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All