PDA

View Full Version : How to make a script of repetitive task


jileshpatel
07-18-2009, 06:33 AM
Hi, I am novice to max scripting and I m wondering it there is way to make script button for some repetitive task in 3dsmax, as an example, I am importing many STEP files from powernurbs into 3dsmax and then doing some clean-up tasks like, welding, n optimizing. like....

----

select mesh object then "convert mesh to poly"
then select vertex mode - select all
then weld them to 0.001 threshold

then select Optimize modifier
select LOD - Face Threshold to 1
Auto Edge on

then select Edit Poly Modifier on that n "Collapse To"

----
I have tried Macro Recorder but it didn't work for me.
Please guide me how to do that thing n make button.

Regards.

denisT
07-18-2009, 09:06 PM
Hi, I am novice to max scripting and I m wondering it there is way to make script button for some repetitive task in 3dsmax, as an example, I am importing many STEP files from powernurbs into 3dsmax and then doing some clean-up tasks like, welding, n optimizing. like....

----

select mesh object then "convert mesh to poly"
then select vertex mode - select all
then weld them to 0.001 threshold

then select Optimize modifier
select LOD - Face Threshold to 1
Auto Edge on

then select Edit Poly Modifier on that n "Collapse To"

----
I have tried Macro Recorder but it didn't work for me.
Please guide me how to do that thing n make button.


Regards.


It's exactly why people are making scripts... To do some routine and repetitive tasks with macroscripts...

in you case here is a macros:

macroScript sampleForYou -- give it a name that you want
category:"HowTo"
(
if (obj = selection[1]) != undefined and canconvertto obj Editable_Poly do
(
convertToPoly obj
obj.weldThreshold = 0.001
polyop.weldVertsByThreshold obj obj.verts
addmodifier obj (Optimize facethreshold1:1.0 autoedge:on)
convertToPoly obj
)
)



Change name of the macros and category as you like. ... and learn MAX Scripting. :) it will help you alot.

jileshpatel
07-20-2009, 11:16 AM
Thanks a lot denisT, It works like charm! Please tell me how can I learn basic of maxscript, if there is any resources available.

PiXeL_MoNKeY
07-20-2009, 04:12 PM
Probably be easier to just use the Weld and Smooth option in the Power NURBS settings before converting. This will weld the objects and enabled Smoothing groups instead of using the vertex normals, which you will lose once you try and weld the vertices or optimize the mesh anyways. Also, why are you optimizing outside of the Editable_BREP anyways?

-Eric

jileshpatel
07-27-2009, 06:47 AM
Hi PiXeL_MoNKeY, The reason why I am extracting Powernurbs objects into poly mesh is because that way I can modify mesh , unwrap n texturing easily and main reason to do is it still giving me same rendering quality and optimized mesh, otherwise when I unwrap those Powernurbs's powermesh It hangs sometimes even on my dual processor xeon workstation!

PiXeL_MoNKeY
07-27-2009, 03:03 PM
Don't convert to poly, convert to mesh instead.

-Eric

CGTalk Moderation
07-27-2009, 03:03 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.