Geo Transform

From Macros Wiki
Jump to navigationJump to search
!    create geometry and transform
a1$ = "This macro will use the geometry transformations"
a2$ = "translate, rotate, mirror, scale and copy"
 
message "%a1$\n%a2$"
 
!    start a new part and set the stock size
!    ---------------------------------------
   
new_part "Example.vnc"
set_part_data mdd_name, "VMill3a"  !    3 axis vertical mill
set_part_data units, 1  !    inches
   
set_part_data stock_x1, -10
set_part_data stock_y1, -10
set_part_data stock_z1, -1
set_part_data stock_x2, 10
set_part_data stock_y2, 10
set_part_data stock_z2, 1
   
set_view top
   
zoom_view 0 !    zoom full
   
message "Create a contour", "Geo Transform", 1
   
contour [
start 0, 0
line 5, 0
line 4, 2
line 4, 1
line 0, 1
line 0, 0
]
   
iref = ContourRef
   
message "Select the contour", "Geo Transform", 1
   
clear_select
select_shape iref
redraw
   
get_selection_list 1 !    save list of currently selected geometry
   
message "Translate by X 3, Y 4", "Geo Transform", 1
   
translate_geo 3, 4, 0
redraw
   
message "Rotate cw by 30 degrees", "Geo Transform", 1
   
rotate_geo 0, 0, 30
redraw
   
message "Mirror in X, about Y 0", "Geo Transform", 1
   
mirror_geo x, 0
redraw
   
message "Copy Translate by X 6, Y 0", "Geo Transform", 1
   
translate_geo 6, 0, 0, 1
redraw
   
get_selection_list 2 !    save list of currently selected geometry
   
message "Select both shapes", "Geo Transform", 1
   
set_selection_list 1 !    select the original shape
set_selection_list 2, 1 !    add the copy
redraw
   
message "Copy Mirror in Y about Y 1.5", "Geo Transform", 1
   
mirror_geo y, 1.5, 1
redraw
   
message "Scale all geometry to half size", "Geo Transform", 1
   
select_all_geo
scale_geo 0.5
redraw
   
message "Finished", "Geo Transform"