MGED_Quick_Reference_Card.pdf

(1229 KB) Pobierz
MGED_Reference_Card.ind
MGED Quick Reference Card
(for version 7.x)
Starting & Stopping MGED
To start MGED mged
Run in classic console mode mged -c i le.g
Run a single MGED command mged -c i le.g cmd
To quit MGED exit or quit or q
create a region from a range of solids build_region prei x #
create a shallow copy of an object cp obj objcopy
create deep patterned copies of objects clone
rename an object mv old new
rename an object and all references mvall old new
add a prei x to all references to an object prei x prei x obj
create an arb8 w/ rotation and fallback arb rot fallback
duplicate a cylinder, positioned at end or orig cpi cyl cylcopy
make a bounding box around object(s) make_bb name obj ...
mirror an object about the x, y, or z axis mirror obj new axis
create arb given 3 points, 2 coords of 4th, and thickness 3ptarb
Files
Geometry database i les in MGED are always automatically saved to disk after an edit is made. As
such, the concept of performing a “Save” manually does not apply. Files use the “.g” extension.
Deleting Geometry
MGED provides no means to recover deleted geometry, so delete objects with caution. Regularly
performing geometry database backups (e.g. see the dump command) is recommended.
delete object(s) from database kill obj ...
delete object(s) and all references killall obj ...
delete object(s), all sub-objects, all references killtree obj ...
open a new or existing geometry database opendb i le.g
close any open geometry database closedb
save a copy of the currently open database dump newi le.g
export objects from currently open database keep new i le.g obj ...
check if i le contains duplicate object names dup i le.g
combine a geometry database into existing dbconcat i le.g
eliminate unused space from open database garbage_collect
display version of currently open database dbversion
upgrade currently open database to the latest dbupgrade
import data i le as a binary object wdb_binary -i u c obj i le
export binary object to a data i le wdb_binary -o u c i le obj
Geometry Information
list the top-level objects tops
list the objects in currently open database ls
get a table of contents for current database t
display the information details for object(s) l obj ...
cat obj ...
display combinations that reference object(s) dbi nd obj ...
print out CSG hierarchy for object(s) tree obj ...
list all CSG paths that reference object(s) pathlist obj ...
list all CSG paths that match a pattern paths pattern
show transformation matrices along a path showmats path
display all regions with given air code(s) eac code ...
display counts of primitives, regions, groups summary prg
save region identii er summary to i le idents i le obj ...
get/set title of currently open database title
get/set units of currently open database units
hierarchical geometry browser GUI tool geometree
Getting Help
With non-classic MGED, right-clicking most labels and input i elds will provide a description.
Additionally, documentation is provided via the Help menu.
obtaining help on all commands help
obtaining help on a particular command help command
search for commands that relate to keyword apropos keyword
display command history for current session history
record transcript of commands used to i le journal i le
visually illuminate & select combination ill comb
visually illuminate & select solid primitive sill prim
enter object-illuminate mode press oill
get the current editing state status state
edit a primitive (enter solid edit mode) sed prim
edit a matrix (enter object edit mode) oed l path rpath
add object reference to existing combination i obj comb
remove object reference(s) from combination rm comb obj ...
set/get the center of editing transformation keypoint x y z
manipulate an object’s matrix or material arced path cmd
copy the matrix on one object to another copymat path1 path2
select matrix path when in pick mode matpick path1 path2
set a matrix on a given path putmat path m0 ... m16
mirror arb face about the x, y, or z axis extrude face axis
apply all matrix transformations down to the primitives push obj ...
same as push but creates new primitives as needed xpush obj ...
 e geometry editing commands below require you to be in an edit mode before they can be
utilized.  ese commands implicitly apply to the objects currently selected for editing.
set parameter(s) for current edit operation p val ...
return to viewing mode, rejecting any edits reject
return to viewing mode, accept any edits accept
edit the face of an arb interactively facedef face
Constructive Solid Geometry Operations
Constructive Solid Geometry (aka Combinatorial Solid Geometry) is based on three mathematical
boolean operations: union, intersection, and dif erence (aka subtraction).  ese operators are
applied to primitives to form compound objects in MGED using the “u”, “+” and “-” annotation.
Consider the example of combining two primitive object shapes, n and l .  e example below
shows the resulting CSG combination object when the two shapes are overlapping.
Union Intersection Dif erence
’ ’ ’
Displaying Geometry
display object(s) for editing e obj ...
draw obj ...
remove object(s) from the display d obj ...
erase obj ...
remove object(s) referencing specii ed object dall obj ...
erase_all obj ...
remove all objects from the display Z
remove all objects and (re)display object(s) B obj ...
mark object(s) as hidden hide obj ...
unmark object(s) as hidden unhide obj ...
Creating Geometry
interactively type in new object parameters in
create a prototypical primitive object make type name
create a CSG combination object comb name op obj ...
c name obj op obj ...
create CSG region (aka “part”) combination r name op obj ...
create group (aka “assembly”) combination g name obj1 obj2 ...
group name obj ...
Editing Geometry
MGED is a modal editor (akin to ‘vi’) meaning that you have to enter and exit various editing
modes.  e primary mode states related to editing are VIEWING (default), SOLEDIT, and
OBJEDIT. Some commands are only valid in certain mode states or their behavior changes based
on the state (e.g. the ‘p’ command).
n u l n + l n - l
169823664.001.png
R G
rotate primitive being edited rot x y z
rotate combination object being edited orot x y z
rotate angle degrees about an arbitrary axis arot x y z angle
incrementally rotate combination object rotobj -i d x dy dz
rotate combination about vector qorot x y z dx dy dz angle
use provided planar coeicients when rotating arb face eqn A B C
permute the vertices of an arb permute 8 vertices
automatically resize/recenter the view autoview
redraw the current view refresh
set the azimuth, elevation, and twist ae az el tw
set/get the view center center x y z
set/get the eye point eye_pt x y z
set/get the viewing direction lookat x y z
set/get the view size size size
zoom the view by speciied scale factor zoom scale
set the perspective viewing angle set perspective angle
turn perspective mode of (i.e. orthogonal) set perspective -1
translate/move the view relative to current tra d x dy dz
scale the view size by given factor sca factor
rotate the view by x, y, z degrees rot x y z
rotate view about a speciied model vector mrot x y z
rotate viewpoint by speciied degrees vrot xdeg ydeg zdeg
set view using direction and twist angle qvrot d x dy dz angle
set view using x, y, z angles in degrees setview xdg ydg zdg
pan the view sv x y
set the view orientation from quaternion orientation quat
emulate a knob twist knob params
control the angle/distance cursor adc
save current wireframe to a Postscript ile ps ile.ps
save the current view to a ile saveview ile.rt
load a saved view from a ile loadview ile.rt
save current wireframe to a UNIX plot ile plot ile.pl
overlay a UNIX plot ile onto the display overlay ile.pl
Groups
(aka Assemblies)
Groups are simply unions, i.e. collections, of other groups
or regions.
Regions
(aka Parts)
Regions are CSG operations (i.e. union,
intersection, and diference) on non-region
combinations and primitives.
T G
move object being edited (relative position) tra d x dy dz
move object being edited (absolute position) translate x y z
Primitive Shapes
(aka Solids)
Customization
MGED will process a .mgedrc initialization ile in your home directory as a sourced Tcl script.
is ile generally contains defaults set by the GUI but may also include your own customizations.
S G
scale primitive being edited sca factor
scale combination object being edited oscale factor
extrude arb face by some absolute distance extrude face dist
Tcl Scripting New Commands Inside MGED
echo, i.e. display or print, the provided text echo text
pause for the speciied amount of time delay sec usec
get combination CSG structure as a Tcl list lt object
use shell-style name globbing set glob_compat_mode 1
use Tcl shell syntax evaluation set glob_compat_mode 0
run an external command exec command
Here is an example of writing a custom command called get_primitives that traverses over all
objects in a given combination, printing a list of all primitives encountered. For this example,
glob_compat_mode is disabled (i.e. set to 0, not the default value of 1) so that there is no need to
escape various characters with a preceding “\” slash.
proc get_primitives {object} {
set children [lt $object]
set prims ““
if { $children != ““ } {
foreach node $children {
set name [lindex $node 1]
set data [db get $name]
if { [lindex $data 0] != “comb” } {
set prims [concat $prims $name]
} else {
set prims [concat $prims [get_primitives $name]]
}
}
}
return “$prims”
}
Text File & Table Editing
Several commands in MGED utilize an external text editor, determined from your environment
EDITOR setting, to edit object values. Depending on your shell, you may need to set your EDI-
TOR environment variable before invoking MGED. Bash example: export EDITOR=pico
edit a combination using a text editor red comb ...
edit a primitive using a text editor ted comb ...
edit the region identiier codes for object(s) edcodes comb ...
edit the combination/region materials edmater comb ...
print the color table prcolor
edit the color table codes edcolor
read/import region identiier codes from ile rcodes ile
write region identiier codes to ile wcodes ile obj ...
read combination materials from ile rmater ile
write combination materials to ile wmater ile obj ...
write report of primitive solids to ile solids ile obj ...
Rendering Geometry
raytrace current view to a lingering window rt -F/dev/Xl
raytrace current view to 2048x2048 ile rt -s2048 -o ile.pix
raytrace white background hidden-line image rtedge -W -o ile.pix
abort any raytraces started within mged rtabort
Analyzing Geometry
analyze the faces of an ARB analyze arbname
rough estimate of presented area area
trace single ray from current view or x, y, z nirt x y z
query_ray x y z
trace single ray from x, y position vnirt x y
vquery_ray x y
get/set query_ray behavior settings qray
check for overlaps (aka interferences) rtcheck
compute view-dependent surface areas rtarea
get/set MGED calculation tolerances tol
Attributes
In BRL-CAD, “attributes” may be used to store arbitrary information, i.e. metadata, about an
object. Attributes may be applied to any object (e.g. combinations or primitives) in the database.
display current attributes for object(s) attr show obj ...
set the speciied attribute on an object attr set obj atr val
append the speciied attribute value attr append obj a v
modify an object attribute(s) adjust obj atr nval
delete an object attribute attr rm obj atr
interactively set visual material properties mater comb
set an object’s color comb_color obj R G B
get region identiier code for speciied region whatid region
list all regions using particular shader(s) which_shader shdr ...
identify regions with speciied air code(s) whichair code ...
identify regions with speciied region id(s) whichid id ...
Shell Scripting Outside MGED
Example shell script that displays the contents of all the top-level objects in the speciied geometry
database(s). each top-level object is ray-traced to a ile and the visible surface area is computed.
#!/bin/sh
for db in $* ; do
objs=”`mged -c $db tops -n -g 2>&1`”
echo “PROCESSING $db”
for obj in $objs ; do
mged -c $db cat $obj 2>&1
echo “Rendering $obj to ${db}.${obj}.pix”
rt -o ${db}.${obj}.pix $db $obj 2>/dev/null 1>&2
echo “Computing visible surface area”
rtarea ${db} ${obj} 2>&1 | grep Area | tail -1
done
done
Naming Conventions
MGED imposes minimal restrictions on how objects are named. It is up to the individuals and
organizations to utilize consistent naming conventions when creating geometry. e below object
naming suix convention is frequently utilized.
Manipulating the View
MGED uses a right-hand 3D Cartesian coordinate system where “up” is deined as the positive
z-axis (+Z), “right” is the positive x-axis (+X), and “front” is towards the positive y-axis (+Y).
groups / assemblies no sufix or .g
regions / parts .r
non-region combinations .c
primitive solid shapes .s
Copyright (c) 2006 United States Government
MGED Reference Card version 1 for BRL-CAD version 7, April 2006
designed by Christopher Sean Morrison
Permission is granted to make and distribute copies of this card provided the copyright notice and
this permission notice are preserved on all copies.
get/set the various view parameters view
169823664.002.png
 
Zgłoś jeśli naruszono regulamin