Editing NMG
From BRL-CAD
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 27: | Line 27: | ||
<br clear=all /> | <br clear=all /> | ||
+ | |||
mged> make ramp_arb arb6 | mged> make ramp_arb arb6 | ||
mged> facetize -n ramp_nmg ramp_arb | mged> facetize -n ramp_nmg ramp_arb | ||
Line 60: | Line 61: | ||
different coordinates, you'd do this (it appears that the vertices must be specified in clockwise viewed from the outside order within each loop; otherwise, mged crashes): | different coordinates, you'd do this (it appears that the vertices must be specified in clockwise viewed from the outside order within each loop; otherwise, mged crashes): | ||
− | + | mged> put ramp_nmg2 nmg V { { 0 0 0 } { 1 0 0 } { 0 1 0 } { 1 1 0 } { 0 1 1 } { 1 1 1} } F { { 0 2 3 1 } } F { { 3 2 4 5 } } F { { 0 1 5 4 } } F { { 0 4 2 } } F { { 1 3 5 } } | |
− | mged> put ramp_nmg2 nmg V { { 0 0 0 } { 1 0 0 } { 0 1 0 } { 1 1 0 } { 0 1 1 } { 1 1 1} } F { { 0 2 3 1 } } F { { 3 2 4 5 } } F { { 0 1 5 4 } } F { { 0 4 2 } } F { { 1 3 5 } } | ||
− | |||
As a slightly more complex example, consider making a box. The box should have a vertex V for each of its corners, so the V-list should look like <code>{ { 0 0 0 } { 0 1 0 } { 1 1 0 } { 1 0 0 } { 1 0 1 } { 0 0 1 } { 0 1 1 } { 1 1 1 } }</code>. It should have six faces, one for each face of the cube, but these faces are simple ones with only one loop, since none of the faces have holes. The bottom face is composed of <code>{ { 0 1 2 3 } }</code>, the top one of <code>{ { 4 5 6 7 } }</code>, and the sides are given by <code>{ { 0 1 6 7 } }</code>, <code>{ { 1 2 5 6 } }</code>, <code>{ { 2 3 4 5 } }</code>, and <code>{ { 3 0 7 4 } }</code>; this means that the final command to create it is: | As a slightly more complex example, consider making a box. The box should have a vertex V for each of its corners, so the V-list should look like <code>{ { 0 0 0 } { 0 1 0 } { 1 1 0 } { 1 0 0 } { 1 0 1 } { 0 0 1 } { 0 1 1 } { 1 1 1 } }</code>. It should have six faces, one for each face of the cube, but these faces are simple ones with only one loop, since none of the faces have holes. The bottom face is composed of <code>{ { 0 1 2 3 } }</code>, the top one of <code>{ { 4 5 6 7 } }</code>, and the sides are given by <code>{ { 0 1 6 7 } }</code>, <code>{ { 1 2 5 6 } }</code>, <code>{ { 2 3 4 5 } }</code>, and <code>{ { 3 0 7 4 } }</code>; this means that the final command to create it is: | ||
− | + | mged> put box_nmg nmg V { { 0 0 0 } { 0 1 0 } { 1 1 0 } { 1 0 0 } { 1 0 1 } { 0 0 1 } { 0 1 1 } { 1 1 1 } } F { { 0 1 2 3 } } F { { 4 5 6 7 } } F { { 0 1 6 5 } } F { { 1 2 7 6 } } F { { 2 7 4 3 } } F { { 3 0 4 5 } } | |
− | mged> put box_nmg nmg V { { 0 0 0 } { 0 1 0 } { 1 1 0 } { 1 0 0 } { 1 0 1 } { 0 0 1 } { 0 1 1 } { 1 1 1 } } F { { 0 1 2 3 } } F { { 4 5 6 7 } } F { { 0 1 6 5 } } F { { 1 2 7 6 } } F { { 2 3 | ||
− | |||
This yields the following object: (an MGED wireframe, from the az35,el25 view setting): | This yields the following object: (an MGED wireframe, from the az35,el25 view setting): | ||
− | [[File:nmg-wiki-tutorial-box-mged-screenshot.png|none|1024px|The MGED wireframe of the box from | + | [[File:nmg-wiki-tutorial-box-mged-screenshot.png|none|1024px|The MGED wireframe of the box from above]] |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Another more complex example is to create a box with a hole through it. Much of the command is the same as the one above for creating a plain box; the first thing to do is to add the necessary vertices to the <code>V</code> list. For the lower face, <code>{ 0.25 0.25 0 }</code>, <code>{ 0.75 0.25 0 }</code>, <code>{ 0.75 0.75 0 }</code>, and <code>{ 0.25 0.75 0 }</code> are the necessary vertices; for the upper face, these are <code>{ 0.25 0.25 1 }</code>, <code>{ 0.25 0.75 1 }</code>, <code>{ 0.75 0.75 1 }</code>, <code>{ 0.75 0.25 1 }</code>. Changing the first two face statements from above to <code>F { { 0 1 2 3 } { 8 9 10 11 } } F { { 4 5 6 7 } { 12 13 14 15 } }</code> makes the faces have the necessary cutouts. | |
− |