Solid Type
From Macros Wiki
! create 4 solids and set the solid type for each | |
a1$ = "This macro will create 4 solids and set" | |
a2$ = "the name and type for each of them." | |
message "%a1$\n%a2$" | |
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, 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 |
local solref(4) | |
for i=1 to 4 |
- xs = 1
- ys = 1
- if i=2 then xs = 2
- if i=4 then xs = 2
- if i > 2 then ys = 2
- xe = xs + 0.8
- ye = ys + 0.8
- contour [
- start xs, ys
- line xe, ys
- line xe, ye
- line xs, ye
- line xs, ys
- ]
- iref = ContourRef
- deselect_all_geo
- select_shape iref
- redraw
- extrude 0, (0.2 * i)
- solref(i) = SolidRef
- deselect_all_geo
- delete_shape iref
next i |
redraw |
message "Change solid 1 type to Stock", "Solid Type", 1 |
set_solid_type solref(1), 1 |
redraw |
message "Change solid 2 type to Fixture", "Solid Type", 1 |
set_solid_type solref(2), 2 |
redraw |
message "Change solid 3 type to Stock (Display Only)", "Solid Type", 1 |
set_solid_type solref(3), 3 |
redraw |
message "Change solid 4 type to Fixture (Display Only)", "Solid Type", 1 |
set_solid_type solref(4), 4 |
redraw |
message "Get a list of the solid types", "Solid Type", 1 |
a1$ = "Solid Types\n" |
for i=1 to 4 |
- get_solid_type solref(i), itype
- a2$ = "Solid number " + format$(i, "0") + " = "
- a3$ = "Unknown Type"
- if itype = 1 then a3$ = "Stock"
- if itype = 2 then a3$ = "Fixture"
- if itype = 3 then a3$ = "Stock (Display Only)"
- if itype = 4 then a3$ = "Fixture (Display Only)"
- a1$ = a1$ + "\n" + a2$ + a3$
next i |
a1$ = a1$ + "\n\nFinished" |
stop a1$ |