Macro Problem with executing a chain of commands

I am completely new to Macros :frowning:

I have a very tedious task when having to clean up large 3D models.

I need to merge several planar surface sections into ONE large planar surface and usually simply follow these commands by clicking on each command in sequence in a small custom toolbar:

manually select all surface sections I want to merge.
click on the following commands in sequence:

_Join

_DupBorder

_PlanarSrf

_SelCrv

_SelPolySrf

_Delete

I would love to create a new Macro command that does ALL THAT with just one single click of a button but simply cannot make it to work.

I created a new command button and simply pasted the above sequence of commands but it will only go so far as joining the selected surfaces and won’t go any further :frowning:

Could someone please help me out what I am doing wrong?

Does running the command _MergeAllFaces on the joined surfaces work for you?

No, it does not work :frowning:

None of the MergeXXX commands actually work on these surfaces (these are simply trimmed co-planar surfaces which can be easily joined into a polysurface and then further worked with).

The sequence of commands I listed works fine with them, the “MergeXXX” commands do not for some reason.

If I run the sequence of commands as outlined above (I use them in a small toolbox and click on the buttons) it works fantastic and I would love to learn how to string this sequence of commands into one Macro but am currently completely stuck as building Macros is apparently not as easy as just listing the commands but needs some extra commands in between of which I have not the slightest clue :-().
I have spent already a couple of hours, searching and reading Macro tutorials but I am stuck after the first command !@#$%

OK, that is surprising… Since what you are wanting to macro does essentially the same thing. Can you post a file with something that works with your “manual” procedure and fails with MergeAllFaces?

As far as the Macro goes, that can be made to work I think, you just need to be conscious of how things are selected/deselected. Macros are somewhat limited in that way. For example _SelPolysrf will select ALL selectable polysurfaces in the file, not just the one you are working on.

You might want to have a quick read of the article below to understand the basics of macros, in the meantime, I will look at making your macro work the way you want…

https://wiki.mcneel.com/rhino/basicmacros

OK, here is an example… Note the use of the _Pause command to let you pick objects on the screen, as well as the use of SelLast and SelPrev. Look in the help about macros to see what they do.

For V5 - both Windows and the current version for Mac, there is a problem with picking multiple objects in certain commands (like Join), you need to have one Pause for each screen pick. As the number of picks are variable, you just need to put in as many pauses as the max number of objects you think you might want to pick. Doesn’t matter if there are too many, the unused pauses are ignored, so you can put in a hundred of 'em if you want. If objects are pre-picked, the _Pause commands concerning picking are also ignored. So the macro looks like this (pick up to 12 surfaces post-pick, unlimited if pre-picked):

! _Join
_Pause _Pause _Pause
_Pause _Pause _Pause
_Pause _Pause _Pause
_Pause _Pause _Pause
 _SelLast _DupBorder
_SelPrev _Delete _SelLast _PlanarSrf
_SelPrev _Delete

For V6, the _Pause issue above has been addressed with a new MultiPause command, so the macro looks like this:

_Join _MultiPause _SelLast _DupBorder
_SelPrev _Delete _SelLast _PlanarSrf
_SelPrev _Delete

HTH, --Mitch