Show messages:
1-20
21-23
From: fcwilt
Hi,
I have been thinking about the amount of time I spend in MoI doing "grunt" work.
Example: every time I need to export a new set of STL files I have to be sure only the objects of interest are selected.
My projects include all of the parts to be 3D printed but also all the other parts of the product I am working on, such as hardware, electronics, etc. - none of which, of course, need exporting.
It's not terribly efficient doing it via manual selection, over and over again, every time I need to update the STL files, because of changes to them in the project.
So it would be grand if, on a project basis, I could create a "preset" which I could trigger which would then select only those objects needing export.
It would be nice to have it "built-in" to MoI - something like saving the current state of object selections and then being able to apply it as needed.
But I would also be willing to create a unique script for each project - if I had a example to go by.
Just a thought.
Thanks much.
Frederick
From: Michael Gibson
Hi Frederick, if the objects have changed how would the new ones be identified?
Do they all have names so you want to reselect the objects with the same name?
Are these objects inside groups?
It would help if you could post a simplified example file with a few objects in it and show a screenshot of how you want the selection to be done.
- Michael
From: fcwilt
Hi Michael,
Will do.
Give me a few. About to have dinner.
Frederick
From: fcwilt
Hi Michael,
I have not been able to upload an 8 MB (appx) file.
Keep getting an error.
Question: does the forum save things I upload? If so how do I delete them once done with them.
Anyway let me try to decide how I work.
- With minor changes I keep the same file name.
- With major changes I save the project with a new, versioned file name.
- When exporting STL files I don't worry about which ones have changed and which ones have not, I simply export them all, so I know that a given set of exported files were all of the same "version" at the time of the export.
So that's why I talked about a way to create a "preset" that could be used to reselect a save saved of selections.
The first step would be:
- Select the objects to be exported and create the "preset".
Then the next time I needed to export:
- "Run" the preset to re-select the same set of objects that were selected when the "preset" was created.
Usually a project is divided into "sub-assemblies" by putting all elements of a given "sub-assembly" into a group. And generally work proceeds on a given "sub-assembly" until it is ready for a export to print the parts for testing.
So a system that would only work on a group would be OK but it would be best the selections to be saved in the "preset" could be any objects in any part of the project file.
Frederick
From: Michael Gibson
Hi Frederick,
re:
> I have not been able to upload an 8 MB (appx) file
You're probably out of attachment space, you can go to Options on the top bar, then "Attachments" on the left and remove some old ones to free up some space.
But it would be better to have a small simplified example.
> Question: does the forum save things I upload? If so how do I delete them once done with them.
Yes, when you upload an attachment it's saved on the web server. You can delete them using "Options" on the Top bar, then "Attachments" on the left.
re:
> Then the next time I needed to export:
> - "Run" the preset to re-select the same set of objects that were selected when the "preset" was created.
If you've edited some of the objects after the preset was made then you don't have the exact same set of objects anymore.
So it's not possible to just "re-select the same set of objects" when you don't have the same objects.
If you have some way of identifying the objects like they have the same name set on the original and the new edited version then that could work.
- Michael
From: fcwilt
Hi Michael
I will clean up my attachments.
When done in code are selections going to be by name?
Rather than a "preset" feature what about having a place in the MOI.INI file to specify a prefix character/string that would be used to identify those files to be exported as STL, using an "special" Export command that didn't go by selection status but rather by objects with the prefix character/string?
Could that be done?
Frederick
From: Michael Gibson
Hi Frederick,
re:
> When done in code are selections going to be by name?
It can be done by name, by id value, by style assignment, by user data, etc...
If you do have the exact same objects then by id is best but if you have edited an object the new edited version of it has a different id value.
> Rather than a "preset" feature what about having a place in the MOI.INI file to
> specify a prefix character/string that would be used to identify those files to be
> exported as STL, using an "special" Export command that didn't go by selection
> status but rather by objects with the prefix character/string?
But how is a special "prefix instead of selection" based export any different than setting the selection by prefix and then using regular selection based export?
You can select by prefix currently by typing Tab to put keyboard focus in the XYZ input in the bottom toolbar, then type your prefix and then *
For example if you have a bunch of objects with a prefix BC then type Tab, then BC* and push Enter and objects that have a name starting with BC will be selected.
- Michael
From: fcwilt
Hi Michael,
-------------------------------------
But how is a special "prefix instead of selection" based export any different than setting the selection by prefix and then using regular selection based export?
-------------------------------------
It's different in that I don't have to keep using the "select by name" feature .
Given a Export command that would select by a pre-established prefix I would just issue the command and the STLs would be exported.
Anytime I want to export, one click - instead of TAB, type the prefix, then issue the Export command.
I update the STL files frequently and since their are all done at the same time they all have the same time stamp in Windows - which is very helpful - to me.
Frederick
From: Michael Gibson
Hi Frederick,
re:
> Anytime I want to export, one click - instead of TAB, type the prefix,
> then issue the Export command.
You can set up a shortcut key that will combine those into a single keypress.
For example:
script: moi.geometryDatabase.deselectAll(); moi.geometryDatabase.selectNamed( 'BC*' ); moi.command.execCommand( 'Export' );
- Michael
From: fcwilt
Hi Michael,
How slick is that!
I will give that a try tomorrow.
Frederick
From: fcwilt
Hi Michael,
That script worked just as desired.
One, hopefully final, related question:
The dialog that appears when exporting to STL, "MeshOptions", I'm guessing that is buried deep within MoI and cannot be easily bypassed?
Frederick
From: Michael Gibson
Hi Frederick,
re:
> I'm guessing that is buried deep within MoI and cannot be easily bypassed?
It can be bypassed when calling it from a script, like this:
script: moi.geometryDatabase.deselectAll(); moi.geometryDatabase.selectNamed( 'BC*' ); moi.geometryDatabase.fileExport( '', 'NoUI=true' );
That will use defaults for meshing parameters. You can also send in mesh parameters by using these options separated by semi-colons in the 'NoUI=true' string:
// Different possible options:
// NoUI=true
// Angle=12.0
// Output=ngons | quads | triangles
// MaxLength=0.0
// MaxLengthApplyTo=curved | planes | all
// MinLength=0.0
// AspectRatio=0.0
// Weld=true
// Display=shadedwithedges | shadednoedges | wireframe
// ExpandedDialog=false
- Michael
From: fcwilt
Hi Michael,
It seems you have thought of everything.
Just amazing work.
Thanks - you have made this camper very happy.
Frederick
From: fcwilt
Hi Michael,
Just when I think I'm starting to understand this stuff I find I don't.
Using the prefix works great for simplifying object selection.
But I really don't need the prefix in the exported STL files.
So I read about the java script slice function which sounds like what I need to remove the STL_ from the object name when creating the filename for exporting.
I tried an experiment, using the ExportParts command you created for me, but I get an error - cannot find variable "slice".
So I'm guessing to use slice (and others things like it) I need to use something like xxx.slice where xxx is where slice "lives"?
Frederick
From: Michael Gibson
Hi Frederick,
re:
> So I'm guessing to use slice (and others things like it) I need to use something like xxx.slice
> where xxx is where slice "lives"?
Yes, that's correct. The xxx should be a string object, like this:
var str = 'STL_Test';
// str is a string that contains 'STL_Test'
var str2 = str.slice( 4 );
// str2 contains a chunk of the original string starting at index 4 and through to the end so it contains 'Test'
moi.ui.alert( str2 );
If you're stuck please post your modified ExportParts.js file.
- Michael
From: fcwilt
Hi Michael,
I was treating it like a "library" function passing it both the string and the index.
Old school.
Thanks much.
Frederick
From: fcwilt
Hi Michael,
It's working just fine.
I was wondering about a way to display "debug" messages - and it was in the code you posted . Handy.
But something is generating a prompt to select parts to export - even though the code appears to be selecting them correctly before the prompt appears.
The prompt is a good thing because it gives me a chance to cancel the export if I invoked it by mistake.
But what is generating the prompt?
And a related question:
The .HTM file - that provides a user interface if needed?
Is it required?
What invokes that file?
Can you use that file to collect input and feed it into the script?
Thanks.
Frederick
Attachments:
ExportParts.zip
From: Michael Gibson
Hi Frederick,
re:
> But what is generating the prompt?
It's the call to GetObjects().
The object picker will only target preselected objects if the selection happened before the command started.
Since you want to automatically select stuff instead of having the user pick them you probably don't want to use the object picker there at all.
Instead of calling GetObjects() you could call moi.geometryDatabase.getSelectedObjects(); and to wait at the prompt you could call WaitForDialogDone() instead of GetObjects().
> The .HTM file - that provides a user interface if needed?
Yes the .htm file has the UI for the command which will be loaded into the command options area in the upper right of the main window.
> Is it required?
No, if the command doesn't want to show any UI there the .htm file can be omitted.
> What invokes that file?
It's part of the "command" infrastructure. When you run a command if there is an .htm file present it will get loaded into the command options area before the .js code is run.
> Can you use that file to collect input and feed it into the script?
Yes you can put controls in the .htm and the script can access them.
- Michael
From: fcwilt
Hi Michael,
Thanks very much for the feedback.
Since you can collect user input from the .HTM file, and I gather there is no real documentation, do you know of a good example, that is simple enough to learn the basics from?
I think I'm getting the hang of this stuff.
Frederick
From: Michael Gibson
Hi Frederick, I've attached an example here.
- Michael
Attachments:
Example.zip
Show messages:
1-20
21-23