# Trying to build an extruded Path2 with Ribbon

Hello,

I have a 2d profile of a sheet metal flange shape.

I tried building it with Path2 but don’t know how to visualize it (I pulled points from AutoCAD).

I generated two copies of the getPoints with each having a different z value and that lets me build a ribbon but many of the arcs are going in the wrong direction.

This is the shape I’m trying to draw. In the end I’ll want this to also have thickness.

1 Like

In the end, this is my goal. I need to build this programmatically.

The first two parameters for `addArcTo` determine the direction the arc is drawn, if moving in y direction swap sign of midx otherwise swap sign of midy to change direction of arc.

Also looking at your goal image the path that follows the end edge is in 3D so cannot be drawn with path2

2 Likes

Oops! Just realised you can use path2d as you draw the path in an XY plane but move your start and end points along the z axis when you are by the indents.

You should be able to use methods from Draw a Line With a Set Width | Babylon.js Documentation to add thickness.

2 Likes

Thank you very much.

It looks like I’m not understanding this. I’m not able to use these replies to get the results I’m looking for.

As for the line with thickness, I will need to get the path figured out before trying that

My apologies having looked closely at path2 it does not behave as I would expect. I also cannot figure out a sensible way to get arcs drawn in the direction that I need. I will look at how to draw a path with arcs as needed later in the week.

1 Like

@ajw1970 After experimenting for a few days it looks like it is more difficult than I imagined. If the two lines are perpendicular or parallel it is fairly straight forward to join them with an arc of a circle. In other cases to form a curve between two lines that starts and ends tangential to each line requires a Bezier or Camull-Rom curve. The shape the curve takes depends on one or two variables that while can be set automatically the choices might not be good ones. Without a visible drawing system such as a CAD one it it difficult to determine the values you might need.

Whilst you may be able to export data from a CAD system unless you have the algorithm to correctly read and apply the data you will not be able to draw the shape.

Apologies for promising more than I can deliver in the timescale I suggested.

You might want to look at

Thank you for digging into that John. I’ll look at importing it from Inventor and working with it that say instead.

Do you have any experience with building models using something like JSCAD?

This was what I expected to see with Path2 methods:

I can certainly make things look right by exporting from Inventor but I’m looking at longer term options.

Thanks again.

I have now managed to set up a function to draw an arc through three points. I have submitted a PR that adds this feature to Curve3 but as a new feature it may have to wait until v5.00 is sorted.

Maybe too late for you but hope it could still help.

2 Likes

Thank you John, that will be quite helpful I’m sure.

In the meantime, I’m trying to do this with an array of points but can’t get the end caps to work.

Is there a way to fix that?

The way caps are constructed they only work with convex shapes. You could use

You must draw your polygon shape in XZ plane and can only extrude vertically. You would need to rotate to the orientation you need.

1 Like

Sweet! Thank you!

1 Like