Did you drag and drop the exact code I wrote? Or did you edit it with your code?
I suggest copy it as I have first, test that if it works, if it crashes let me know.
Also which 3dsmax version are you using?
FYI if you are going to put your code then you need to evaluate the script, drag and drop wont work, it only works for code without the header, so for example:
macroScript ResetAndCollapse
category:"AAScripts"
toolTip:"ResetAndCollapse"
(
for obj in selection do
(
ResetXForm obj
ConvertToPoly obj
)
)
Once this is in your Editor you press CTRL+E (not drag and drop).
You can then go to Customize > Customize User Interface > Toolbars
you are missing another set of parenthesis, check my code above. I don’t use 3dsmax 2023, so if its still an issue after using the additional parenthesis you might need someone who’s using the latest version to help.
I use transform toolbox for this. It lets you reset transforms without adding modifier in the stack. Single press of a button and no need to constantly go to utilities panel and collapsing the stack. On top of that it also has some quick pivot alignment and other useful tools. I always summon this window at the start of modelling sessions and park it somewhere in the corner. I would permanently dock it in a toolbar, but unfortunately that way it creates too much wasted space.
Hm, I was just reading that the convert editable poly could have different syntax in 2023, you could try this but its a long shot.
for obj in selection do
(
resetXForm obj
convert obj #editable_poly
)
I think someone using 3dsmax 2023 could debug this one better than I could at this stage.
edit:
I had polymesh before, I updated it to editable_poly, apparently you can use these… ‘polymesh’,‘editable_mesh’,‘editable_poly’ etc.
The reset xform could also be different in 3dsmax 2023…
This won’t help you with writing your own script, but in case you’re also looking for a solution to this, Assembly Tool Plugin (free) has a function that does exactly what you described.
It’s called “Prepare Models for Work”
If it is not working, you are most probably missing the “on execute” line.
Here is the script I wrote for exactly this, it also brings the pivot to XY center and Z min:
macroscript My_macro category:"Aram Avetisyan" tooltip:"Xform, Poly, Pivot XY Center Z Min"
(
on execute do
(
for _ in $ do
(
resetxform _
convertTo _ EditablePolyMesh
_.pivot = [_.center.x, _.center.y, _.min.z]
)
)
max modify mode
)
You can then assign a hotkey for it in Hotkey manager.