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 71: Line 71:
  
 
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:
 
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:
Line 78: Line 78:
 
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 } }
 
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>
 
</code>
 
This produces the following wireframe when drawn in MGED using the az35,el25 view setting:
 
[[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"