Attach a routine that simulates the SWEEP command (why didn't this go on the Wishlist
??). Many thanks to Lee Mack
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:MAPhttp://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.