Create Contour.mac

From Macros Wiki
Jump to: navigation, search
Create Contour
!   
!    create a contour
!   
message "This macro will create a simple contour"
  !    start a new part
!    ----------------
 
new_part "Example.vnc"
set_part_data mdd_name, "VMill3a"  ! 3 axis vertical mill
set_part_data units, 1  ! inches
 
dialog "CreateContour.dlg"
 
!    l1 = long length
!    l2 = short length
!    h1 = long height
!    h2 = short height
!    r1 = large fillet
!    r2 = small fillet
 
!    set the stock size to 25% larger than part all around
!    -----------------------------------------------------
 
set_part_data stock_x1, -l1*0.25
set_part_data stock_y1, -h1*0.25
set_part_data stock_z1, 0
set_part_data stock_x2, l1*1.25
set_part_data stock_y2, h1*1.25
set_part_data stock_z2, 1
 
set_view top
zoom_view 0  ! unzoom
redraw
 
contour [
start r1, 0
line l1-r1, 0
arc l1-r1, r1, l1, r1, ccw
line l1, h2-r2
arc l1-r2, h2-r2, l1-r2, h2, ccw
line l2+r2, h2
arc l2+r2, h2+r2, l2, h2+r2, cw
line l2, h1-r2
arc l2-r2, h1-r2, l2-r2, h1, ccw
line r1, h1
arc r1, h1-r1, 0, h1-r1, ccw
line 0, r1
arc r1, r1, r1, 0, ccw
]
 
clear_select
 
redraw
 
message "Shrinkwrap"
 
shrink_wrap
 
message "Finished"