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):
  
<code>
+
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 } }
 
</code>
 
  
 
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:
  
<code>
+
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 4 7 } } F { { 0 5 4 3 } }
 
</code>
 
  
 
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 az35,el25]]
+
[[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.  Four faces must be added to form the sides of the hole through the box; these are <code>F { { 8 12 13 11 } }</code>, <code>F { { 11 13 14 10 } }</code>, <code>F { { 10 14 15 9 } }</code>, and <code>F { { 12 8 9 15 } }</code>.  The final command with all of this is:
 
 
 
<code>
 
mged> put box_with_hole_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 } { 0.25 0.25 0 } { 0.75 0.25 0 } { 0.75 0.75 0 } { 0.25 0.75 0 } { 0.25 0.25 1 } { 0.25 0.75 1 } { 0.75 0.75 1 } { 0.75 0.25 1 } } F { { 0 1 2 3 } { 8 9 10 11 } } F { { 4 5 6 7 } { 12 13 14 15 } } F { { 0 1 6 5 } } F { { 1 2 7 6 } } F { { 2 3 4 7 } } F { { 0 5 4 3 } } F { { 8 12 13 11 } } F { { 11 13 14 10 } } F { { 10 14 15 9 } } F { { 9 15 12 8 } }
 
</code>
 
  
This produces the following wireframe when drawn in MGED using the az35,el25 view setting:
+
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.75 0.25 1 }</code>, <code>{ 0.75 0.75 1 }</code>, <code>{ 0.25 0.75 1 }</code>.
[[File:nmg-wiki-tutorial-box-with-hole-mged-screenshot.png|none|1024px|The MGED wireframe of the box with a hole from az35,el25]]
 

Please note that all contributions to BRL-CAD may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BRL-CAD:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)
Retrieved from "https://brlcad.org/wiki/NMG"