Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions content/pages/docs/kcl-lang/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ sketch001 = sketch(on = XZ) {
}
region001 = region(segments = [sketch001.line1, sketch001.line2])
extrude001 = extrude(region001, length = 5, tagEnd = $capEnd001)
fillet001 = fillet(extrude001, tags = getCommonEdge(faces = [region001.tags.line4, capEnd001]), radius = 1)
fillet001 = fillet(
extrude001,
edges = [{ sideFaces = [region001.tags.line4, capEnd001] }],
radius = 1,
)
```


Expand All @@ -90,8 +94,8 @@ When a function requires declaring a new tag (using the `$` syntax), the argumen
A tag created using a tag declarator can be used by writing its name without the `$`, e.g., `myTag`.
Where necessary to disambiguate from tag declarations, we call these tag identifiers.

In the example above we use the tag identifier `capEnd001` to get the edge in common
using `getCommonEdge(capEnd001)`.
In the example above we use the tag identifier `capEnd001` in an edge reference object
to select the edge shared by `region001.tags.line4` and `capEnd001`.


Tags can identify an edge or face of a solid. Functions that take a tag identifier as an argument will use either [`TaggedEdge`](/docs/kcl-std/types/std-types-TaggedEdge) (for the edge of a solid) or [`TaggedFace`](/docs/kcl-std/types/std-types-TaggedFace).
Expand Down
12 changes: 8 additions & 4 deletions content/pages/docs/kcl-samples/axial-fan/motor.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ motorBody = extrude(
)
|> appearance(color = "#021b55")
|> fillet(
tags = [
getCommonEdge(faces = [region001.tags.circle1, capStart001]),
getCommonEdge(faces = [region001.tags.circle1, capEnd001])
],
radius = 2,
edges = [
{
sideFaces = [region001.tags.circle1, capStart001]
},
{
sideFaces = [region001.tags.circle1, capEnd001]
}
],
)
sketch002 = sketch(on = offsetPlane(XY, offset = 21)) {
circle1 = circle(start = [var 1mm, var 0mm], center = [var 0mm, var 0mm])
Expand Down
28 changes: 25 additions & 3 deletions content/pages/docs/kcl-samples/bench-for-kids/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ legExtrudedBody = extrude(legRegion, length = legHeight, tagStart = $legCapStart

// Round the foot: use a slightly smaller radius to avoid fillet errors.
legFilletRadius = legRadius * 0.9
legBody = fillet(legExtrudedBody, tags = getCommonEdge(faces = [legRegion.tags.circle1, legCapStart]), radius = legFilletRadius)
legBody = fillet(
legExtrudedBody,
radius = legFilletRadius,
edges = [
{
sideFaces = [legRegion.tags.circle1, legCapStart]
}
],
)
hide(legSketch)

// Position and array the legs.
Expand Down Expand Up @@ -99,7 +107,14 @@ earProfile = sketch(on = earPlane) {
earRegion = region(segments = [earProfile.circle1])
hide(earProfile)
earBody = extrude(earRegion, length = earHeight, tagEnd = $earCapEnd)
|> fillet(tags = getCommonEdge(faces = [earRegion.tags.circle1, earCapEnd]), radius = earFilletRadius)
|> fillet(
radius = earFilletRadius,
edges = [
{
sideFaces = [earRegion.tags.circle1, earCapEnd]
}
],
)
|> translate(x = 0, y = -earOffsetForward, z = earElevation)
|> rotate(
roll = 0,
Expand Down Expand Up @@ -133,7 +148,14 @@ tailProfile = sketch(on = tailPlane) {
tailRegion = region(segments = [tailProfile.circle1])
hide(tailProfile)
tailBody = extrude(tailRegion, length = -tailLength, tagStart = $tailCapStart)
|> fillet(tags = getCommonEdge(faces = [tailRegion.tags.circle1, tailCapStart]), radius = tailFilletRadius)
|> fillet(
radius = tailFilletRadius,
edges = [
{
sideFaces = [tailRegion.tags.circle1, tailCapStart]
}
],
)
|> rotate(roll = -10, pitch = 0, yaw = 0)
|> translate(
x = 0,
Expand Down
58 changes: 43 additions & 15 deletions content/pages/docs/kcl-samples/bracket-with-slot/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Sketch-solve reconstruction with matching feature order
// Categories: Mechanical Components; Parametric

@settings(defaultLengthUnit = mm)
@settings(defaultLengthUnit = mm, kclVersion = 2.0)

// model parameters
halfBracketWidth = 20
Expand Down Expand Up @@ -73,31 +73,59 @@ bracketBodySolid = extrude(
// Step 3: Add fillets
insideBendFillet = fillet(
bracketBodySolid,
tags = getCommonEdge(faces = [
outlineRegion.tags.line5,
outlineRegion.tags.line4
]),
radius = insideBendRadius,
edges = [
{
sideFaces = [
outlineRegion.tags.line4,
outlineRegion.tags.line3
]
}
],
)

outsideBendFillet = fillet(
insideBendFillet,
tags = getCommonEdge(faces = [
outlineRegion.tags.line1,
outlineRegion.tags.line2
]),
radius = insideBendRadius + sheetMetalThickness,
edges = [
{
sideFaces = [
outlineRegion.tags.line1,
outlineRegion.tags.line6
]
}
],
)

freeEndCornerFillets = fillet(
outsideBendFillet,
tags = [
edgeId(outsideBendFillet, closestTo = [2mm, 20mm, 70mm]),
edgeId(outsideBendFillet, closestTo = [2mm, -20mm, 70mm]),
edgeId(outsideBendFillet, closestTo = [170mm, 20mm, 2mm]),
edgeId(outsideBendFillet, closestTo = [170mm, -20mm, 2mm])
],
radius = halfBracketWidth,
edges = [
{
sideFaces = [
outlineRegion.tags.line2,
outsideBendFillet.faces.capStart
]
},
{
sideFaces = [
outlineRegion.tags.line2,
outsideBendFillet.faces.capEnd
]
},
{
sideFaces = [
outlineRegion.tags.line5,
outsideBendFillet.faces.capStart
]
},
{
sideFaces = [
outlineRegion.tags.line5,
outsideBendFillet.faces.capEnd
]
}
],
)

// Step 4: Countersunk tab hole via subtractive feature
Expand Down
74 changes: 45 additions & 29 deletions content/pages/docs/kcl-samples/bracket/main.kcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Categories: Architecture & Construction; Mechanical Components; Parametric

// Set units and enable experimental sketch constraints.
@settings(defaultLengthUnit = in, kclVersion = 1.0)
@settings(defaultLengthUnit = in, kclVersion = 2.0)

// Define structural design inputs.
allowableStress = 35000 // psi
Expand Down Expand Up @@ -121,51 +121,67 @@ bracketBlank = extrude(
// Apply the inside bend radius at the elbow of the bracket.
bracketWithInsideFillet = fillet(
bracketBlank,
tags = getCommonEdge(faces = [
bracketProfileRegion.tags.line6,
bracketProfileRegion.tags.line5
]),
radius = insideBendRadius,
edges = [
{
sideFaces = [
bracketProfileRegion.tags.line5,
bracketProfileRegion.tags.line4
]
}
],
)

// Apply the outside bend radius around the outer corner.
bracketWithBendFillets = fillet(
bracketWithInsideFillet,
tags = getCommonEdge(faces = [
bracketProfileRegion.tags.line3,
bracketProfileRegion.tags.line1
]),
radius = outsideBendRadius,
edges = [
{
sideFaces = [
bracketProfileRegion.tags.line2,
bracketProfileRegion.tags.line1
]
}
],
)

// Round the four free outside corners of the extruded bracket.
bracketWithCornerFillets = fillet(
bracketWithBendFillets,
tags = [
getCommonEdge(faces = [
bracketProfileRegion.tags.line2,
bracketEndFace
]),
getCommonEdge(faces = [
bracketProfileRegion.tags.line4,
bracketEndFace
]),
getCommonEdge(faces = [
bracketProfileRegion.tags.line4,
bracketStartFace
]),
getCommonEdge(faces = [
bracketProfileRegion.tags.line2,
bracketStartFace
])
],
radius = cornerFilletRadius,
edges = [
{
sideFaces = [
bracketProfileRegion.tags.line6,
bracketEndFace
]
},
{
sideFaces = [
bracketProfileRegion.tags.line3,
bracketEndFace
]
},
{
sideFaces = [
bracketProfileRegion.tags.line3,
bracketStartFace
]
},
{
sideFaces = [
bracketProfileRegion.tags.line6,
bracketStartFace
]
}
],
)

// Drill the shelf-side mounting holes into the horizontal leg.
bracketWithShelfMountHoles = hole::holes(
bracketWithCornerFillets,
face = bracketProfileRegion.tags.line5,
face = bracketProfileRegion.tags.line4,
cutsAt = shelfMountHoleCenters,
holeBottom = hole::flat(),
holeBody = hole::blind(depth = shelfMountHoleDepth, diameter = shelfMountHoleDiameter),
Expand All @@ -175,7 +191,7 @@ bracketWithShelfMountHoles = hole::holes(
// Drill the wall-side mounting holes into the vertical leg.
finalBracket = hole::holes(
bracketWithShelfMountHoles,
face = bracketProfileRegion.tags.line6,
face = bracketProfileRegion.tags.line5,
cutsAt = wallMountHoleCenters,
holeBottom = hole::flat(),
holeBody = hole::blind(depth = wallMountHoleDepth, diameter = wallMountHoleDiameter),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ region001 = region(segments = [retainerPlateProfile.circle1])
retainerPlateExtrude = extrude(region001, length = retainerPlateLength, tagStart = $capStart001)
|> chamfer(
length = retainerPlateChamfer,
tags = [
getCommonEdge(faces = [region001.tags.circle1, capStart001])
edges = [
{
sideFaces = [region001.tags.circle1, capStart001]
}
],
)

Expand Down Expand Up @@ -64,8 +66,10 @@ region003 = region(segments = [lowerMountProfile.circle1])
lowerMountExtrude = extrude(region003, length = lowerMountLength, tagEnd = $capEnd001)
|> chamfer(
length = lowerMountChamfer,
tags = [
getCommonEdge(faces = [region003.tags.circle1, capEnd001])
edges = [
{
sideFaces = [region003.tags.circle1, capEnd001]
}
],
)

Expand Down Expand Up @@ -93,14 +97,18 @@ eyeEndExtrude = extrude(
)
|> fillet(
radius = eyeEndTipFillet,
tags = [
getCommonEdge(faces = [region004.tags.circle1, capEnd002])
edges = [
{
sideFaces = [region004.tags.circle1, capEnd002]
}
],
)
|> fillet(
radius = eyeEndRootFillet,
tags = [
getCommonEdge(faces = [region004.tags.circle1, capStart002])
edges = [
{
sideFaces = [region004.tags.circle1, capStart002]
}
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ region010 = region(segments = [upperStopperProfile.circle1])
upperStopperExtrude = extrude(region010, length = -upperPistonRodStopLength, tagStart = $upperCapStart001)
|> chamfer(
length = 6mm,
tags = [
getCommonEdge(faces = [
region010.tags.circle1,
upperCapStart001
])
edges = [
{
sideFaces = [
region010.tags.circle1,
upperCapStart001
]
}
],
)

Expand Down Expand Up @@ -71,8 +73,10 @@ region012 = region(segments = [upperMountPlateProfile.circle1])
upperMountPlateExtrude = extrude(region012, length = upperMountPlateThickness, tagEnd = $upperCapEnd002)
|> chamfer(
length = 19mm,
tags = [
getCommonEdge(faces = [region012.tags.circle1, upperCapEnd002])
edges = [
{
sideFaces = [region012.tags.circle1, upperCapEnd002]
}
],
)

Expand All @@ -95,8 +99,10 @@ region013 = region(segments = [upperEyeEndProfile.circle1])
upperEyeEndExtrude = extrude(region013, length = eyeEndMountLength, tagEnd = $upperCapEnd003)
|> fillet(
radius = eyeEndTipFillet,
tags = [
getCommonEdge(faces = [region013.tags.circle1, upperCapEnd003])
edges = [
{
sideFaces = [region013.tags.circle1, upperCapEnd003]
}
],
)

Expand Down
Loading
Loading