Create edge box

From Macros Wiki
Jump to navigationJump to search

! create a box to enclose all of the selected edges
! -------------------------------------------------

get_selected_solid_list ! get list of selected solids
 
num_solids = number_of_solids
if num_solids<1 then stop "Please select at least 1 edge"
 
xmin = 9999
ymin = 9999
zmin = 9999
 
xmax = -9999
ymax = -9999
zmax = -9999

for i=1 to num_solids

sol_ref = next_solid_ref


get_solid_selected_edge_list sol_ref
num_edges = number_of_edges


for j=1 to num_edges
edge_ref = next_edge_ref


! get the extents of the edge
! ---------------------------


get_edge_extents sol_ref, edge_ref, x1, y1, z1, x2, y2, z2


! compare with current min and max
! --------------------------------


if x1 < xmin then xmin = x1
if y1 < ymin then ymin = y1
if z1 < zmin then zmin = z1


if x2 > xmax then xmax = x2
if y2 > ymax then ymax = y2
if z2 > zmax then zmax = z2
next j
next i
contour_3d [
start xmin, ymin, zmin
line xmax, ymin, zmin
line xmax, ymax, zmin
line xmin, ymax, zmin
line xmin, ymin, zmin
]
 
contour_3d [
start xmin, ymin, zmax
line xmax, ymin, zmax
line xmax, ymax, zmax
line xmin, ymax, zmax
line xmin, ymin, zmax
]
 
contour_3d [
start xmin, ymin, zmin
line xmin, ymin, zmax
]
 
contour_3d [
start xmax, ymin, zmin
line xmax, ymin, zmax
]
 
contour_3d [
start xmax, ymax, zmin
line xmax, ymax, zmax
]
 
contour_3d [
start xmin, ymax, zmin
line xmin, ymax, zmax
]
 
redraw