Editing Spiral

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 9: Line 9:
  
 
=Scripting MGED with Perl=
 
=Scripting MGED with Perl=
BRL-CAD's solid modeling editor, MGED, will run most commands provided after the name of the geometry database on the command line.  The "-c" option tells MGED to run in classic console mode without a GUI, which is perfect for scripting from most any language including Perl. First in Ruby written by, Dwayne Hans, 2016.
+
BRL-CAD's solid modeling editor, MGED, will run most commands provided after the name of the geometry database on the command line.  The "-c" option tells MGED to run in classic console mode without a GUI, which is perfect for scripting from most any language including Perl.
  
 
This script takes advantage of the fact that it is considerably more efficient to batch multiple MGED commands together instead of re-invoking MGED multiple times.  It builds up a list of commands for one segment, then groups them together in batches of 100 before running MGED.  This avoids considerable operating system and process initialization overhead, allowing the script to run orders of magnitude faster than if the segments were created one at a time.
 
This script takes advantage of the fact that it is considerably more efficient to batch multiple MGED commands together instead of re-invoking MGED multiple times.  It builds up a list of commands for one segment, then groups them together in batches of 100 before running MGED.  This avoids considerable operating system and process initialization overhead, allowing the script to run orders of magnitude faster than if the segments were created one at a time.
Line 107: Line 107:
 
  |}
 
  |}
  
There are, of course, many ways that this script could be improved upon such as spacing the segments out evenly.  For example, there are minor issues with the way the script calculates the position and rotation of individual box segments (hence the fudge factor), but it does the job well enough for this demonstration.  
+
There are, of course, many ways that this script could be improved upon such as spacing the segments out evenly.  There's even minor issues with the way the script calculates the position and rotation of individual box segments (hence the fudge factor), but it does the job well enough for this demonstration.  
  
This script was originally written by [http://heybryan.org Bryan Bishop] and is available for download from [https://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/trunk/src/proc-db/spiral.pl '''here'''].
+
This script was originally written by [http://heybryan.org Bryan Bishop] and is available for download from [http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk/src/proc-db/spiral.pl '''here'''].

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)