Bag Solids
From Macros Wiki
! create 2 solids and put them in and out of the body bag | |
a1$ = "This macro will create 2 solids and show" | |
a2$ = "them going in and out of the body bag." | |
message "%a1$\n%a2$" | |
new_part "Example.vnc" | |
set_part_data mdd_name, "VMill3a" | |
set_part_data units, 1 | |
set_part_data stock_x1, 0 | |
set_part_data stock_y1, 0 | |
set_part_data stock_z1, 0 | |
set_part_data stock_x2, 4 | |
set_part_data stock_y2, 3 | |
set_part_data stock_z2, 1 | |
set_view iso | |
zoom_view 0 | ! zoom full |
contour [ | |
start 0, 0 | |
line 2, 0 | |
line 1, 3 | |
line 0, 0 | |
] | |
iref = ContourRef | |
deselect_all_geo | |
select_shape iref | |
redraw | |
extrude 0, 1 | |
solref1 = SolidRef | |
deselect_all_geo | |
delete_shape iref | |
contour [ | |
start 2, 3 | |
line 3, 0 | |
line 4, 3 | |
line 2, 3 | |
] | |
iref = ContourRef | |
deselect_all_geo | |
deselect_all_solids | |
select_shape iref | |
extrude 0, 1 | |
solref2 = SolidRef | |
deselect_all_geo | |
delete_shape iref | |
redraw | |
message "Put the first solid in the bag", "Bag Solids", 1 | |
set_solid_bagged solref1, 1 | |
redraw | |
message "Check the bagged state of the 2 solids", "Bag Solids", 1 | |
get_solid_bagged solref1, bag1 | |
get_solid_bagged solref2, bag2 | |
message "Solid 1 bagged = %bag1\nSolid 2 bagged = %bag2", "Bag Solids", 1 | |
message "Unbag the first solid and bag the second one", "Bag Solids", 1 | |
set_solid_bagged solref1, 0 | |
set_solid_bagged solref2, 1 | |
redraw | |
stop "Finished" |