Solids: Difference between revisions
From Macros Wiki
Jump to navigationJump to search
New page: ! create a shape and revolve it<br> ! revolve again and boolean results<br> ! create a cuboid and boolean<br> <br> a1$ = "This macro will create revolved and extruded solids"<br> a2$ = "a... |
No edit summary |
||
| Line 1: | Line 1: | ||
{| | |||
! create a shape and revolve it | |! create a shape and revolve it | ||
! revolve again and boolean results | |- | ||
! create a cuboid and boolean | |! revolve again and boolean results | ||
|- | |||
a1$ = "This macro will create revolved and extruded solids" | |! create a cuboid and boolean | ||
a2$ = "and boolean them together. It will also transform the" | |- | ||
a3$ = "resulting solid by translating, rotating and mirror it" | | | ||
|- | |||
message "%a1$\n%a2$\n%a3$" | |a1$ = "This macro will create revolved and extruded solids" | ||
|- | |||
! start a new part and set the stock size | |a2$ = "and boolean them together. It will also transform the" | ||
! --------------------------------------- | |- | ||
|a3$ = "resulting solid by translating, rotating and mirror it" | |||
new_part "Example.vnc" | |- | ||
set_part_data mdd_name, "VMill3a" | | | ||
set_part_data units, 1 | |- | ||
|message "%a1$\n%a2$\n%a3$" | |||
set_part_data stock_x1, -6 | |- | ||
set_part_data stock_y1, -6 | | | ||
set_part_data stock_z1, -6 | |- | ||
set_part_data stock_x2, 6 | |! start a new part and set the stock size | ||
set_part_data stock_y2, 6 | |- | ||
set_part_data stock_z2, 6 | |! --------------------------------------- | ||
|- | |||
set_view iso | | | ||
zoom_view 0 | |- | ||
|new_part "Example.vnc" | |||
message "Create contour, without rotation", "Solids", 1 | |- | ||
|set_part_data mdd_name, "VMill3a" || ! 3 axis vertical mill | |||
contour [ | |- | ||
start 2, 2 | |set_part_data units, 1 || ! inches | ||
line 5, 2 | |- | ||
line 4, 4 | | | ||
line 2, 4 | |- | ||
line 2, 2 | |set_part_data stock_x1, -6 | ||
] | |- | ||
|set_part_data stock_y1, -6 | |||
iref = ContourRef | |- | ||
|set_part_data stock_z1, -6 | |||
message "select contour", "Solids", 1 | |- | ||
|set_part_data stock_x2, 6 | |||
deselect_all_geo | |- | ||
select_shape iref | |set_part_data stock_y2, 6 | ||
redraw | |- | ||
|set_part_data stock_z2, 6 | |||
message "Revolve Horizontal 180 degrees about Y 1", "Solids", 1 | |- | ||
| | |||
deselect_all_geo | |- | ||
select_shape iref | |set_view iso | ||
|- | |||
revolve h, 1, 180 | |zoom_view 0 || ! zoom full | ||
solref1 = SolidRef | |- | ||
redraw | | | ||
|- | |||
message "Revolve Vertical 120 degrees", "Solids", 1 | |message "Create contour, without rotation", "Solids", 1 | ||
|- | |||
deselect_all_geo | | | ||
select_shape iref | |- | ||
|contour [ | |||
revolve v, 0.1, 120 | |- | ||
solref2 = SolidRef | |start 2, 2 | ||
redraw | |- | ||
|line 5, 2 | |||
message "Union 2 solids", "Solids", 1 | |- | ||
|line 4, 4 | |||
solid_union solref1, solref2 | |- | ||
solref1 = SolidRef | |line 2, 4 | ||
|- | |||
message "Delete the contour and select the new solid", "Solids", 1 | |line 2, 2 | ||
|- | |||
deselect_all_geo | |] | ||
delete_shape iref | |- | ||
select_solid solref1 | | | ||
|- | |||
redraw | |iref = ContourRef | ||
|- | |||
message "Create a cuboid", "Solids", 1 | | | ||
|- | |||
contour [ | |message "select contour", "Solids", 1 | ||
start 1, 1 | |- | ||
line 4, 1 | | | ||
line 4, 4 | |- | ||
line 1, 4 | |deselect_all_geo | ||
line 1, 1 | |- | ||
] | |select_shape iref | ||
|- | |||
iref = ContourRef | |redraw | ||
|- | |||
redraw | | | ||
|- | |||
deselect_all_geo | |message "Revolve Horizontal 180 degrees about Y 1", "Solids", 1 | ||
select_shape iref | |- | ||
| | |||
extrude -2, 2 | |- | ||
solref2 = SolidRef | |deselect_all_geo | ||
|- | |||
deselect_all_geo | |select_shape iref | ||
delete_shape iref | |- | ||
| | |||
redraw | |- | ||
|revolve h, 1, 180 | |||
message "Boolean 2 solids together", "Solids", 1 | |- | ||
|solref1 = SolidRef | |||
solid_union solref1, solref2 | |- | ||
!solid_subtract solref1, solref2 | |redraw | ||
!solid_intersect solref1, solref2 | |- | ||
| | |||
solref = SolidRef | |- | ||
|message "Revolve Vertical 120 degrees", "Solids", 1 | |||
clear_select | |- | ||
redraw | | | ||
|- | |||
message "Select top and select the new solid", "Solids", 1 | |deselect_all_geo | ||
|- | |||
select_solid solref | |select_shape iref | ||
set_view top | |- | ||
zoom_view 0 | | | ||
redraw | |- | ||
|revolve v, 0.1, 120 | |||
message "Translate", "Solids", 1 | |- | ||
translate_solid 1, 0.2, 0.3 | |solref2 = SolidRef | ||
redraw | |- | ||
|redraw | |||
message "Mirror X", "Solids", 1 | |- | ||
mirror_solid x, 0.2 | | | ||
redraw | |- | ||
|message "Union 2 solids", "Solids", 1 | |||
message "Mirror Y", "Solids", 1 | |- | ||
mirror_solid y, 0.3 | | | ||
redraw | |- | ||
|solid_union solref1, solref2 | |||
message "Rotate", "Solids", 1 | |- | ||
rotate_solid 0, 0, 60 | |solref1 = SolidRef | ||
redraw | |- | ||
| | |||
message "Select ISO view", "Solids", 1 | |- | ||
|message "Delete the contour and select the new solid", "Solids", 1 | |||
set_view iso | |- | ||
| | |||
message "Scale the solid to 1/4 size", "Solids", 1 | |- | ||
|deselect_all_geo | |||
scale_solid 0.25 | |- | ||
redraw | |delete_shape iref | ||
|- | |||
message "Back to top view, move the solid left then copy and translate it" | |select_solid solref1 | ||
|- | |||
set_view top | | | ||
|- | |||
translate_solid -4, 0, 0 | |redraw | ||
translate_solid 3, 0, 0, 3 | |- | ||
redraw | | | ||
|- | |||
stop "Finished" | |message "Create a cuboid", "Solids", 1 | ||
|- | |||
| | |||
|- | |||
|contour [ | |||
|- | |||
|start 1, 1 | |||
|- | |||
|line 4, 1 | |||
|- | |||
|line 4, 4 | |||
|- | |||
|line 1, 4 | |||
|- | |||
|line 1, 1 | |||
|- | |||
|] | |||
|- | |||
| | |||
|- | |||
|iref = ContourRef | |||
|- | |||
| | |||
|- | |||
|redraw | |||
|- | |||
| | |||
|- | |||
|deselect_all_geo | |||
|- | |||
|select_shape iref | |||
|- | |||
| | |||
|- | |||
|extrude -2, 2 | |||
|- | |||
|solref2 = SolidRef | |||
|- | |||
| | |||
|- | |||
|deselect_all_geo | |||
|- | |||
|delete_shape iref | |||
|- | |||
| | |||
|- | |||
|redraw | |||
|- | |||
| | |||
|- | |||
|message "Boolean 2 solids together", "Solids", 1 | |||
|- | |||
| | |||
|- | |||
|solid_union solref1, solref2 | |||
|- | |||
|! solid_subtract solref1, solref2 | |||
|- | |||
|! solid_intersect solref1, solref2 | |||
|- | |||
| | |||
|- | |||
|solref = SolidRef | |||
|- | |||
| | |||
|- | |||
|clear_select | |||
|- | |||
|redraw | |||
|- | |||
| | |||
|- | |||
|message "Select top and select the new solid", "Solids", 1 | |||
|- | |||
| | |||
|- | |||
|select_solid solref | |||
|- | |||
|set_view top | |||
|- | |||
|zoom_view 0 | |||
|- | |||
|redraw | |||
|- | |||
| | |||
|- | |||
|message "Translate", "Solids", 1 | |||
|- | |||
|translate_solid 1, 0.2, 0.3 | |||
|- | |||
|redraw | |||
|- | |||
| | |||
|- | |||
|message "Mirror X", "Solids", 1 | |||
|- | |||
|mirror_solid x, 0.2 | |||
|- | |||
|redraw | |||
|- | |||
| | |||
|- | |||
|message "Mirror Y", "Solids", 1 | |||
|- | |||
|mirror_solid y, 0.3 | |||
|- | |||
|redraw | |||
|- | |||
| | |||
|- | |||
|message "Rotate", "Solids", 1 | |||
|- | |||
|rotate_solid 0, 0, 60 | |||
|- | |||
|redraw | |||
|- | |||
| | |||
|- | |||
|message "Select ISO view", "Solids", 1 | |||
|- | |||
| | |||
|- | |||
|set_view iso | |||
|- | |||
| | |||
|- | |||
|message "Scale the solid to 1/4 size", "Solids", 1 | |||
|- | |||
| | |||
|- | |||
|scale_solid 0.25 | |||
|- | |||
|redraw | |||
|- | |||
| | |||
|- | |||
|message "Back to top view, move the solid left then copy and translate it" | |||
|- | |||
| | |||
|- | |||
|set_view top | |||
|- | |||
| | |||
|- | |||
|translate_solid -4, 0, 0 | |||
|- | |||
|translate_solid 3, 0, 0, 3 | |||
|- | |||
|redraw | |||
|- | |||
| | |||
|- | |||
|stop "Finished" | |||
|} | |||
Latest revision as of 15:45, 29 July 2010
| ! create a shape and revolve it | |
| ! revolve again and boolean results | |
| ! create a cuboid and boolean | |
| a1$ = "This macro will create revolved and extruded solids" | |
| a2$ = "and boolean them together. It will also transform the" | |
| a3$ = "resulting solid by translating, rotating and mirror it" | |
| message "%a1$\n%a2$\n%a3$" | |
| ! 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, -6 | |
| set_part_data stock_y1, -6 | |
| set_part_data stock_z1, -6 | |
| set_part_data stock_x2, 6 | |
| set_part_data stock_y2, 6 | |
| set_part_data stock_z2, 6 | |
| set_view iso | |
| zoom_view 0 | ! zoom full |
| message "Create contour, without rotation", "Solids", 1 | |
| contour [ | |
| start 2, 2 | |
| line 5, 2 | |
| line 4, 4 | |
| line 2, 4 | |
| line 2, 2 | |
| ] | |
| iref = ContourRef | |
| message "select contour", "Solids", 1 | |
| deselect_all_geo | |
| select_shape iref | |
| redraw | |
| message "Revolve Horizontal 180 degrees about Y 1", "Solids", 1 | |
| deselect_all_geo | |
| select_shape iref | |
| revolve h, 1, 180 | |
| solref1 = SolidRef | |
| redraw | |
| message "Revolve Vertical 120 degrees", "Solids", 1 | |
| deselect_all_geo | |
| select_shape iref | |
| revolve v, 0.1, 120 | |
| solref2 = SolidRef | |
| redraw | |
| message "Union 2 solids", "Solids", 1 | |
| solid_union solref1, solref2 | |
| solref1 = SolidRef | |
| message "Delete the contour and select the new solid", "Solids", 1 | |
| deselect_all_geo | |
| delete_shape iref | |
| select_solid solref1 | |
| redraw | |
| message "Create a cuboid", "Solids", 1 | |
| contour [ | |
| start 1, 1 | |
| line 4, 1 | |
| line 4, 4 | |
| line 1, 4 | |
| line 1, 1 | |
| ] | |
| iref = ContourRef | |
| redraw | |
| deselect_all_geo | |
| select_shape iref | |
| extrude -2, 2 | |
| solref2 = SolidRef | |
| deselect_all_geo | |
| delete_shape iref | |
| redraw | |
| message "Boolean 2 solids together", "Solids", 1 | |
| solid_union solref1, solref2 | |
| ! solid_subtract solref1, solref2 | |
| ! solid_intersect solref1, solref2 | |
| solref = SolidRef | |
| clear_select | |
| redraw | |
| message "Select top and select the new solid", "Solids", 1 | |
| select_solid solref | |
| set_view top | |
| zoom_view 0 | |
| redraw | |
| message "Translate", "Solids", 1 | |
| translate_solid 1, 0.2, 0.3 | |
| redraw | |
| message "Mirror X", "Solids", 1 | |
| mirror_solid x, 0.2 | |
| redraw | |
| message "Mirror Y", "Solids", 1 | |
| mirror_solid y, 0.3 | |
| redraw | |
| message "Rotate", "Solids", 1 | |
| rotate_solid 0, 0, 60 | |
| redraw | |
| message "Select ISO view", "Solids", 1 | |
| set_view iso | |
| message "Scale the solid to 1/4 size", "Solids", 1 | |
| scale_solid 0.25 | |
| redraw | |
| message "Back to top view, move the solid left then copy and translate it" | |
| set_view top | |
| translate_solid -4, 0, 0 | |
| translate_solid 3, 0, 0, 3 | |
| redraw | |
| stop "Finished" |