Enhancement of 3Ds Max poly extrude

Hi All,

I have a question regarding 3Ds Max poly extrude technique. While modeling I faced a problem lots of time and I try to find some solution but didn't get any thing. I know scriptspot is great community of max scriptors. So if any one can do something, will be great.

I have made a picture, which may describe the problem more elaborately.

Normal Cube with three subdivision.

Middle Polys are selected for extrusion.

While Extrding it happened like this.

If the final result may look like this, then it would be great.
I did manual vertex manipulation to achieve the result.

Thanks $ Regards,


Comment viewing options

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

Error when undoing

Your scripts works perfect untill i try and undo the operation, 3ds max crashes. im using 2016.

Syphorlate's picture

Improved Version

Here's a new version with a few bug-fixes. It's still a bad preview mode but kind of don't know how to make it faster/better. Any ideas are welcome.

smartextrude.rar 1.39 KB
miauu's picture

Hi! The script with faster

The script with faster preview is already writen. I will see the improved version and will make the changes. But.... or ... there is one big problem with extrusion. I have 3 different versions of smartextrude script. The first one work verry fast and with no bugs only with single poly loop(every verts can belong to 2 or 3 faces). If there is a vert that belong(is common) to 4 verts the extrusion don't work. The second version work fine with verts that belong to 4 faces. The third version work with any combinations of face selection, but is a bit slower than first 2 version.

Syphorlate's picture

When you change the script

When you change the script you need to take care that no vertex is processed twice. I had this problem at the beginning. Since I loop through the faces it happens that vertices are changed multiple times because more faces share one vertex. So you need to make sure that you don't change the same vertex more than once. For that purpose I keep an array of the indices of the vertices I changed already using "appendifunique" to prevent a vertex from being changed twice.

Instead of looping over the faces it might be possible to loop over the vertices. But you need the normal of the face for the calculation. So you need to get the faces that are using that vertex and pick the facenormal of one of them. This solution should be faster than looping over the faces where you have to maintain an array of already changed vertices. But you have to get the vertices of the selected faces somehow...

miauu's picture

Every verts is processet

Every verts is processet once, but... Here the example:
Cub 4h4h4 sides. If I select faces only in one side - the script work with no errors. If I select the faces from 4 sides that for the loop - the script give the strange result(all verts is processed once). But, as I said there is a version of the script that works fine in every possible face selection. It is a little bit slower than my first two solutions, but it works.

Syphorlate's picture

Ok this also happens in my

Ok this also happens in my version of the script? You have a screenshot? Also sometimes it happens that the underlying 3ds max extrusion gives crappy results due to overlapping or something. dont know...

miauu's picture
Syphorlate's picture

Ok. This is truly weird.

Ok. This is truly weird. Unfortunately I don't have enough code information to say why this is happening. I guess there must be something wrong with this vertinfo thing or this pogetvert function, don't even know what they're doing.But since I don't have these issues I guess the errors must be there somehow.

So without knowing complete code I can't say what the matter is. So it would be interesting to know how you actually improved the preview mode.

EDIT: it could even just be the order of the faces. since some vertices are altered and others not the order of how the vertices are changed might have an influence(this would be a downside of this method) although I don't really know if this can be the cause.
I discovered that in rare cases it can happen that "fac" becomes invalid. so it's best to ensure fac is between 1.0 and 1.4142...

miauu's picture

The new script is uploaded.

The new script is uploaded. Download it, unpack the mzp file and look at the SmartPolyExtrude_v10.ms. The comented function give the errors. The uncomented use your method for extrusion - create the copy of the original object, but that copy is created only once, then the "theHold" is doing the preview, and that is faster then creating the new copy again and again.
In some cases your method do not straight the faces - watch the video - sphere and pyramid primitives. For that reason the Axis Poly Extrude is can do the job, but...
Anyway I hope that you don't mind to use your code in my script. :) If you want I can change the name and category of the script or I can put any informations that you want in the script body.

Best Regards!

Syphorlate's picture

Thanks miauu.You did a great

Thanks miauu.You did a great job! This preview mode is really better than mine(better to see the selection). Really good work!

But I hope you don't mind if I criticize a few points. For instance when I select a lot of faces it seems to be slower than my method(unless I use the loop functionality then it is indeed faster). Also I had a crash when I tried to select another object "attempted to access deleted object".
Also there seems to be a problem with the implementation of my extrusion function. It doesn't produce the same results as my method when the extrusion value is negative. I don't know if someone would ever use a negative extrusion value. But it can be used for creating some sort of "folds" using the turbosmooth modifier. So i'd fix that.

One more thing I like to mention is that my method does indeed not produce straight results when there are faces which form a 3D volume. This is because I forgot or rather neglected that there are two angles involved that describe the orientation of a vector in a 3D space. Right now my method only uses one of them which produces nice results most of the time but there are situations where it doesn't work so well. I believe when I incorporate both of these angles I can make the extrusion model really stable even for complex 3d meshes.
Also I would like to implement a bevel version of the script in the near future which is not an easy task too.

And generally it is ok to use my work in your script as I stated already. I did this mainly so that scripters who need this functionality can put it inside their scripts. It would be nice however to mention my nickname inside the scriptUI to advertise my brand since I plan to add some other cool scripts on scriptspot under my nickname soon.

Thanks for your cooperation!

Comment viewing options

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