mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-11 00:04:07 +02:00
Merge pull request #1726 from adrianVmariano/master
actually add parts section to tutorial
This commit is contained in:
@@ -558,10 +558,10 @@ module tetrahedron(base, height, spin=0, anchor=FWD+LEFT+BOT, orient=UP)
|
|||||||
tetrahedron(20,18) show_anchors();
|
tetrahedron(20,18) show_anchors();
|
||||||
```
|
```
|
||||||
|
|
||||||
For this module we have used VNF anchors, but this tetrahedron is half
|
For this module we have used VNF anchors, but this tetrahedron is the
|
||||||
related to a cuboid, so maybe sometimes you prefer to use anchors
|
corner of a cuboid, so maybe sometimes you prefer to use anchors
|
||||||
based on the bounding box. You could create a module with bounding
|
based on the corresponding cuboid (its bounding box). You can create a module with bounding
|
||||||
box anchors like this, where we have had to explicitly center the VNF
|
box anchors like this, where we have explicitly centered the VNF
|
||||||
to make it work with the prismoid type anchoring:
|
to make it work with the prismoid type anchoring:
|
||||||
|
|
||||||
```openscad-3D
|
```openscad-3D
|
||||||
@@ -625,8 +625,8 @@ an attachable part called "inside" that lets you attach to the inside
|
|||||||
of the tube.
|
of the tube.
|
||||||
|
|
||||||
Below we create an example where an object is made from two
|
Below we create an example where an object is made from two
|
||||||
cylindrical parts, and we want to be able to attach to either one.
|
cylindrical parts, and we want to be able to attach to either
|
||||||
In order to create attchable parts you must pass a list of the parts
|
one. In order to create attchable parts you must pass a list of the parts
|
||||||
to `attachable()`. You create a part using the `define_part()`
|
to `attachable()`. You create a part using the `define_part()`
|
||||||
function which requires the part's name and its geometry. You can
|
function which requires the part's name and its geometry. You can
|
||||||
optionally provide a transformation using the `T=` parameter and give
|
optionally provide a transformation using the `T=` parameter and give
|
||||||
@@ -666,7 +666,7 @@ the cylinder is located relative to the part's overall geometry.
|
|||||||
If you create an "inside" part for a tube, the inside object will
|
If you create an "inside" part for a tube, the inside object will
|
||||||
naturally have its anchors on the inner cylinder **pointing
|
naturally have its anchors on the inner cylinder **pointing
|
||||||
outward**. You can anchor on the inside by setting `inside=true` when
|
outward**. You can anchor on the inside by setting `inside=true` when
|
||||||
invoking `attach()` or `align()`, but another option set `inside=true`
|
invoking `attach()` or `align()`, but another option is to set `inside=true`
|
||||||
when creating the part with `define_part()`. This cause `align()` and
|
with `define_part()`. This marks the geometry as an inside geometry, which cause `align()` and
|
||||||
`attach()` to invert the meaning of the `inside` parameter so that
|
`attach()` to invert the meaning of the `inside` parameter so that
|
||||||
objects will attach on the inside by default.
|
objects will attach on the inside by default.
|
||||||
|
50
tutorials/Attachment-Parts.md
Normal file
50
tutorials/Attachment-Parts.md
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# Attachment Parts
|
||||||
|
|
||||||
|
Some objects provide named attachable parts that you can select
|
||||||
|
instead of using the main geometry for the object. One important kind
|
||||||
|
of attachable part is the inside of a tube.
|
||||||
|
|
||||||
|
Here is a tube with its anchors shown:
|
||||||
|
|
||||||
|
```openscad-3D
|
||||||
|
include<BOSL2/std.scad>
|
||||||
|
tube(id=20,h=15,wall=3)
|
||||||
|
show_anchors();
|
||||||
|
```
|
||||||
|
|
||||||
|
The anchors are all on the outside wall of the tube and give you no
|
||||||
|
method for placing a child **inside** the tube. In order to attach
|
||||||
|
inside the tube, we select the "inside" part using the `attach_part()`
|
||||||
|
module.
|
||||||
|
|
||||||
|
|
||||||
|
```openscad-3D
|
||||||
|
include<BOSL2/std.scad>
|
||||||
|
tube(id=20,h=15,wall=3)
|
||||||
|
attach_part("inside")
|
||||||
|
align(BACK,TOP)
|
||||||
|
color("lightblue") cuboid(4);
|
||||||
|
```
|
||||||
|
|
||||||
|
Now when we align the cube to the BACK wall of the tube it appears on
|
||||||
|
the inside of the tube. If you need to attach to both the inside and
|
||||||
|
outside you can place some attachments using `attach_part()` and some
|
||||||
|
with the standard attachment geometry on the outside like this:
|
||||||
|
|
||||||
|
```openscad-3D
|
||||||
|
include<BOSL2/std.scad>
|
||||||
|
diff()
|
||||||
|
tube(id=20,h=15,wall=3){
|
||||||
|
attach([1,-1/2],BOT)
|
||||||
|
color("green")cyl(d=4,h=3,$fn=12);
|
||||||
|
attach_part("inside"){
|
||||||
|
attach(LEFT,BOT,align=TOP)
|
||||||
|
color("lightblue")cuboid(4);
|
||||||
|
attach(BACK,CTR,align=TOP,inside=true, inset=-0.1)
|
||||||
|
cuboid(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user