5 votes
Author Name: 
Vojtech Cada

Say goodbye to scripts that only work with Editable Poly and not Edit Poly modifier. PolyModOp is a MAXScript struct wrapping the Edit Poly methods using the familiar signatures of the polyop methods. That means you check once at the beginning what kind of object you are dealing with, pick either polyop or polymodop, and the rest of the code will be the same as if you were writing it for Editable Poly.

See the Border Fill script for an example tool (the main aim is ease of coding and maintainability, so don't expect it to work lightning fast on complex meshes). Released under ISC license to be as permissive as possible (in short do what you will with it, just don't blame me for the result). The methods that are not implemented are listed in the missing_methods text file.

If you think think the current way of working with the Edit poly modifier is limited and should be changed, and you want a better solution, be sure to vote up PolyModOp functions same way as PolyOp functions at 3ds Max Ideas.

Additional Info: 

Installation: Copy the .ms file inside the stdscripts folder (evaluate once if this is your first time using it), that way it will be available for scripts in the script folder and macroscripts. FileIn approach is another alternative.

Usage: There are many ways to skin a cat, what I do is define one local (polySwitch in my case) to hold polyop/polymodop struct and initialize it on execution:

obj = modPanel.getCurrentObject()
polySwitch = if isKindOf polyModOp structDef AND isKindOf obj Edit_Poly then polyModOp else polyOp

In the rest of the code, use all the methods as if you were using polyop methods. Since I use modPanel.getCurrentObject() to get the obj, I've written it with that in mind. Which means that unless you supply a node: parameter, the coords will be local to the Edit_Poly/Editable_Poly object. Many of the methods need the modify panel to be active, there are only a few of them that don't. I don't have a list, you can report your success in using them that way and I will add the comments.

Some of the methods might not work as expected so exercise caution. I haven't tested each of them.

There's no readme and no FAQ, so don't be afraid to ask. Feedback and improvement suggestions are appeciated, too.

0.02a: added get/setRefCoordsys check
0.01a: initial release

Version Requirement: 
3ds max 9+
LICENSE.txt759 bytes
polyModOp_v0.3a.ms21.3 KB
missing_methods_0.3a.txt2.64 KB


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Swordslayer's picture


I'd write it using polyop. and search&replace in the end. After all, the methods are the same for both.

fajar's picture

Damn , is there any way to

Damn , is there any way to make maxscript using this as additional autocomplete, like in VS editor ?

Swordslayer's picture

Sure thing

I was using it for quite a few years and got so accustomed to it that when I shared scripts like the Heuristic Edge Select, I just ripped parts of the polymodop struct out instead of rewriting the script for public consumption. Recently, I found those ripped-out parts attached among other MXS related tips in a Russian vkontakte post, thought that it's nice to see that someone takes notice and decided to share the whole thing. That small part was not really that much helpful anyway.

And it's always nicer to have an Edit poly version that comes at no additional effort - and might be slower than if you coded it specifically for Edit poly - than no Edit poly version at all. Well, not exactly no effort as you have to use pure polyop stuff, so instead of shorthands like obj.selectedVerts as bitarray use polyop.getVertSelection and if there are any non-polyop methods involved that differ between Edit poly and Editable poly (like obj.bridge), you have to handle those yourself - but that's about it and when you get used to writing scripts this way, it eventually really becomes no effort.

lightcube's picture


Thanks Vojtech! That's awesome. I'd been wanting something similar for a long time but just didn't get around to it. Thanks for sharing :)


Shawn Olson

Developer of Wall Worm

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.