PDA

View Full Version : How to see chamfer edge size realtime in viewport?


Saku
04-01-2004, 02:29 PM
My script has a spinner that is used for chamfering edges of Editable Poly. How can I make a script to show chamfer size visually in viewport when I increase/decrease value of my chamfer spinner?

If you chamfer edges normally in Max, you can see realtime how big chamfer you are getting. But I can't get it work in my script. I see the end result only when I stop changing value of my chamfer spinner. I want to change chamfer value in my script and same time see how it's going to affect the object.

Part of my script:

on chamfer_spn changed val do (
$.edgeChamfer = chamfer_spn.value --here I get value of chamfer, button down
)
on chamfer_spn buttonup do (
$.EditablePoly.buttonOp #Chamfer --button released, take chamfer value
)

I also attached very simplified script to see how this problematic part of script works now. Make first Editable Poly object -> select edge -> run script ->change spinner value keeping mouse button down and release when ready.

Example script (http://personal.inet.fi/koti/partamies/stuff/edgefillet_simplified.ms)

Thanks,
Saku.

Bobo
04-01-2004, 04:14 PM
There is an example in the EditablePoly Interface chapter showing the Preview function based on an Extrusion script.

I quickly changed it to a Chamfer example - see the code below:

p = convertToPoly(Box()) --create a box, turn to Epoly.
select p --select the box
max modify mode --enter Modify panel
subobjectlevel = 2 --set Sub-Object mode to Edge
rollout chamfer_edges "My Chamfer Dialog" --define a rollout
(
spinner chamfer_value "Chamfer Value" range:[0,100,1] --the value
on chamfer_value changed val do p.edgeChamfer = val --assign spinner value to chamfer value
button try_it "Preview" across:3 --a button to start a new chamfer
button cancel_it "Cancel" --a button to cancel preview
button accept_it "Accept" --a button to accept
on cancel_it pressed do p.previewCancel() --cancel
on accept_it pressed do p.previewAccept() --accept
on try_it pressed do p.previewBegin #Chamfer--begin again
)
createDialog chamfer_edges 200 60 --create a dialog with the rollout
--Run the script, select some edges, press Preview
--and watch them chamfer interactively.
--Press Accept if you like the result, press Cancel to discard.
--Press Preview again for next chamfer etc.
--Works exactly as the built-in dialog, but it is still a custom one!

Hope this helps!

Bobo

Originally posted by Saku
My script has a spinner that is used for chamfering edges of Editable Poly. How can I make a script to show chamfer size visually in viewport when I increase/decrease value of my chamfer spinner?

If you chamfer edges normally in Max, you can see realtime how big chamfer you are getting. But I can't get it work in my script. I see the end result only when I stop changing value of my chamfer spinner. I want to change chamfer value in my script and same time see how it's going to affect the object.

Part of my script:

on chamfer_spn changed val do (
$.edgeChamfer = chamfer_spn.value --here I get value of chamfer, button down
)
on chamfer_spn buttonup do (
$.EditablePoly.buttonOp #Chamfer --button released, take chamfer value
)

I also attached very simplified script to see how this problematic part of script works now. Make first Editable Poly object -> select edge -> run script ->change spinner value keeping mouse button down and release when ready.

Example script (http://personal.inet.fi/koti/partamies/stuff/edgefillet_simplified.ms)

Thanks,
Saku.

Saku
04-01-2004, 07:15 PM
Thanks Bobo, I got it working now. I didn't know about those preview functions until now.

Saku.

CGTalk Moderation
01-17-2006, 11:00 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.