Show messages:
1-15
16-23
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
From: fcwilt
Hi Michael,
Thank you.
Going back a post or two to where you mentioned this:
-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().
I could not get it to work.
See attached.
Thanks.
Frederick
Attachments:
ExportParts.zip
From: Michael Gibson
Hi Frederick, almost - so what I meant was get rid of all the objectpicker stuff and you can get the selected objects by the return value of moi.geometryDatabase.getSelectedObjects(), like:
var objs = moi.geometryDatabase.getSelectedObjects();
And now that it's selecting objects by name there won't be any unnamed objects selected so I think you can skip the deselectUnnamedParts part as well.
So maybe just this (untested):
function ExportByPrefix() {
mgd.deselectAll();
mgd.selectNamed(pfix);
WaitForDialogDone();
DoExportParts( mgd.getSelectedObjects() );
}
re:
// what are these 4 lines below supposed to do
Those were updating the prompt (the top line in the command options area) by hiding one line of text and showing the next one.
- Michael
From: fcwilt
Hi Michael,
That seems simple enough.
I will give it a try shortly.
Thanks.
Frederick
Show messages:
1-15
16-23