User avatar
By deadalvs
#261724
i had the idea for the script when reading this thread here:
http://www.maxwellrender.com/forum/viewtopic.php?t=593

i just wrote a little script that helps modeling edge highlights.

just select meshes or edges or faces...

be sure to use either meters or centimeters. ( if the script is needed for inches tell me. )

if there are any questions or bugs, just post here.

* * *

code: just save the text as d_edgeTreatmentWin_V1.mel

* * *


d_edgeTreatmentWin;
d_calcUnitMultiplyer;
global proc d_edgeTreatmentWin(){
if (`window -exists "d_edgeTreatmentWin"` == 1){deleteUI "d_edgeTreatmentWin";}
window -t "edge treatment window V1.0" d_edgeTreatmentWin;
columnLayout -adjustableColumn 1;
//INFO AND USE
frameLayout -label "INFO AND USE" -cll true -collapse 1 infoLayout;
columnLayout;
text -l "scripted by deadalvs, feb 2008";
text -l "questions concerning the scripts or workflow:";
text -l "send to:";
text -l "matthias.buehler(at)mac.com";
text -l "";
text -l "use as basic unit: [m] or [cm]";
text -l "use \"keep faces together\" option if needed";
setParent ..;
setParent ..;
frameLayout -label "bevel" -cll true -collapse 0 bevelLayout;
columnLayout;
text -l "bevel width [m%] or [cm%]";
floatField -w 300 -v 0.01 bevelWidthFloatField;
text -l "bevel segments";
intField -w 300 -v 1 bevelSegmentsIntField;
text -l "";
button -w 300 -h 40 -l "bevel selected geometry" -c "d_bevelSelectedGeometry();";
setParent ..;
setParent ..;
frameLayout -label "offset" -cll true -collapse 0 offsetLayout;
columnLayout;
text -l "offset width [m%] or [cm%]";
floatField -w 300 -v 0.01 offsetWidthFloatField;
button -w 300 -h 40 -l "offset selected geometry" -c "d_offsetSelectedGeometry();";
setParent ..;
setParent ..;
frameLayout -label "extrude (with offset)" -cll true -collapse 0 extrudeLayout;
columnLayout;
text -l "extrude width [m%] or [cm%]";
floatField -w 300 -v 0.01 extrudeWidthFloatField;
text -l "offset width [m%] or [cm%]";
floatField -w 300 -v 0.01 extrudeOffsetWidthFloatField;
button -w 300 -h 40 -l "extrude selected geometry" -c "d_extrudeSelectedGeometry();";
setParent ..;
setParent ..;
showWindow d_edgeTreatmentWin;
//end d_edgeTreatmentWin
}
////////////////////////////////////////////////////////////////////////////////////////////
global proc d_bevelSelectedGeometry(){
d_calcUnitMultiplyer;
global float $bevelWidth;
$bevelWidth = `floatField -q -v bevelWidthFloatField`;
global float $bevelSegments;
$bevelSegments = `intField -q -v bevelSegmentsIntField`;
string $selectedEdgesArray[] = `ls -sl`;
polyBevel -offset $bevelWidth -offsetAsFraction 0 -autoFit 1 -segments $bevelSegments -worldSpace 1 -uvAssignment 0 -fillNgons 1 -mergeVertices 1 -mergeVertexTolerance 0.0001 -smoothingAngle 30 -miteringAngle 180 -angleTolerance 180 -ch 0;
//end d_bevelSelectedGeometry
}
////////////////////////////////////////////////////////////////////////////////////////////
global proc d_offsetSelectedGeometry(){
d_calcUnitMultiplyer;
global float $offsetWidth;
$offsetWidth = `floatField -q -v offsetWidthFloatField`;
global float $unitMultiplyer;
polyExtrudeFacet -constructionHistory 0 -keepFacesTogether 0 -pvx 0 -pvy 0 -pvz 0 -divisions 1 -twist 0 -taper 1 -off ($offsetWidth * $unitMultiplyer) -smoothingAngle 30;
//end d_offsetSelectedGeometry
}
////////////////////////////////////////////////////////////////////////////////////////////
global proc d_extrudeSelectedGeometry(){
d_calcUnitMultiplyer;
global float $extrudeOffsetWidth;
$extrudeOffsetWidth = `floatField -q -v extrudeOffsetWidthFloatField`;
global float $unitMultiplyer;
polyExtrudeFacet -constructionHistory 0 -keepFacesTogether 0 -pvx 0 -pvy 0 -pvz 0 -divisions 1 -twist 0 -taper 1 -off ($extrudeOffsetWidth * $unitMultiplyer) -smoothingAngle 30;
global float $extrudeWidth;
$extrudeWidth = `floatField -q -v extrudeWidthFloatField`;
string $selectedFacesArray[] = `ls -sl`;
for ($eachFace in $selectedFacesArray){
global float $extrudeWidth;
select -r $eachFace;
ConvertSelectionToVertices;
string $selectedCVArray[] = `ls -sl -fl`;
int $numberOfCVs = size ($selectedCVArray);
global string $normalFlags;
$normalFlags= "";
for ($counter = 0; $counter < $numberOfCVs; $counter++){
global float $extrudeWidth;
global string $normalFlags;
$normalFlags= ($normalFlags + "-n " + ($extrudeWidth) + " ");
//print $normalFlags
}
eval ("moveVertexAlongDirection " + $normalFlags);
}
select -r $selectedFacesArray;
//end d_offsetSelectedGeometry
}
////////////////////////////////////////////////////////////////////////////////////////////
global proc d_calcUnitMultiplyer(){
string $currentLinearUnit = `currentUnit -query -linear`;
global float $unitMultiplyer;
//cm = 1
//m = 100
if ($currentLinearUnit == "m"){
global float $unitMultiplyer;
$unitMultiplyer = 100;
}
if ($currentLinearUnit == "cm"){
global float $unitMultiplyer;
$unitMultiplyer = 1;
}
//end d_calcUnitMultiplyer
}
////////////////////////////////////////////////////////////////////////////////////////////

Last edited by deadalvs on Tue Feb 19, 2008 9:30 pm, edited 3 times in total.
User avatar
By deadalvs
#261729
a little edit in the code done.
User avatar
By deadalvs
#261736
an other little update done.

units are checked now each time a button is clicked. this is needed if a new scene is made with different unit.

have fun.
User avatar
By deadalvs
#261802
is it any useful?

i'd like some feedback... :)

wishes also welcome.
User avatar
By Olivier Cugniet
#261826
seems handy but bevel doesn't work here ("// Error: Invalid flag: -uvAssignment") :D
By msantana
#261827
It works great here.

(maya 2008 Complete on Mac OS X 10.5.2)

M
User avatar
By deadalvs
#261834
Olivier Cugniet wrote:seems handy but bevel doesn't work here ("// Error: Invalid flag: -uvAssignment") :D
surely an issue cos of maya 6.5 ...

:?
User avatar
By 3dtrialpractice
#261868
cool thnx..

Al ready playin w/ it and seems to be quite handy to have those optons on a floatign menu and b able to access and model em quickly...

kinda nice to be able to greeble some structures up with...

althought qwould be cool if it had a selection reduce option that eliminated edged or faces that were too "thin" to keep going.. just by playing w. it I fould myself having to deselect everythign after I did a offset/bevel/extude and then reselect just the "bigger" faces to continu working on the bevel extudes on them.. cuz after it did an action it kept the selection..(which is GOOD) but it also means that soem edges r selected that R not what I wanted to be select for the next go around of extrude/vbevel.. kinda hard to explain.. ill post up a screen shot of my test workflow to see if you can further add to this script..

Thansk DEADALVS for creatign scripts and sharing them w/ the comunity.. I wish I had the knwoledge and time to do sopem mel stuff.. so since I dont its a real blessing to have you and dr merman sharing your scripts. .(I still think about the grass copies script.. and maybe you can rewrite it to know work w/ instinces and maybe new ways to mod that scrip..ie an optionfor interpenetration detection so geometry dont overlap.. maybe this would just be a seperate script that you run after the grasscopier.. based on the selection it deletes the faces/objects that collide/interpenetrate)

-luke
User avatar
By deadalvs
#261878
hey Luke !


thanks for the feedback !

yes, i know that it'd be useful to have select/deselect faces and edges. but it's kinda difficult to foresee what the user will want and on what type of topology he's working on...

this is why it's best to discuss and ask for specific commands.

* * *

i have done a rather large new version of the grass multiplyer script, but i had started with a «wrong» or too complex approach. i did this by the end of last october, but i stopped.

a script like this takes a very large amount of time and only if can make it perfect it is useful to take that time.

the intersection detection... that could also be an other option. but this might be slow with MEL when going into the 1000s of copies/instances.

no idea, but sometime i will finish this !!
:D
Sketchup 2024 Released

I would like to add my voice to this annual reques[…]