Simulated SWEEP command

Hi all,

Attach a routine that simulates the SWEEP command (why didn't this go on the Wishlist??). Many thanks to Lee Mack & Highflybird in getting it to this point. Note the functionality is what I intended, but my approach is rather convoluted, and I'm sure it could be better optimised.

It works differently to the official SWEEP in that it doesn't matter what the alignment the profile is in, it still works the same. It's also been written to work with multiple, rather than single paths. Attach a screengrab of it in action.

It works by finding source and destination vectors for the profile to be aligned. At the source it uses a basepoint provided by the user, and the Normal of the profile to generate 3 vectors (via normalvectors). At the destination it uses the first two points along the selected path, to again generate 3 vectors. This is then fed into Align3D to do the alignment.

I think what I should actually be doing is using the basepoint and profile normal at the source, and at the destination use the path start point and a vector representing the tangent direction of the path (I assume that I may be able to get this by using vlax-curve-getFirstDeriv or some other vlax-curve function?). This would provide a more direct way to transform the profile into position, and allow alignment to any path (my function doesn't currently work correctly on ARCs).

I didn't look at providing SWEEPs default option which uses the centroid of the profile instead of a basepoint, that's a whole other mathematical adventure. One approach to this may be to convert the profile to a region first, then hopefully extract its centroid from its properties.

I also think that you could use a modified form to align a profile to a face similar to Lees C:MAP
http://www.theswamp.org/index.php?topic=42767.0. Except Source would use Centroid + Normal, Destination would use Dynamic UCS + selected point.

Would be happy to here from anyone that can give some pointers to improve.

Regards,

Jason Bourhill

CAD Concepts



Comments

  • Hi Jason,

    Just convert Arc into a polyline before sweeping. It works with your code.
    Also sweep command is available from X-Solids toolbar in Platinum.

    Regards, Vaidas
  • Hi Vaidas,

    I've taken a look at XSWEEP, and its not the same command as SWEEP. The key thing it is missing is alignment of the profile to the end of the path. See description of alignment in AutoCAD Help:

    "If the profile is not perpendicular (normal) to the tangent of the start point of the path, then the profile automatically aligns. Enter No at the alignment prompt to prevent this. "

    If XSWEEP does in fact have this feature how would you call it from LISP? I originally started on this as I was asked to convert and existing AutoCAD LISP routine to BricsCAD. The routine was calling the SWEEP command. The routine made use of the alignment feature, which I was previously unaware of.

    The routine I posted will work on an ARC directly, no need to convert to poly. However the profile alignment is wrong, it is orientated towards the end point of the arc, it should be aligned to the tangency. That's what I meant in the statement in the previous post. And now that I actually look at the description for the command. that is exactly what it states it does. I guess I should of read the instructions first, before rushing off and trying to write code :).

    Regards,

    Jason Bourhill

    CAD Concepts


  • OK, I understood the problem. What about alignment plus revolve command in this case?
    Sorry, just sharing raw ideas only, because I'm so busy at the moment...
  • Hi Vaidas,

    Thanks for your input. The routine has the functionality I require at the moment. I actually only needed to be able to sweep to a LINE.  I just put it out there, as it may be useful. If I get the time, and get to grips with the maths required I'll update. However it's there if anyone else wants to play, and it works for most cases.

    Regards,

    Jason Bourhill

    CAD Concepts


  • Managed to get the sweep function to use the tangency direction on the selected path. It will now sweep any path that the EXTRUDE command will accept. ARCs, ELLIPSEs, CIRCLES and the like.

    Found this post on VLAX Curves functions very useful.

    Regards,

    Jason Bourhill

    CAD Concepts


    MySweep-2012-10-23.zip

    imageMySweep-Bcad.png
This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!