Solid Type: Difference between revisions

From Macros Wiki
Jump to navigationJump to search
ConnerO (talk | contribs)
New page: ! create 4 solids and set the solid type for each<br> <br> a1$ = "This macro will create 4 solids and set"<br> a2$ = "the name and type for each of them."<br> <br> message "%a1$\n%a2$"<br>...
 
ConnerO (talk | contribs)
No edit summary
 
Line 1: Line 1:
! create 4 solids and set the solid type for each<br>
{|
<br>
|!&nbsp;&nbsp;&nbsp; create 4 solids and set the solid type for each
a1$ = "This macro will create 4 solids and set"<br>
|-
a2$ = "the name and type for each of them."<br>
|&nbsp;
<br>
|-
message "%a1$\n%a2$"<br>
|a1$ = "This macro will create 4 solids and set"
<br>
|-
new_part "Example.vnc"<br>
|a2$ = "the name and type for each of them."
set_part_data mdd_name, "VMill3a"   ! 3 axis vertical mill<br>
|-
set_part_data units, 1             ! inches<br>
|&nbsp;
<br>
|-
set_part_data stock_x1, 0<br>
|message "%a1$\n%a2$"
set_part_data stock_y1, 0<br>
|-
set_part_data stock_z1, 0<br>
|&nbsp;
set_part_data stock_x2, 4<br>
|-
set_part_data stock_y2, 3<br>
|new_part "Example.vnc"
set_part_data stock_z2, 1<br>
|-
<br>
|set_part_data mdd_name, "VMill3a" || !&nbsp;&nbsp;&nbsp; 3 axis vertical mill
set_view iso<br>
|-
zoom_view 0    ! zoom full<br>
|set_part_data units, 1             || !&nbsp;&nbsp;&nbsp; inches
<br>
|-
local solref(4)<br>
|&nbsp;
<br>
|-
for i=1 to 4<br>
|set_part_data stock_x1, 0
<br>
|-
|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
|-
|&nbsp;
|-
|set_view iso
|-
|zoom_view 0    ||!&nbsp;&nbsp;&nbsp; zoom full
|-
|&nbsp;
|-
|local solref(4)
|-
|&nbsp;
|-
|for i=1 to 4
|}
:xs = 1
:xs = 1
:ys = 1
:ys = 1
Line 54: Line 78:
:deselect_all_geo
:deselect_all_geo
:delete_shape iref
:delete_shape iref
<br>
{|
next i<br>
|-
<br>
|next i
redraw<br>
|-
<br>
|&nbsp;
message "Change solid 1 type to Stock", "Solid Type", 1<br>
|-
<br>
|redraw
set_solid_type solref(1), 1<br>
|-
redraw<br>
|&nbsp;
<br>
|-
message "Change solid 2 type to Fixture", "Solid Type", 1<br>
|message "Change solid 1 type to Stock", "Solid Type", 1
<br>
|-
set_solid_type solref(2), 2<br>
|&nbsp;
redraw<br>
|-
<br>
|set_solid_type solref(1), 1
message "Change solid 3 type to Stock (Display Only)", "Solid Type", 1<br>
|-
<br>
|redraw
set_solid_type solref(3), 3<br>
|-
redraw<br>
|&nbsp;
<br>
|-
message "Change solid 4 type to Fixture (Display Only)", "Solid Type", 1<br>
|message "Change solid 2 type to Fixture", "Solid Type", 1
<br>
|-
set_solid_type solref(4), 4<br>
|&nbsp;
redraw<br>
|-
<br>
|set_solid_type solref(2), 2
message "Get a list of the solid types", "Solid Type", 1<br>
|-
<br>
|redraw
a1$ = "Solid Types\n"<br>
|-
<br>
|&nbsp;
for i=1 to 4<br>
|-
|message "Change solid 3 type to Stock (Display Only)", "Solid Type", 1
|-
|&nbsp;
|-
|set_solid_type solref(3), 3
|-
|redraw
|-
|&nbsp;
|-
|message "Change solid 4 type to Fixture (Display Only)", "Solid Type", 1
|-
|&nbsp;
|-
|set_solid_type solref(4), 4
|-
|redraw
|-
|&nbsp;
|-
|message "Get a list of the solid types", "Solid Type", 1
|-
|&nbsp;
|-
|a1$ = "Solid Types\n"
|-
|&nbsp;
|-
|for i=1 to 4
|}
:get_solid_type solref(i), itype
:get_solid_type solref(i), itype
:a2$ = "Solid number " + format$(i, "0") + " = "
:a2$ = "Solid number " + format$(i, "0") + " = "
Line 93: Line 147:
<br>
<br>
:a1$ = a1$ + "\n" + a2$ + a3$
:a1$ = a1$ + "\n" + a2$ + a3$
next i<br>
{|
<br>
|next i
a1$ = a1$ + "\n\nFinished"<br>
|-
<br>
|&nbsp;
stop a1$<br>
|-
|a1$ = a1$ + "\n\nFinished"
|-
|&nbsp;
|-
|stop a1$
|}

Latest revision as of 15:48, 29 July 2010

!    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$