Script request

Next
 From:  shayno
11746.1 
Hi Michael
I am using ver 4 (which is brilliant thanks)

Can you please write me a script that
saves an output file as my current file name
to a specified output folder ( it will always be the same )
as an stl angle 3

king regards
shayne
  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
11746.2 In reply to 11746.1 
Hi shayne, are you on Mac or Windows?

- 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:  shayno
11746.3 
Windows Thanks 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:  Michael Gibson
11746.4 In reply to 11746.1 
Hi shayne, here you go:

script: var folder = 'c:\\scripts\\'; var filename = moi.geometryDatabase.currentFileName; if ( filename ) { var index = filename.lastIndexOf( '.' ); if ( index != -1 ) { filename = filename.substr( 0, index ) + '.stl'; filename = folder + moi.filesystem.getFileNameFromPath( filename ); moi.geometryDatabase.saveAs( filename, 'NoUI=true;Angle=3' ); } }

Edit this part:
var folder = 'c:\\scripts\\';

to put in your output folder.

Note that to make a backslash character (\) there you will need to put in two backslashes because it's used as an escape character.

- 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:  shayno
11746.5 
Hi Michael
That is brilliant thank you so much .
It will save me countless time every day
cheers
shayne
  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:  shayno
11746.6 In reply to 11746.4 
Hi Michal
is it possible at the end of the script to have it copy the 3dm filename into the clipboard also ?
cheers
shayne
  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
11746.7 In reply to 11746.6 
Hi shayne,

re:
> is it possible at the end of the script to have it copy the 3dm filename into the clipboard also ?

Yes, try this one:

script: var folder = 'c:\\scripts\\'; var filename = moi.geometryDatabase.currentFileName; if ( filename ) { var index = filename.lastIndexOf( '.' ); if ( index != -1 ) { filename = filename.substr( 0, index ) + '.stl'; filename = folder + moi.filesystem.getFileNameFromPath( filename ); moi.geometryDatabase.saveAs( filename, 'NoUI=true;Angle=3' ); } moi.copyTextToClipboard( filename ); }

- 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:  shayno
11746.8 
Hi Michael
It copied the full path c:\to print\filename.stl

I just need the filename only if that is possible without any .stl or .3dm
Thanks
shayne
  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
11746.9 In reply to 11746.8 
Hi shayne, try this one:

script: var folder = 'c:\\scripts\\'; var filename = moi.geometryDatabase.currentFileName; if ( filename ) { var index = filename.lastIndexOf( '.' ); if ( index != -1 ) { var basename = filename.substr( 0, index ); filename = basename + '.stl'; filename = folder + moi.filesystem.getFileNameFromPath( filename ); moi.geometryDatabase.saveAs( filename, 'NoUI=true;Angle=3' ); moi.copyTextToClipboard( moi.filesystem.getFileNameFromPath(basename) ); } }

- 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:  shayno
11746.10 In reply to 11746.9 
Thanks Michael

it errors

ReferenceError: Can't find variable: basename

line 1

1: >> var folder = 'D:\\To Print Morris and Watson\\'; var filename = moi.geometryDatabase.currentFileName; if ( filename ) { var index = filename.lastIndexOf( '.' ); if ( index != -1 ) { filename = filename.substr( 0, index ) + '.stl'; filename = folder + moi.filesystem.getFileNameFromPath( filename ); moi.geometryDatabase.saveAs( filename, 'NoUI=true;Angle=3' ); moi.copyTextToClipboard( moi.filesystem.getFileNameFromPath(basename) ); } }

If its too hard to do don't spend any time on it
cheers
shayne
  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
11746.11 In reply to 11746.10 
Hi shayne,

re:
> it errors
>
> ReferenceError: Can't find variable: basename

It looks like you only copied the last piece of the above script?

You are missing this part in the new version above:

script: var folder = 'c:\\scripts\\'; var filename = moi.geometryDatabase.currentFileName; if ( filename ) { var index = filename.lastIndexOf( '.' ); if ( index != -1 ) { var basename = filename.substr( 0, index ); filename = basename + '.stl'; filename = folder + moi.filesystem.getFileNameFromPath( filename ); moi.geometryDatabase.saveAs( filename, 'NoUI=true;Angle=3' ); moi.copyTextToClipboard( moi.filesystem.getFileNameFromPath(basename) ); } }

Try copying the entire script from above not just the ending part.

- 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:  shayno
11746.12 
Works perfect thanks shayne
  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