Button created

I created a button with the following script:

‘_SelAll
_Explode
’_SelAll
_Options
_Join
_SetDisplayMode
Select a display mode ( Viewport=Active Mode=Wireframe ): _Viewport=_Active
Select a display mode ( Viewport=Active Mode=Wireframe ): _Mode=_XRay
_Save

When I execute the script, Rhino runs the following when it comes down to the SetDisplayMode:

Command: _SetDisplayMode
Select a display mode ( Viewport=Active Mode=Wireframe ): Select
Select a display mode ( Viewport=Active Mode=Wireframe ): a
Select a display mode ( Viewport=Active Mode=Wireframe ): display
Select a display mode ( Viewport=Active Mode=Wireframe ): mode
Mode ( Wireframe Shaded Rendered Ghosted XRay Technical Artistic Pen ): ( Viewport=Active Mode=Wireframe ):
Unknown command: ( Viewport=Active Mode=Wireframe ):
Mode ( Wireframe Shaded Rendered Ghosted XRay Technical Artistic Pen ): _Viewport=_Active
Unknown command: _Viewport=_Active
Mode ( Wireframe Shaded Rendered Ghosted XRay Technical Artistic Pen ): Select
Mode ( Wireframe Shaded Rendered Ghosted XRay Technical Artistic Pen ): a
Display mode set to “Artistic”.

Where is the mismake in my Initial script?

What exactly are you trying to accomplish? --Mitch

I am working on the importing of about 40 000 STP files. I need to change the mesh setting from initially 0.6 to 1, cut away certain parts, fillet sections etc and save them later as *.3dm.
This button I created (inlc. the script) is just a routine to save a few clicks for me

What does the display mode setting do for you in this case? I don’t understand that part.

Are you talking about the display mesh density setting here?

–Mitch

Absolutly!
If I could include this manual change into the script as well, it would help to eliminate another few manual steps. I just dont know how. I never scripted before. Those are my first few baby steps

Well, if you are importing files, the display mesh only needs to be set once when you initially create the blank file for the import. You can also create a custom template file that already has that setting in it. So I feel this is relatively unnecessary for every import. If you needed a button to do this once, you could macro:

-_DocumentProperties _Mesh _Custom _Density=0.6 _Enter _Enter

You can also control any of the other custom mesh settings this way, run the dash version of DocumentProperties > Mesh > Custom and see what you can set on the command line.

–Mitch

Mitch,
Thank you and it already gets me a step close. Unfortunately I does not solve my initial problem of executing a different scrip than written in my script of my button
Maybe I need to elaborate a little bit more.
I am pulling STP files from your ProFile server. Those files are production files and are lacking of important geometries for marking purposes (renderings are made from those files). I am adding those geometries in Rhino, after I simply dragged the STP file into Rhino. I don’t want to use a generic Blanco file to drag the STP file into, because I want to maintain the file name and location when I save otherwise I would have to manually write the file name and cut and past the file location when I simply save the newly created *.3dm
When I save a file, It needs to be shaded before with a mesh density of 1 to proceed faster and better tessilation to my renderer.

OK, yes, unfortunately, when you drag and drop a file, Rhino uses a hard-coded template setting - don’t know why that is actually - so you cannot pre-set the mesh settings as you can using a template file. The macro posted above will work for setting the mesh density after opening the file, to change it to 1 it would be

-_DocumentProperties _Mesh _Custom _Density=1.0 _Enter _Enter
I don’t know why you are needing to explode and rejoin your objects as per your original script…

–Mitch

Mitch,

those STP contain objects that are in blocks. Exploding and rejoining them seperates the different blocks and I can proceed altering the geometry

Ah, OK. I might try the _ExplodeBlock command (_AllBlocks option) to see if it works for you - might go faster?

So a macro might be:
(run after drag and drop open file)
-_DocumentProperties _Mesh _Custom _Density=1.0 _Enter _Enter _ExplodeBlock _AllBlocks

If you want to save the file automatically, you can add:

_-Save _Enter
to the macro, but attention, that will save the file in the current directory, and if there is an existing file with that name it will overwrite it without a warning. Otherwise, you can just add _Save (no dash) and let the dialog come up.

–Mitch

Mitch,

thank you so much for all your help. This got me alot further AND I some interresting Details became clear to me.

Any thoughts on the wrongly executed _SetDisplayMode section?

try:
_SetDisplayMode Viewport=Active Mode=XRay

instead of:
_SetDisplayMode Select a display mode ( Viewport=Active Mode=Wireframe ): Viewport=Active Select a display mode ( Viewport=Active Mode=Wireframe ): Mode=XRay

Jarek,

this did the trick! I dont understand why but I am happy that it behavs exacty what I have been looking for.
thank you