mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-08-12 18:33:58 +02:00
Shortened the module comments by factoring out the parameter discriptions.
Added the nut example picture. Fixed nut picture placement. Updated images and readme.
This commit is contained in:
73
readme.md
73
readme.md
@@ -25,26 +25,26 @@ A list of changes classified as breaking, additions or fixes is maintained in [C
|
||||
<tr><td> <a href = "#antennas">Antennas</a> </td><td> <a href = "#inserts">Inserts</a> </td><td> <a href = "#rails">Rails</a> </td><td> <a href = "#butt_box">Butt_box</a> </td><td> <a href = "#bezier">Bezier</a> </td><td> <a href = "#clip">Clip</a> </td></tr>
|
||||
<tr><td> <a href = "#axials">Axials</a> </td><td> <a href = "#jack">Jack</a> </td><td> <a href = "#ring_terminals">Ring_terminals</a> </td><td> <a href = "#cable_clip">Cable_clip</a> </td><td> <a href = "#catenary">Catenary</a> </td><td> <a href = "#global">Global</a> </td></tr>
|
||||
<tr><td> <a href = "#bldc_motors">BLDC_motors</a> </td><td> <a href = "#ldrs">LDRs</a> </td><td> <a href = "#rockers">Rockers</a> </td><td> <a href = "#cable_grommets">Cable_grommets</a> </td><td> <a href = "#core_xy">Core_xy</a> </td><td> <a href = "#polyholes">Polyholes</a> </td></tr>
|
||||
<tr><td> <a href = "#ball_bearings">Ball_bearings</a> </td><td> <a href = "#led_meters">LED_meters</a> </td><td> <a href = "#rod">Rod</a> </td><td> <a href = "#camera_housing">Camera_housing</a> </td><td> <a href = "#dogbones">Dogbones</a> </td><td> <a href = "#rounded_rectangle">Rounded_rectangle</a> </td></tr>
|
||||
<tr><td> <a href = "#batteries">Batteries</a> </td><td> <a href = "#leds">LEDs</a> </td><td> <a href = "#rod_ends">Rod_ends</a> </td><td> <a href = "#carriers">Carriers</a> </td><td> <a href = "#fillet">Fillet</a> </td><td> <a href = "#sphere">Sphere</a> </td></tr>
|
||||
<tr><td> <a href = "#bearing_blocks">Bearing_blocks</a> </td><td> <a href = "#leadnuts">Leadnuts</a> </td><td> <a href = "#sbr_rails">SBR_rails</a> </td><td> <a href = "#corner_block">Corner_block</a> </td><td> <a href = "#gears">Gears</a> </td><td> <a href = "#teardrops">Teardrops</a> </td></tr>
|
||||
<tr><td> <a href = "#belts">Belts</a> </td><td> <a href = "#light_strips">Light_strips</a> </td><td> <a href = "#sk_brackets">SK_brackets</a> </td><td> <a href = "#door_hinge">Door_hinge</a> </td><td> <a href = "#hanging_hole">Hanging_hole</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#blowers">Blowers</a> </td><td> <a href = "#linear_bearings">Linear_bearings</a> </td><td> <a href = "#smds">SMDs</a> </td><td> <a href = "#door_latch">Door_latch</a> </td><td> <a href = "#horiholes">Horiholes</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#box_sections">Box_sections</a> </td><td> <a href = "#magnets">Magnets</a> </td><td> <a href = "#ssrs">SSRs</a> </td><td> <a href = "#drag_chain">Drag_chain</a> </td><td> <a href = "#layout">Layout</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#bulldogs">Bulldogs</a> </td><td> <a href = "#mains_sockets">Mains_sockets</a> </td><td> <a href = "#screws">Screws</a> </td><td> <a href = "#fan_guard">Fan_guard</a> </td><td> <a href = "#maths">Maths</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#buttons">Buttons</a> </td><td> <a href = "#microswitches">Microswitches</a> </td><td> <a href = "#sealing_strip">Sealing_strip</a> </td><td> <a href = "#fixing_block">Fixing_block</a> </td><td> <a href = "#offset">Offset</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#cable_strips">Cable_strips</a> </td><td> <a href = "#microview">Microview</a> </td><td> <a href = "#servo_motors">Servo_motors</a> </td><td> <a href = "#flat_hinge">Flat_hinge</a> </td><td> <a href = "#pcb_utils">PCB_utils</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#cameras">Cameras</a> </td><td> <a href = "#modules">Modules</a> </td><td> <a href = "#shaft_couplings">Shaft_couplings</a> </td><td> <a href = "#foot">Foot</a> </td><td> <a href = "#quadrant">Quadrant</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#circlips">Circlips</a> </td><td> <a href = "#nuts">Nuts</a> </td><td> <a href = "#sheets">Sheets</a> </td><td> <a href = "#handle">Handle</a> </td><td> <a href = "#round">Round</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#components">Components</a> </td><td> <a href = "#o_ring">O_ring</a> </td><td> <a href = "#spades">Spades</a> </td><td> <a href = "#knob">Knob</a> </td><td> <a href = "#rounded_cylinder">Rounded_cylinder</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#dip">DIP</a> </td><td> <a href = "#opengrab">Opengrab</a> </td><td> <a href = "#spools">Spools</a> </td><td> <a href = "#led_bezel">LED_bezel</a> </td><td> <a href = "#rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#d_connectors">D_connectors</a> </td><td> <a href = "#pcb">PCB</a> </td><td> <a href = "#springs">Springs</a> </td><td> <a href = "#pcb_mount">PCB_mount</a> </td><td> <a href = "#rounded_triangle">Rounded_triangle</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#displays">Displays</a> </td><td> <a href = "#pcbs">PCBs</a> </td><td> <a href = "#stepper_motors">Stepper_motors</a> </td><td> <a href = "#psu_shroud">PSU_shroud</a> </td><td> <a href = "#sector">Sector</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#extrusion_brackets">Extrusion_brackets</a> </td><td> <a href = "#psus">PSUs</a> </td><td> <a href = "#swiss_clips">Swiss_clips</a> </td><td> <a href = "#pocket_handle">Pocket_handle</a> </td><td> <a href = "#splines">Splines</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#extrusions">Extrusions</a> </td><td> <a href = "#panel_meters">Panel_meters</a> </td><td> <a href = "#terminals">Terminals</a> </td><td> <a href = "#press_fit">Press_fit</a> </td><td> <a href = "#sweep">Sweep</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#fans">Fans</a> </td><td> <a href = "#photo_interrupters">Photo_interrupters</a> </td><td> <a href = "#toggles">Toggles</a> </td><td> <a href = "#printed_box">Printed_box</a> </td><td> <a href = "#thread">Thread</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#fastons">Fastons</a> </td><td> <a href = "#pillars">Pillars</a> </td><td> <a href = "#transformers">Transformers</a> </td><td> <a href = "#printed_pulleys">Printed_pulleys</a> </td><td> <a href = "#tube">Tube</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#fuseholder">Fuseholder</a> </td><td> <a href = "#pillow_blocks">Pillow_blocks</a> </td><td> <a href = "#ttracks">Ttracks</a> </td><td> <a href = "#ribbon_clamp">Ribbon_clamp</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#ball_bearings">Ball_bearings</a> </td><td> <a href = "#led_meters">LED_meters</a> </td><td> <a href = "#rod">Rod</a> </td><td> <a href = "#camera_housing">Camera_housing</a> </td><td> <a href = "#dimension">Dimension</a> </td><td> <a href = "#rounded_rectangle">Rounded_rectangle</a> </td></tr>
|
||||
<tr><td> <a href = "#batteries">Batteries</a> </td><td> <a href = "#leds">LEDs</a> </td><td> <a href = "#rod_ends">Rod_ends</a> </td><td> <a href = "#carriers">Carriers</a> </td><td> <a href = "#dogbones">Dogbones</a> </td><td> <a href = "#sphere">Sphere</a> </td></tr>
|
||||
<tr><td> <a href = "#bearing_blocks">Bearing_blocks</a> </td><td> <a href = "#leadnuts">Leadnuts</a> </td><td> <a href = "#sbr_rails">SBR_rails</a> </td><td> <a href = "#corner_block">Corner_block</a> </td><td> <a href = "#fillet">Fillet</a> </td><td> <a href = "#teardrops">Teardrops</a> </td></tr>
|
||||
<tr><td> <a href = "#belts">Belts</a> </td><td> <a href = "#light_strips">Light_strips</a> </td><td> <a href = "#sk_brackets">SK_brackets</a> </td><td> <a href = "#door_hinge">Door_hinge</a> </td><td> <a href = "#gears">Gears</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#blowers">Blowers</a> </td><td> <a href = "#linear_bearings">Linear_bearings</a> </td><td> <a href = "#smds">SMDs</a> </td><td> <a href = "#door_latch">Door_latch</a> </td><td> <a href = "#hanging_hole">Hanging_hole</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#box_sections">Box_sections</a> </td><td> <a href = "#magnets">Magnets</a> </td><td> <a href = "#ssrs">SSRs</a> </td><td> <a href = "#drag_chain">Drag_chain</a> </td><td> <a href = "#horiholes">Horiholes</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#bulldogs">Bulldogs</a> </td><td> <a href = "#mains_sockets">Mains_sockets</a> </td><td> <a href = "#screws">Screws</a> </td><td> <a href = "#fan_guard">Fan_guard</a> </td><td> <a href = "#layout">Layout</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#buttons">Buttons</a> </td><td> <a href = "#microswitches">Microswitches</a> </td><td> <a href = "#sealing_strip">Sealing_strip</a> </td><td> <a href = "#fixing_block">Fixing_block</a> </td><td> <a href = "#maths">Maths</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#cable_strips">Cable_strips</a> </td><td> <a href = "#microview">Microview</a> </td><td> <a href = "#servo_motors">Servo_motors</a> </td><td> <a href = "#flat_hinge">Flat_hinge</a> </td><td> <a href = "#offset">Offset</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#cameras">Cameras</a> </td><td> <a href = "#modules">Modules</a> </td><td> <a href = "#shaft_couplings">Shaft_couplings</a> </td><td> <a href = "#foot">Foot</a> </td><td> <a href = "#pcb_utils">PCB_utils</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#circlips">Circlips</a> </td><td> <a href = "#nuts">Nuts</a> </td><td> <a href = "#sheets">Sheets</a> </td><td> <a href = "#handle">Handle</a> </td><td> <a href = "#quadrant">Quadrant</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#components">Components</a> </td><td> <a href = "#o_ring">O_ring</a> </td><td> <a href = "#spades">Spades</a> </td><td> <a href = "#knob">Knob</a> </td><td> <a href = "#round">Round</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#dip">DIP</a> </td><td> <a href = "#opengrab">Opengrab</a> </td><td> <a href = "#spools">Spools</a> </td><td> <a href = "#led_bezel">LED_bezel</a> </td><td> <a href = "#rounded_cylinder">Rounded_cylinder</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#d_connectors">D_connectors</a> </td><td> <a href = "#pcb">PCB</a> </td><td> <a href = "#springs">Springs</a> </td><td> <a href = "#pcb_mount">PCB_mount</a> </td><td> <a href = "#rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#displays">Displays</a> </td><td> <a href = "#pcbs">PCBs</a> </td><td> <a href = "#stepper_motors">Stepper_motors</a> </td><td> <a href = "#psu_shroud">PSU_shroud</a> </td><td> <a href = "#rounded_triangle">Rounded_triangle</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#extrusion_brackets">Extrusion_brackets</a> </td><td> <a href = "#psus">PSUs</a> </td><td> <a href = "#swiss_clips">Swiss_clips</a> </td><td> <a href = "#pocket_handle">Pocket_handle</a> </td><td> <a href = "#sector">Sector</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#extrusions">Extrusions</a> </td><td> <a href = "#panel_meters">Panel_meters</a> </td><td> <a href = "#terminals">Terminals</a> </td><td> <a href = "#press_fit">Press_fit</a> </td><td> <a href = "#splines">Splines</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#fans">Fans</a> </td><td> <a href = "#photo_interrupters">Photo_interrupters</a> </td><td> <a href = "#toggles">Toggles</a> </td><td> <a href = "#printed_box">Printed_box</a> </td><td> <a href = "#sweep">Sweep</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#fastons">Fastons</a> </td><td> <a href = "#pillars">Pillars</a> </td><td> <a href = "#transformers">Transformers</a> </td><td> <a href = "#printed_pulleys">Printed_pulleys</a> </td><td> <a href = "#thread">Thread</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#fuseholder">Fuseholder</a> </td><td> <a href = "#pillow_blocks">Pillow_blocks</a> </td><td> <a href = "#ttracks">Ttracks</a> </td><td> <a href = "#ribbon_clamp">Ribbon_clamp</a> </td><td> <a href = "#tube">Tube</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#gear_motors">Gear_motors</a> </td><td> <a href = "#pin_headers">Pin_headers</a> </td><td> <a href = "#tubings">Tubings</a> </td><td> <a href = "#ssr_shroud">SSR_shroud</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#geared_steppers">Geared_steppers</a> </td><td> <a href = "#potentiometers">Potentiometers</a> </td><td> <a href = "#variacs">Variacs</a> </td><td> <a href = "#screw_knob">Screw_knob</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#green_terminals">Green_terminals</a> </td><td> <a href = "#pulleys">Pulleys</a> </td><td> <a href = "#veroboard">Veroboard</a> </td><td> <a href = "#socket_box">Socket_box</a> </td><td></td><td></td></tr>
|
||||
@@ -2460,6 +2460,10 @@ Default is steel but can be drawn as brass or nylon. A utility for making nut tr
|
||||
|
||||
If a nut is given a child then it gets placed on its top surface.
|
||||
|
||||
The following diagram shows you the parameters for drawing a sliding_t_nut:
|
||||
|
||||

|
||||
|
||||
[vitamins/nuts.scad](vitamins/nuts.scad) Object definitions.
|
||||
|
||||
[vitamins/nut.scad](vitamins/nut.scad) Implementation.
|
||||
@@ -7242,6 +7246,35 @@ allows flexible positioning of the motors.
|
||||
| 6 | `NEMA(NEMA17_40)` | Stepper motor NEMA17 x 40mm (5x20 shaft) |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
<a name="dimension"></a>
|
||||
## Dimension
|
||||
Modules for adding dimensions to assembly views.
|
||||
|
||||
<img src="docs/sliding_t_nut.png" width="500", height="378">
|
||||
|
||||
* If `text` is empty, will display the measured distance.
|
||||
* `offset` will determine how much space is between the measured point and the dimension.
|
||||
* `thickness` is the thickness of the lines, and size of the arrows, if 0, will use 0.5% of the length of the dim.
|
||||
* `text_size` will determine the size of the text, if 0, will use percentage of the length of the dim.
|
||||
|
||||
[utils/dimension.scad](utils/dimension.scad) Implementation.
|
||||
|
||||
[tests/dimension.scad](tests/dimension.scad) Code for this example.
|
||||
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| `dimension(startpoint, endpoint, text = "", thickness = 0, text_size = 0 , rot_around_dim = 0)` | Creates a 3D dimension between two points. |
|
||||
| `dimension_x(startpoint, endpoint, offset = 1, text = "", thickness = 0, text_size = 0 , plane = "xy")` | Creates a dimension in the x direction. Plane options : xy, xz |
|
||||
| `dimension_y(startpoint, endpoint, offset = 1, text = "", thickness = 0, text_size = 0 , plane = "xy")` | Creates a dimension in the y direction. Plane options : xy, yz |
|
||||
| `dimension_z(startpoint, endpoint, offset = 1, text = "", thickness = 0, text_size = 0 , plane = "xz")` | Creates a dimension in the z direction. Plane options : xz, yz |
|
||||
|
||||

|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// NopSCADlib Copyright Chris Palmer 2018
|
||||
// NopSCADlib Copyright Chris Palmer 2025
|
||||
// nop.head@gmail.com
|
||||
// hydraraptor.blogspot.com
|
||||
//
|
||||
@@ -46,29 +46,29 @@ module dimensions_3d_xyz() {
|
||||
|
||||
dimension([0,0,0], [-3,0,10], "");
|
||||
dimension([0,0,0], [0,0,-10], "");
|
||||
|
||||
|
||||
dimension([0,0,0], [0,2,10], "");
|
||||
dimension([0,0,0], [0,2,-10], "");
|
||||
|
||||
|
||||
}
|
||||
|
||||
module dimension_1d_x() {
|
||||
dimension_x([12,0,0], [18,0,0]);
|
||||
dimension_x([12,5,0], [18,10,0], offset = -1);
|
||||
dimension_x([12,0,-5], [18,0,0], plane= "xz");
|
||||
dimension_x([12,5,0], [18,10,5]);
|
||||
dimension_x([12,5,0], [18,10,5]);
|
||||
}
|
||||
|
||||
module dimension_1d_y() {
|
||||
dimension_y([12,0,0], [12,-5,0]);
|
||||
dimension_y([12,-8,0], [18,-10,0]);
|
||||
dimension_y([12,-5,0], [18,-10,5], offset = -1, plane= "yz");
|
||||
dimension_y([12,-5,0], [18,-10,5], offset = -1, plane= "yz");
|
||||
}
|
||||
|
||||
module dimension_1d_z() {
|
||||
dimension_z([20,0,5], [20,0,0]);
|
||||
dimension_z([20,0,10], [20,0,0]);
|
||||
dimension_z([20,0,0], [20,10,10],plane= "yz");
|
||||
dimension_z([20,0,0], [20,10,10],plane= "yz");
|
||||
}
|
||||
|
||||
if($preview)
|
||||
@@ -77,6 +77,3 @@ if($preview)
|
||||
dimension_1d_x();
|
||||
dimension_1d_y();
|
||||
dimension_1d_z();
|
||||
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
BIN
tests/png/dimension.png
Normal file
BIN
tests/png/dimension.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 103 KiB |
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// NopSCADlib Copyright Chris Palmer 2018
|
||||
// NopSCADlib Copyright Chris Palmer 2025
|
||||
// nop.head@gmail.com
|
||||
// hydraraptor.blogspot.com
|
||||
//
|
||||
@@ -17,13 +17,20 @@
|
||||
// If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
//
|
||||
//! Modules for adding dimensions to assembly views.
|
||||
//!
|
||||
//! <img src="docs/sliding_t_nut.png" width="500", height="378">
|
||||
//!
|
||||
//! * If `text` is empty, will display the measured distance.
|
||||
//! * `offset` will determine how much space is between the measured point and the dimension.
|
||||
//! * `thickness` is the thickness of the lines, and size of the arrows, if 0, will use 0.5% of the length of the dim.
|
||||
//! * `text_size` will determine the size of the text, if 0, will use percentage of the length of the dim.
|
||||
|
||||
include <../utils/core/core.scad>
|
||||
include <../utils/maths.scad>
|
||||
|
||||
|
||||
|
||||
|
||||
module dimension(startpoint, endpoint, text = "", thickness = 0, text_size = 0 , rot_around_dim=0) { //! Will create a 3D dimension between two points. If text is empty, will display the measured distance. Thickness will determine the thickness of the lines, and size of the arrows, if 0, will use 0.5% of the length of the dim. Text_size will determine the size of the text, if 0, will use percentage of the length of the dim
|
||||
module dimension(startpoint, endpoint, text = "", thickness = 0, text_size = 0 , rot_around_dim = 0) { //! Creates a 3D dimension between two points.
|
||||
// Compute vector between points
|
||||
direction = endpoint - startpoint;
|
||||
length = norm(direction);
|
||||
@@ -34,9 +41,9 @@ module dimension(startpoint, endpoint, text = "", thickness = 0, text_size = 0 ,
|
||||
dir_xy = norm([direction.x, direction.y]);
|
||||
|
||||
// Compute rotation angles
|
||||
azimuth = atan2(direction.y, direction.x);
|
||||
azimuth = atan2(direction.y, direction.x);
|
||||
elevation = -atan2(direction.z, dir_xy);
|
||||
|
||||
|
||||
//end triangle size
|
||||
etr_width = thickness *10;
|
||||
etr_height = thickness *4;
|
||||
@@ -44,32 +51,32 @@ module dimension(startpoint, endpoint, text = "", thickness = 0, text_size = 0 ,
|
||||
// Draw measurement line as a thin cylinder
|
||||
translate(midpoint)
|
||||
rotate([0, elevation, azimuth])
|
||||
rotate([0, 90, 0])
|
||||
rotate([0, 90, 0])
|
||||
resize([thickness, thickness, length - etr_width+0.01 ])
|
||||
cube(center = true);
|
||||
|
||||
|
||||
//do some vector calculations
|
||||
dir = (length > 0) ? (direction / length) * thickness * 4 : [1, 0, 0];
|
||||
dir = (length > 0) ? (direction / length) * thickness * 4 : [1, 0, 0];
|
||||
|
||||
// Draw endpoint markers
|
||||
translate(startpoint)
|
||||
rotate([0, elevation, azimuth])
|
||||
translate(startpoint)
|
||||
rotate([0, elevation, azimuth])
|
||||
rotate([rot_around_dim,0,0])
|
||||
translate([0,0,-thickness/2])
|
||||
linear_extrude(thickness)
|
||||
polygon([[etr_width, etr_height/2],[0,0],[etr_width, -etr_height/2]],[[0,1,2]]);
|
||||
|
||||
translate(endpoint)
|
||||
rotate([0, elevation, azimuth])
|
||||
|
||||
translate(endpoint)
|
||||
rotate([0, elevation, azimuth])
|
||||
rotate([rot_around_dim,0,0])
|
||||
translate([0,0,-thickness/2])
|
||||
linear_extrude(thickness)
|
||||
polygon([[-etr_width, etr_height/2],[0,0],[-etr_width, -etr_height/2]],[[0,1,2]]);
|
||||
|
||||
|
||||
|
||||
// Draw the text/distance
|
||||
translate(midpoint)
|
||||
rotate([0, elevation, azimuth])
|
||||
rotate([0, elevation, azimuth])
|
||||
rotate([rot_around_dim,0,0])
|
||||
translate([0,thickness,-thickness/2])
|
||||
linear_extrude(thickness)
|
||||
@@ -77,36 +84,36 @@ module dimension(startpoint, endpoint, text = "", thickness = 0, text_size = 0 ,
|
||||
}
|
||||
|
||||
|
||||
module dimension_x(startpoint, endpoint, offset = 1, text = "", thickness = 0, text_size = 0 , plane = "xy") { //! Will create a dimension in the x direction. Offset will determine how much space is between the measured point and the dimension. Plane options : xy, xz
|
||||
module dimension_x(startpoint, endpoint, offset = 1, text = "", thickness = 0, text_size = 0 , plane = "xy") { //! Creates a dimension in the x direction. Plane options : xy, xz
|
||||
length = norm(endpoint - startpoint);
|
||||
thickness = (thickness == 0? length/200:thickness);
|
||||
|
||||
y = offset > 0 ? max(startpoint.y, endpoint.y) + (plane=="xy"?offset:0) : min(startpoint.y, endpoint.y) + (plane=="xy"?offset:0);
|
||||
z = offset > 0 ? max(startpoint.z, endpoint.z) + (plane=="xz"?offset:0) : min(startpoint.z, endpoint.z) + (plane=="xz"?offset:0);
|
||||
|
||||
dimension([startpoint.x, y, z], [endpoint.x, y, z], text, thickness, text_size, rot_around_dim=(plane=="xz"?90:0));
|
||||
|
||||
|
||||
dimension([startpoint.x, y, z], [endpoint.x, y, z], text, thickness, text_size, rot_around_dim=(plane=="xz"?90:0));
|
||||
|
||||
v1= [startpoint.x, y, z]-startpoint;
|
||||
h1 = norm(v1);
|
||||
axis1 = cross([0,0,1], v1);
|
||||
angle1 = atan2(norm(axis1), v1.z);
|
||||
angle1 = atan2(norm(axis1), v1.z);
|
||||
translate(startpoint)
|
||||
rotate(angle1, axis1)
|
||||
cylinder( h= h1+thickness*2, d=thickness);
|
||||
|
||||
|
||||
|
||||
|
||||
v2= [endpoint.x, y, z]-endpoint;
|
||||
h2 = norm(v2);
|
||||
axis2 = cross([0,0,1], v2);
|
||||
angle2 = atan2(norm(axis2), v2.z);
|
||||
|
||||
|
||||
translate(endpoint)
|
||||
rotate(angle2, axis2)
|
||||
cylinder( h= h2+thickness*2, d=thickness);
|
||||
cylinder( h= h2+thickness*2, d=thickness);
|
||||
}
|
||||
|
||||
|
||||
module dimension_y(startpoint, endpoint, offset = 1, text = "", thickness = 0, text_size = 0 , plane = "xy") { //! Will create a dimension in the y direction. Offset will determine how much space is between the measured point and the dimension. Plane options : xy, yz
|
||||
module dimension_y(startpoint, endpoint, offset = 1, text = "", thickness = 0, text_size = 0 , plane = "xy") { //! Creates a dimension in the y direction. Plane options : xy, yz
|
||||
length = norm(endpoint - startpoint);
|
||||
thickness = (thickness == 0? length/200:thickness);
|
||||
|
||||
@@ -114,30 +121,30 @@ module dimension_y(startpoint, endpoint, offset = 1, text = "", thickness = 0, t
|
||||
x = offset > 0 ? max(startpoint.x, endpoint.x) + (plane=="xy"?offset:0) : min(startpoint.x, endpoint.x) + (plane=="xy"?offset:0);
|
||||
z = offset > 0 ? max(startpoint.z, endpoint.z) + (plane=="yz"?offset:0) : min(startpoint.z, endpoint.z) + (plane=="yz"?offset:0);
|
||||
dimension([x, startpoint.y, z], [x, endpoint.y, z], text, thickness, text_size, rot_around_dim=(plane=="yz"?90:0));
|
||||
|
||||
|
||||
v1= [x, startpoint.y, z]-startpoint;
|
||||
h1 = norm(v1);
|
||||
axis1 = cross([0,0,1], v1);
|
||||
angle1 = atan2(norm(axis1), v1.z);
|
||||
|
||||
|
||||
translate(startpoint)
|
||||
rotate(angle1, axis1)
|
||||
rotate([offset>0?0:180,0,0])
|
||||
cylinder( h= h1+thickness*2, d=thickness);
|
||||
|
||||
|
||||
|
||||
|
||||
v2= [x, endpoint.y, z]-endpoint;
|
||||
h2 = norm(v2);
|
||||
axis2 = cross([0,0,1], v2);
|
||||
angle2 = atan2(norm(axis2), v2.z);
|
||||
|
||||
|
||||
translate(endpoint)
|
||||
rotate(angle2, axis2)
|
||||
rotate([offset>0?0:180,0,0])
|
||||
cylinder( h= h2+thickness*2, d=thickness);
|
||||
cylinder( h= h2+thickness*2, d=thickness);
|
||||
}
|
||||
|
||||
module dimension_z(startpoint, endpoint, offset = 1, text = "", thickness = 0, text_size = 0 , plane = "xz") { //! Will create a dimension in the z direction. Offset will determine how much space is between the measured point and the dimension. Plane options : xz, yz
|
||||
module dimension_z(startpoint, endpoint, offset = 1, text = "", thickness = 0, text_size = 0 , plane = "xz") { //! Creates a dimension in the z direction. Plane options : xz, yz
|
||||
length = norm(endpoint - startpoint);
|
||||
thickness = (thickness == 0? length/200:thickness);
|
||||
|
||||
@@ -145,27 +152,23 @@ module dimension_z(startpoint, endpoint, offset = 1, text = "", thickness = 0, t
|
||||
x = offset > 0 ? max(startpoint.x, endpoint.x) + (plane=="xz"?offset:0) : min(startpoint.x, endpoint.x) + (plane=="xz"?offset:0);
|
||||
y = offset > 0 ? max(startpoint.y, endpoint.y) + (plane=="yz"?offset:0) : min(startpoint.y, endpoint.y) + (plane=="yz"?offset:0);
|
||||
dimension([x, y, startpoint.z], [x, y, endpoint.z], text, thickness, text_size, rot_around_dim=(plane=="xz"?90:0));
|
||||
|
||||
|
||||
v1= [x, y, startpoint.z]-startpoint;
|
||||
h1 = norm(v1);
|
||||
axis1 = cross([0,0,1], v1);
|
||||
angle1 = atan2(norm(axis1), v1.z);
|
||||
|
||||
|
||||
translate(startpoint)
|
||||
rotate(angle1, axis1)
|
||||
cylinder( h= h1+thickness*2, d=thickness);
|
||||
|
||||
|
||||
|
||||
|
||||
v2= [x, y, endpoint.z]-endpoint;
|
||||
h2 = norm(v2);
|
||||
axis2 = cross([0,0,1], v2);
|
||||
angle2 = atan2(norm(axis2), v2.z);
|
||||
|
||||
|
||||
translate(endpoint)
|
||||
rotate(angle2, axis2)
|
||||
cylinder( h= h2+thickness*2, d=thickness);
|
||||
cylinder( h= h2+thickness*2, d=thickness);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -190,4 +190,4 @@ function cubic_real_roots(a, b, c, d) = //! Returns real roots of cubic equation
|
||||
|
||||
function path_length(path, i = 0, length = 0) = //! Calculated the length along a path
|
||||
i >= len(path) - 1 ? length
|
||||
: path_length(path, i + 1, length + norm(path[i + 1] - path[i]));
|
||||
: path_length(path, i + 1, length + norm(path[i + 1] - path[i]));
|
||||
|
@@ -21,7 +21,9 @@
|
||||
//! Default is steel but can be drawn as brass or nylon. A utility for making nut traps included.
|
||||
//!
|
||||
//! If a nut is given a child then it gets placed on its top surface.
|
||||
//! The following diagram shows you the parameters for drawing a sliding_t_nut
|
||||
//!
|
||||
//! The following diagram shows you the parameters for drawing a sliding_t_nut:
|
||||
//!
|
||||
//! 
|
||||
//
|
||||
include <../utils/core/core.scad>
|
||||
|
Reference in New Issue
Block a user