Lar's 'Extrude Along Curve' Method, 2005

Started by Lar, August 31, 2012, 10:23:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Lar

Here's my approach to using the 'Extrude Along Curve' command when using 'Perpendicular' for the extrusion (note: the 'curve' can be a 'curve entity' or a 'line entity'). I've posted these instructions somewhere else on the forum but I can't say where they are so I'm putting them here (this very post originated at this link, but no pic: http://forum.designcad.com/index.php?topic=4578.new#new).

First, if the profile is to be extruded by its center (such as a circular profile) just set 1 handle at the center of profile and carry out the command. It should work as expected. Otherwise use the instructions below:

<<See attached pic>>
1] Draw the curve...
2] Draw the 2D profile (use 'plane' if you want a solid, 'line' if you want a 'grid surface') in the XY plane...
3] Select the profile and set a handle at the location where the profile relates to the curve. Move the profile so that the handle is snapped to point 1 of the curve. Orientate the profile in the way it logically relates to the curve (may need 3 handles for this)...
4] With the profile still selected, shift+click on the curve to also select it. Set 3 handles, at points 1, 2 and 3 of the curve...
5] Duplicate the selection (curve and profile) somewhere off to the side (but so you can see the original and the duplicate) so that handle-1 (the 2nd handle) is along the positive z axis from the handle-0 (make sure 'original scale' is active in the duplicate dialog). The 3rd handle should be placed so that curve is as flat as possible in the xz plane...
6] Select the profile alone and set 3 handles: the first at point-1 of the curve, the 2nd in the positive X direction from the first and the 3rd in the positive Y direction from 2nd (forming a backwards L in the XY plane of the drawing)...
7] With the profile still selected invoke the 'extrude along a curve' command  (make sure 'perpendicular' is selected in the dialog) and click on the original curve...

The results should be as expected...

Lar
ps: if your 'curve' is a real curve entity and 2nd point is off to a side but the curve does a 90 degree bend through it just follow the same directions, making sure the L shaped handles lay in the XY plane, regardless of what angle the duplicated profile ends up at.

prl

Glad you added the graphic.  Do you use this approach for stairs, more specifically the handrail profiles?  Say a 'L' or 'U' stair with typical end extensions.  Draw the top rail with a continuous multi-segment line and extrude along a curve the appropriate profile.

Dr PR

Lar,

Ah so!

You are setting handle 2 on a line perpendicular to the curve and handle 3 above handle 2 in a direction perpendicular to a line from handle 1 to handle 2.

You are doing this by rotating the extrude object and the curve so the curve (at the first point) is parallel to the X axis.

I think a better way would be to create a temporary working plane oriented relative to the curve (View/Working Plane/Set Working Plane). I don't use this feature very often, but this example is exactly what it is useful for. Instead of duplicating the objects, rotating to align with axes, creating the extrusion, and then rotating it back to the original orientation, just rotate the working plane and the extrusion will be created where you wanted it in the first place.

Your example shows a "curve" of nice straight segments. With a real curve having no straight segments it will be a bit more difficult to control the extrusion. You must place the extrude object in a plane perpendicular to the tangent to the curve at the first point of the curve. For irregular curves this is nearly impossible because the tangent to a curve function doesn't work with irregular curves (or it didn't the last time I tried it).

You can fake it, however, and get a pretty accurate result by creating a three-point circle [Draw/Circles/Circle (3 point)] by zooming in close and snapping the three points to the end of the curve and two other points very close to the end. This will create a circle with a huge radius, but you can find the tangent to/from this circle (Draw/Lines/Tangent from a circle), and then a plane perpendicular to the tangent (Draw/Planes/Perpendicular Plane).

If you set the working plane to be the plane perpendicular to the tangent, and place the object to be extruded in this plane, with three handles oriented as you show, the extrusion should work "as expected." However, this puts the curve extending into the Z direction. If this doesn't work, you could orient the working plane along the tangent to the curve so the curve extends along the X axis, and orient the extrusion object perpendicular to the working plane (along the Z axis).

I'll have to play with this and see how it works. It couldn't work worse than some of the seemingly random extrusions I sometimes get!

Note: The extrude object does not have to touch the extrusion curve - it can be some distance away. I think none of the handles has to be on the curve either. The point you select when you select the curve determines the relative orientation and distance from the object's first handle to the curve (however I'm not certain about this). This is an extremely complex function!

Phil
DesignCAD user since 1987

Dr PR

Lar,

One additional comment.

I NEVER use extrude along a curve to create straight segments. The extrude along a curve function creates intermediate "breaks" or segments between points in the curve. With a large number of points in the extruded object, as your example has, these extra segments bloat the drawing size rapidly. I once extruded a circle along the centerline of a hand rail and the resulting solid added 13 Mbytes to the drawing (it was less than a Mbyte before the extrusion). I used DesignCAD's defaults of 120 points for circles and the default "Degree of fitness" of 100, and the railing had hundreds of thousands of facets.

I started over and used "Sweep" or "Extrude along a curve" to make the curved parts of the hand rail, and used simple cylinders for the straight part, and the result was only about 80 Kbytes. I used "circles" with 36 points and a "Degree of fitness" of 3 to 5.

In your example you may have to use "Extrude along a curve" to get the continuous surface around the sharp corners. If so you should use the minimum "Degree of fitness" that gives you the result you seek.

Phil
DesignCAD user since 1987

Lar

Prl, it should work for any application, but here's a few other things to consider:
1] If the radius of the extrusion, say along the curved part of a U shaped curve, is *bigger* that the distance between 2 consecutive points in the curve, then dcad may ignore those points. Ie, the extrusion will result as if those points are not there.

2] If the curve is a line entity with segments that bend sharply from one plane to another the resulting extrusion may not look right, even thought it is correct. Usually these two segments won't fit together properly in the real world. What to do is add a segment that would flow better from one segment to the others.

For example, in an L shaped stair where the rail not only bends at 90 deg. but is also sloping, the rail can't miter properly at the bend. However, if you add 2 straight segment at the bend the extrusion would be more natural (eg: the bottom rail slopes upward along the 1st flight, then at the bend it goes vertical to reach the height of the upper rail, then turns 90 deg. for a not-too-short distance, then slopes upward along the 2nd flight).

Doc, You posted ahead of me so I'll post this then read through your 2 posts and respond.

Lar

prl

Lar,

Can you get your approach to work with the attached curve?  Seems to me it will twist itself out of shape by the time it gets to the top of the 50' curve.  Only thing I can extrude along a curve for something like this is a circle with the handle at the center.  Any other shape will ultimately twist over onto itself as it follows the extrusion path. Think handrail where the profile always needs to be grip-able (vertical).

Dr PR

#6
prl,

I gave it a try using the tangeht perpendicular working plane idea.

In "curve extrude 1" you can see the red circle produced with the three point circle. I used the radius to the end point of the spiral for the X axis and the red vertical line perpendicular for the Y axis of the working plane. The cyan square represents the new working plane.

"Curve extrude 2" shows the outline and handles of the sweep plane. It also shows the ovvset from the spiral curve.

"Curve extrude original orientation" wasn't much better. It did keep the top red surface where it should be, but every 180 degrees it flipped the left/right orientation of the sweep object. I replaced the original polygon with a group of multicolor triangles so any twist during the extrude would be apparent - the group had the same handles as the original outline.

"Curve extrude perpendicular orientation" shows the resulting "Extrude along a curve" solid. As you can see, it didn't work correctly and the sweep rotated.


To be continued ...

Phil
DesignCAD user since 1987

Dr PR

"Curve extrude forward orientation" also didn't achieve the desired results, and neither did "curve extrude left orientation." Backwards and right orientations were about the same.

So it looks like all extrusions rotate the object around the curve. We need a "This End Up" marker for the extrude object.

I did use the same setup, after retoring the normal working plane, to do a "Sweep" using the spiral. "Spiral sweep with offset 1" shows the results, as does "spiral sweep with offset 2." This works as desired.

One interesting thing here is that the Sweep operation used the offset but the extrusion along the curve did not. I set the axis of the sweep to the 0,0,0 point marked by the coordinate indicator at the axis of the spiral. For the extrudes I just clicked on the spiral curve.

Phil
DesignCAD user since 1987

prl

Phil, I should have attached a profile but you and I are thinking along the same (curved) lines.  I've played endlessly with the various "Forward, Reverse, Original . . . ." toggles including setting one to three handles and I'm still stumped by the end result. Obviously a profile can be perpendicular to a line at a point (even a curve I guess), but what controls the profile's 360 degree position around that point is what I can't get straight in my mind.

Dr PR

prl,

I decided to not tempt fate quite as much and repositioned the extrude object so it's center of gravity was positioned on the curve. As you can see the first handle was on the end of the extrusion line and the other two were positioned as per Lar's idea. I still got the same results - the extrusion sweeps around the curve.

Whoever solves this one gets a gold star!

Phil
DesignCAD user since 1987

Lar

Doc, you made a number of points (in your first 2 posts) which my points below should cover (too much work to deal with individually)...

1] My example file actually has a curved example that is not visible in the image. By the time my example was completed I had forgotten about it and it did not end up in the image, that is why I added the 'ps' below my signature in my opening post.

2] I never use curve entities for extrusions since dcad has always favored a high number of facets when using curves/circles/arcs to generate segmented items. I always convert the curve to a line entity first then reduce the number of points if necessary. Because of this I actuall never knew what 'degree of fineness' was all about. Thanks for explaining. Usually my extrusions have to correlate to some other solid so I use vectored curves to make sure the two work together.

3] The important thing about the L shaped handles of the profile is that they lay in the XY plane of the drawing, regardless of what angle the profile is at. The developers intended for the profile to be drawn in the XY plane and the handles set there. However, this only helps if the natural way to draw the profile is the expected orientation of the profile to the curve.

4] The reason I duplicate the curve and profile along the +Z direction (#5 in my opening post) is to avoid having to figure out where the "object XY plane" (in other 3d programs this would be the "local XY plane") for the handles would be relative to where the "object +Z axis" would be for the curve. It is not absolutely necessary to do this duplication and many times I have challenged myself with trying to visualize this plane, only to have to 'undo' the extrusion and repeat the command. If you can visualize this in every circumstance and are able to set the 3 handles, regardless of what angle they would be at, then I envy you.

5] I use Working Planes a lot but I would not for this. I find it much easier to duplicate, using ortho mode to guarantee the first 2 points of the curve point absolutely +Z and the L-handles are in the XY plane.

6] Notice that after the duplication and setting the L-handles for the profile I click on the original curve for the extrusion, not the duplicated curve, so the extrusion ends up in its intended location right off the bat. This in itself should demonstrate the mechanics of this command. It internally rotates the profile based on the L-handles and internally rotates the curve based on the first 2 points... before calculating the intermediate breaks along the curve.

I first encountered this 'internal rotation' concept when I first tried to create a custom hatch, back in the DOS days, so my mind was open to it. When I started using Cinema 4D (around 2004) I found the same vexing extrude-along-curve problem, but only worse (**), so I set about solving it. Examining this was easier in C4D because of it's dynamic functions. The extrusion is mathematical so you can change the point order of the curve or location of the axis point (C4d's handles) or whatever and the extrusion would instantly change, so I was able to figure it out. **In C4D the 3rd point of the curve HAS to turn left of the first two points so sometimes I have to add a segment at the beginning then use a subtraction-boole to mask it.

Lar
ps; I see a lot of posts ahead of this so I'll have to read through them...

prl

Quote from: Dr PR on August 31, 2012, 12:57:50 PM
Whoever solves this one gets a gold star!

Quote[0=original -- the orientation of the original copy is retained for all subsequent copies.
1=Forward -- each copy shifts its orientation so that an arrow from handles 1-2 points along the direction of the curve, and an arrow from points 1-3 points "upward" from the plane of the curve
2=Reverse -- each copy shifts its orientation so that an arrow from handles 1-2 points in the opposite direction of the curve
3=Left -- each copy shifts orientation so that an arrow from handles 1-2 points to the left of the direction of travel along the curve
4=Right -- each copy shifts orientation so that an arrow from handles 1-2 points the right of the direction of travel along the curve
5=Perpendicular -- mimics the behavior of the Perpendicular flag in older versions of DesignCAD]
If this parameter is present, it overrides the Perpendicular parameter (and only applies if AlongCurve is set to 1)


I've studied this often.  Still don't get it.  I offer a second Gold Star.

Dr PR

Lar,

Sorry, I did miss the "original curve" in your post - even though yout picture clearly illustrated this. Duh!

I have also experimented a bit more with setting a new working plane. For both vectors and curves the "Draw/Plane/Perpendicular Plane" function will place a plane at the end of the line/curve, so you don't need all of the 3 point curve geometrical construction I used in my earlier example. For what it is worth!

Phil
DesignCAD user since 1987

Dr PR

Here is an explanation from the Help "Array along a curve" section.

****

Orientation: The alignment of the object to be arrayed. For most of these choices to be used properly, you must correctly place your handles. Imagine the object you are copying is a man. The first handle is the man's feet. The second handle is the direction he is facing. The third handle is his head. His feet always touch the curve. His head is always in the "up" direction relative to the plane of the curve. He can walk forward or backward along the curve, or he can step along the curve sideways while facing to the left or the right of the curve. He can also slide along the curve while always maintaining his original orientation.

Note:  The curve's sense of "up" is calculated once for the entire curve; it is not evaluated separately at each point on the curve, so curves that do not lie in a plane may give unexpected results. Also, it may sometimes go in an unexpected direction. What you expected to be "up" might in fact be "down." Be prepared to change your selection handles accordingly if you get unexpected results.

•   Original: Maintains the orientation of the original object, regardless of which direction the curve twists and turns. For this orientation, only the first selection handle is used; the copied object is never rotated.

•   Forward, Backward: The object along the curve so that it is always "facing" in a forward or backward direction along the curve. Objects rotate as they move along the curve to maintain their forward/backward orientation relative to the curve.

•   Left, Right: Moves each copy along the curve so that it is "facing" to the left or right of the curve's direction of travel.

•   Perpendicular: Treats the handles differently than other options. For this option, the plane created by the selection handles is always rotated to be perpendicular to the curve's direction of travel. This option gives the user very little control over the final orientation of the copy, and is retained for backward compatibility with older versions of DesignCAD.

Array Along a Curve: Curve arrays always start with a fresh copy of the selected object, so the Use Original as the First Copy option is disabled. Set the number of copies to be drawn along the curve in the Columns field and set a point on the curve the array is to be drawn along. The easiest way to set the point on the curve for the array is to use the Gravity command to snap to one of the endpoints of the curve.

****

I tried reorienting the handles with number 2 in the direction of the curve, as I think the instructions say it should be, and the third upward from the second. No joy. All extrusion orientations still come out screwed up.

I agree with prl, this is a two star problem.

Phil
DesignCAD user since 1987

prl

Quote from: Dr PR on August 31, 2012, 01:34:27 PM
Note:  The curve's sense of "up" is calculated once for the entire curve; it is not evaluated separately at each point on the curve, so curves that do not lie in a plane may give unexpected results.

Thanks Phil.  The array command and extrude-along-a-curve seem to share the same code/parameters.  If I read the above correctly, we are unlikely to solve this problem of controlling the rotation of the profile about a point along the curve.  The program only computes an "up" vector once.  No wonder things are twisting.