kcl →
translate
Move a solid.
translate(
solidSet: SolidOrImportedGeometry,
translate: [number],
global?: bool,
): SolidOrImportedGeometry
Arguments
Name | Type | Description | Required |
---|---|---|---|
solidSet | SolidOrImportedGeometry | The solid or set of solids to move. | Yes |
translate | [number] | The amount to move the solid in all three axes. | Yes |
global | bool | If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. | No |
Returns
SolidOrImportedGeometry
- Data for a solid or an imported geometry.
Examples
// Move a pipe.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
|> startProfileAt([0.05, 0.05], %)
|> line(end = [0, 7])
|> tangentialArc({ offset = 90, radius = 5 }, %)
|> line(end = [-3, 0])
|> tangentialArc({ offset = -90, radius = 5 }, %)
|> line(end = [0, 7])
// Create a hole for the pipe.
pipeHole = startSketchOn('XY')
|> circle(center = [0, 0], radius = 1.5)
sweepSketch = startSketchOn('XY')
|> circle(center = [0, 0], radius = 2)
|> hole(pipeHole, %)
|> sweep(path = sweepPath)
|> translate(translate = [1.0, 1.0, 2.5])
// Move an imported model.
import "tests/inputs/cube.sldprt" as cube
cube
|> translate(translate = [1.0, 1.0, 2.5])
// Sweep two sketches along the same path.
sketch001 = startSketchOn('XY')
rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|> angledLine([0, 73.47], %, $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001) - 90,
50.61
], %)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
sketch002 = startSketchOn('YZ')
sweepPath = startProfileAt([0, 0], sketch002)
|> yLine(length = 231.81)
|> tangentialArc({ radius = 80, offset = -90 }, %)
|> xLine(length = 384.93)
parts = sweep([rectangleSketch, circleSketch], path = sweepPath)
// Move the sweeps.
translate(parts, translate = [1.0, 1.0, 2.5])