Mayaで文字などを丸くする手順

# はじめに

Mayaで地味なモデリング作業をできるだけ避けつつ、アウトラインで作る形状を丸みを帯びた立体にする手順です。（モデリングできる人には、用無し記事です）

# 環境
Maya 2024
Mac

# 手順
穴の空いたオブジェクトを作って、1,3キーのsubdivision表示にするとこうなってしまう。

```c:mel
polyCube -n mCube1 -w 10 -h 10 -d 10;
polyCylinder -n mCylinder1 -r 3 -h 20;

polyBooleanCmd -op 2 -n result1 mCube1 mCylinder1;

setAttr "mCube1.visibility" 0;
setAttr "mCylinder1.visibility" 0;

polyBevel3 -o 0.4 result1;
```

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/510257/b3b28b2b-2edb-8bca-7b1e-ccb6671632dd.png)

それを回避するためにリトポする。

```c:mel
polyCube -n mCube1 -w 10 -h 10 -d 10;
polyCylinder -n mCylinder1 -r 3 -h 20;

polyBooleanCmd -op 2 -n result1 mCube1 mCylinder1;

setAttr "mCube1.visibility" 0;
setAttr "mCylinder1.visibility" 0;

doPerformPolyRetopo 1 {"0", "1", "3", "0", "0", "0", "0.5", "0.5017", "0.75", "200", "10", "0", "", "1", "49.5", "1", "0", "0.0001", "0.017" };
polyRetopo -caching 1 -constructionHistory 1 -symmetry 0 -axisPosition 3 -axisOffset 0 -axis 1 -replaceOriginal 1 -preprocessMesh 0 -preserveHardEdges 0 -topologyRegularity 0.5 -faceUniformity 0.5017 -anisotropy 0.75 -targetFaceCount 200 -targetFaceCountTolerance 10 -edgesByAngle 1 -angle "49.5";
```

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/510257/2172626c-85d3-160d-1a49-f3932602030a.png)

穴が複数バージョン
addMeshがバグってて、手動で修正する必要があった。
```c:mel
polyCube -n mCube1 -w 10 -h 1 -d 10;
polyCylinder -n mCylinder1 -r 2 -h 2;
move -r -2.5 0 -2.5;
polyCylinder -n mCylinder2 -r 2 -h 2;
move -r 2.5 0 0;
polyCylinder -n mCylinder3 -r 2 -h 2;
move -r -2.5 0 2.5;

polyBooleanCmd -op 2 mCube1 mCylinder1;
polyBooleanCmd -edit -addMesh mCylinder2 -op 2 polyBoolean1;
polyBooleanCmd -edit -addMesh mCylinder3 -op 2 polyBoolean1;

setAttr "mCube1.visibility" 0;
setAttr "mCylinder1.visibility" 0;
setAttr "mCylinder2.visibility" 0;
setAttr "mCylinder3.visibility" 0;

doPerformPolyRetopo 1 {"0", "1", "3", "0", "0", "0", "0.5", "0.5017", "0.75", "500", "10", "0", "", "1", "49.5", "1", "0", "0.0001", "0.017" };
polyRetopo -caching 1 -constructionHistory 1 -symmetry 0 -axisPosition 3 -axisOffset 0 -axis 1 -replaceOriginal 1 -preprocessMesh 0 -preserveHardEdges 0 -topologyRegularity 0.5 -faceUniformity 0.5017 -anisotropy 0.75 -targetFaceCount 200 -targetFaceCountTolerance 10 -edgesByAngle 1 -angle "49.5";
```
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/510257/0fa4890c-43bd-3408-d1a7-f3b01285a722.png)


ひらがな「あ」
文字は手動で入力
プレッツェルみたい
目標ポリゴン数とかは、適宜変更する必要がある。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/510257/b2b5fd37-2ae3-aed7-f2dc-0469d25d4a95.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/510257/dc87a6d0-a129-11fe-461c-25102ec55118.png)
```c:mel
typeCreateText;
setAttr "typeExtrude1.extrudeDivisions" 1;
doPerformPolyRetopo 1 {"0", "1", "3", "0", "0", "0", "0.5", "0.5017", "0.75", "300", "10", "0", "", "1", "49.5", "1", "0", "0.0001", "0.017" };
polyRetopo -caching 1 -constructionHistory 1 -symmetry 0 -axisPosition 3 -axisOffset 0 -axis 1 -replaceOriginal 1 -preprocessMesh 0 -preserveHardEdges 0 -topologyRegularity 0.5 -faceUniformity 0.5017 -anisotropy 0.75 -targetFaceCount 200 -targetFaceCountTolerance 10 -edgesByAngle 1 -angle "49.5";
```

SVGインポートからのプレッツェルやらねば。




https://help.autodesk.com/cloudhelp/2024/ENU/Maya-Tech-Docs/Commands/index.html

ベベルがうまくいかないときにも使えると思う。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/510257/7915288a-e0ba-d624-30b2-c31f62f617eb.png)