Replies: 3 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
You can hack replicad code to send multiple objects to the same STEP writer. But when I tried that Cura loaded only the first shape in the generated file. Do you know if STEP actually supports multiple shapes at all? |
Beta Was this translation helpful? Give feedback.
-
I was researching the answer to the original question further but became confused. In the documentation of OpenCascade I found the following relationship between shape types. For each type of shape the third column shows what extruding this shape yield. For example, extruding an edge should yield a face, extruding a face should yield a solid.
In Replicad it seems to be different. I tried to create several types of shapes, each time writing the result to the javascript console with the command
The following code shows some examples of what I described above. The commented lines resulted in an error. There are very strange errors, such as that extruding a line fails because the line is non planar? const { draw,
drawCircle, makeOffset, makeCircle,
makeNonPlanarFace,assembleWire, makeFace,
drawRectangle, makePolygon} = replicad;
const main = () => {
let line = draw().hLine(100).close().sketchOnPlane("XY")
// not really a line but a closed edge due to .close()
// when line is ended using .done() it cannot be extruded
let face = line.extrude(40,{extrusionDirection: [0,0,1]})
console.log(face) // reported as solid
//let solid = face.extrude(20,{extrusionDirection: [0,1,0]})
let edges = face.edges
console.log(edges) // reported as array with 6 items
let wire = assembleWire(edges)
console.log(wire) // reported as wire
// let block = wire.extrude(20)
let rectangle=drawRectangle(100,40)
console.log(rectangle) // reported as innerShape
let rectangleEdge = rectangle.sketchOnPlane("XY")
console.log(rectangleEdge) // reported as wire
let block = rectangleEdge.extrude(40)
console.log(block) // reported as solid
let edgeDraw = draw().hLine(100).vLine(40).hLine(-100).close()
console.log(edgeDraw) // innerShape
let edgeLine = edgeDraw.translate([0,20]).sketchOnPlane("XY")
console.log(edgeLine) // wire, but is visible as a face ???
//let edgeOffset = makeOffset(edgeLine,5)
let edgeSolid = edgeLine.clone().extrude(20)
console.log(edgeSolid) // solid, extruding a wire should yield a shell ???
let bigSolid = makeOffset(edgeSolid,5)
let smallSolid = makeOffset(bigSolid,-4.99)
console.log(bigSolid)
console.log(smallSolid)
let circleWire = makeCircle(10)
console.log(circleWire) // Edge, cannot be extruded ???
let circleWire2 = makeCircle(40).translate([0,0,50])
//let circle = makeFace(circleWire) // cannot be turned into face
let bulge = makeNonPlanarFace(circleWire)
console.log(bulge)
// let cylinder = circleWire.extrude(40)
let definedFace = makePolygon([[0,0,0],[100,0,0],[100,40,0],[0,40,0]])
console.log(definedFace) // face
let offsetFromFace = makeOffset(definedFace,10)
console.log(offsetFromFace) // shell !
return [
{shape: block},
{shape: edgeDraw}, // drawing = innershape
{shape: edgeLine}, // drawing on plane = wire
//{shape: edgeFace},
{shape: edgeSolid}, // extruded drawing = extruded wire = solid ?
{shape: bigSolid}, // offset of solid is solid
{shape: circleWire}, // edge
{shape: bulge}, // face
{shape: definedFace}, // face
{shape: offsetFromFace} //shell
]
} |
Beta Was this translation helpful? Give feedback.
-
Is there a type signature for what main can return when used with the visualizer?
It seems to be able to return either a
Shape
or an array of{shape:Shape, name:string, color:string}
objects?And while I'm at it, any chance to enhance the STEP export functionality so multiple objects (shapes) can be placed into a single step file?
Beta Was this translation helpful? Give feedback.
All reactions