PDA

View Full Version : Create Plane aligned&centered with selected faces.


KaMate
08-22-2012, 07:59 PM
How would I go around creating a plane and aligning it to a face or a group of faces that are currently selected to be used as a reference aid.

This is as far as I have got, Im trying to work out how to use the setLayerTo to turn the layer in to a reference layer and set it to unshaded.

Im a mel noob be gentle :D

Thanks

//
$objectArray = `polyPlane -ax 0 0 0 -sx 15 -sy 15 -w 15 -h 15`;
// Select the polyplane.
//
select $objectArray[0];
// Create a layer but only put the polyplane in the layer.
//
createDisplayLayer -noRecurse -name "ReferenceLayer";
//
//

Hamburger
08-23-2012, 04:49 AM
Is there a reason not use Maya's Live system?

KaMate
08-23-2012, 07:29 AM
Is there a reason not use Maya's Live system?


It doesn't seem to work on a group of selected faces, and unless im missing something you cant add divisions to construction planes.

KaMate
08-23-2012, 02:38 PM
How do I select the display layer named ReferenceLayer so that the last 2 setlayerto commands can work?

Thanks


//
$objectArray = `polyPlane -ax 0 0 0 -sx 15 -sy 15 -w 15 -h 15`;
// Select the polyplane.
//
select $objectArray[0];
// Create a layer but only put the polyplane in the layer.
//
createDisplayLayer -noRecurse -name "ReferenceLayer";
//
// Sets the selected layer to Reference
setLayerTo selected".displayType" 2;
//
// Sets the selected layer to unshaded
setLayerTo selected".shading" 0;

rgkovach123
08-23-2012, 02:59 PM
display layers are like everything else, a node. so you can use the "select" command.

select -r "MyDisplayLayer";

you can also just use "setAttr" command to directly set the display options of the layer instead of relying on the "setLayerTo" mel function.

KaMate
08-23-2012, 03:21 PM
display layers are like everything else, a node. so you can use the "select" command.

select -r "MyDisplayLayer";

you can also just use "setAttr" command to directly set the display options of the layer instead of relying on the "setLayerTo" mel function.

The select command is not selecting a layer

//
$objectArray = `polyPlane -ax 0 0 0 -sx 15 -sy 15 -w 15 -h 15`;
// Select the polyplane.
//
select $objectArray[0];
// Create a layer but only put the polyplane in the layer.
//
createDisplayLayer -noRecurse -name "ReferenceLayer";
//
//
editDisplayLayerGlobals -cdl "ReferenceLayer";
//
// Sets the layer to Reference
setLayerTo selected".displayType" 2;
//
// Sets the layer to unshaded
setLayerTo selected".shading" 0;

I can select it with this but then the setlayerTo commands dont work but they do work if all run individually.

djx
08-23-2012, 03:40 PM
Where possible, I would try to avoid selecting things in scripts.
Why not create an empty layer, then use editDisplayLayerMembers to add the object?

string $objArray[] = `polySphere -r 1 -sx 8 -sy 8 -ax 0 1 0 -cuv 2 -ch 1`;
createDisplayLayer -empty -n "MyRefLayer";
editDisplayLayerMembers "MyRefLayer" $objArray[0];
setAttr "MyRefLayer.shading" 0;


David

KaMate
08-23-2012, 04:07 PM
[QUOTE=djx]Where possible, I would try to avoid selecting things in scripts.
Why not create an empty layer, then use editDisplayLayerMembers to add the object?

Thank you that simplifies it, It's probably going to help for me to find a Mel for Dummies book.

Just got to fathom out how to align it to the selected face/faces

string $objArray[] = `polyPlane -ax 0 0 0 -sx 15 -sy 15 -w 15 -h 15`;
createDisplayLayer -empty -n "MyRefLayer";
editDisplayLayerMembers "MyRefLayer" $objArray[0];
setAttr "MyRefLayer.displayType" 2;
setAttr "MyRefLayer.shading" 0;

CGTalk Moderation
08-23-2012, 04:07 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.