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 | + | 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. | + | 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 [ | + | 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''']. |