ScriptSpot

Forum topic · Scripts Wanted

Change Mesh Quality Presets for a bunch of Body Objects

By bisara230 · 2014-02-04

Description

Hello.
Can anyone Help me to find a solution to this?
I imported from solidworks a bunch of objects in SAT format, they came into MAX as Body Objects. I want to select them at once and change the Mesh quality Presets (coarse, Medium, fine) in order to have more or less detail with out doing it individually.
If you know another technique, please.
thanks in advance.

Comments (4)

Great

bisara230 · 2014-02-04

It worked! thanks!
Man, that was fast!

barigazy · 2014-02-04

Yes I know. :)
Are you saw that with this script you can change preset of the single object faster then you press preset button in modify panel.

barigazy · 2014-02-04

Try this

try(destroyDialog ::bgaRoll)catch()
rollout bgaRoll "Body Object Quality"
(
local presetProps = #(#LowQualityVDS, #MediumQualityVDS, #HighQualityVDS, #IsoAngleDS, #IsoChordHeightVDS, #FaceApproxAngleVDS, \
#EdgeApproxAngleVDS, #FaceChordHeightVDS, #EdgeChordHeightVDS, #MaxEdgeLengthPctVDS)
fn setMeshQuality objs mode: props:presetProps = if objs.count != 0 do
(
if GetCommandPanelTaskMode() != #create do SetCommandPanelTaskMode #create
local vals = case mode of
(
#Coarse: #(on, off, off, 15, 0, 30, 0, 1, 0, 0)
#Medium: #(off, on, off, 7, 0, 15, 0, .1, 0, 0)
#Fine: #(off, off, on, 3, 0, 10, 0, .02, 0, 0)
)
with redraw off for body in objs where isKindOf body Body_Object do
(
for i = 1 to props.count do setProperty body presetProps[i] vals[i]
)
)
group "Mesh Quality Presets:"
(
button btn_c "Coarse" pos:[8,25] width:60 height:20
button btn_m "Medium" pos:[70,25] width:60 height:20
button btn_f "Fine" pos:[132,25] width:60 height:20
)
on btn_c pressed do setMeshQuality selection mode:#Coarse
on btn_m pressed do setMeshQuality selection mode:#Medium
on btn_f pressed do setMeshQuality selection mode:#Fine
)
createDialog bgaRoll 200 55 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)