You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The .sweepSketch method in Replicad can be used to sweep a cross section along a path. The example below shows two ways how the method can be applied.
The wavy inner part is created by sweeping a rectangle along an open (i.e. non-closed) bezier curve. Note that it is necessary to define the cross section in such a way that the plane and origin where the cross section should be placed can be derived from the path. The command is:
The outer part of the shape is created by sweeping a rather complicated cross section, created by a sketch, along a rounded rectangle. To make this work the sketch of the cross section has to be defined as a function with parameters plane and origin. The shape is then created using the call:
The complete code for the example is shown below the image.
constmain=({ Sketcher, sketchRectangle, sketchRoundedRectangle },{})=>{letp0=[0,0];letp1=[50,100];letp2=[60,-110];letp3=[70,50];letp4=[100,25];letpoints=[p1,p2,p3,p4];// create wavy pathletbasePath=newSketcher("XZ").movePointerTo(p0).bezierCurveTo(p4,points).done()// sweep a rectangle along the wavy pathletbaseShape=basePath.sweepSketch((plane,origin)=>sketchRectangle(2,30,{ plane, origin }));// create a path consisting of rounded rectanglelettopPath=sketchRoundedRectangle(110,30,5,{plane:"XY",origin:[50,0,26]})// create an L-shaped cross sectionfunctiontopSection(plane,origin){letsection=newSketcher(plane,origin).hLine(10).vLine(-5).hLine(-8).vLine(-26).hLine(-2).close()returnsection}// sweep the L-shaped cross section along the rounded rectanglelettopSweep=topPath.sweepSketch((plane,origin)=>topSection(plane,origin));// fuse the two shapes together to display themreturnbaseShape.fuse(topSweep)};
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The
.sweepSketch
method in Replicad can be used to sweep a cross section along a path. The example below shows two ways how the method can be applied.The wavy inner part is created by sweeping a rectangle along an open (i.e. non-closed) bezier curve. Note that it is necessary to define the cross section in such a way that the plane and origin where the cross section should be placed can be derived from the path. The command is:
The outer part of the shape is created by sweeping a rather complicated cross section, created by a sketch, along a rounded rectangle. To make this work the sketch of the cross section has to be defined as a function with parameters
plane
andorigin
. The shape is then created using the call:The complete code for the example is shown below the image.
Beta Was this translation helpful? Give feedback.
All reactions