Author Topic: New Plugin - 2 Rail Sweep  (Read 13739 times)

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5263
  • Made in England
    • View Profile
New Plugin - 2 Rail Sweep
« on: December 25, 2021, 11:17:30 am »
Merry Christmas !

A "2 rail sweep" is a common function in 3D graphics software.
Two 'rails' are selected and then a 'cross section', the plugin will create a surface between the rails using the cross section as a profile shape. It will scale the cross section according to the distance between rails.

1. following installation of the plugin it will appear in the Plugins menu as "Sweep2"
2. run the plugin, it will ask to select 2 rails.
use the normal method of selecting two objects, i.e. select one then while pressing Ctrl select the other, now press Enter.
3. it will ask to select a cross section object, select one then press Enter
4. the surface will be created.

Tips for use.
1. the rails must have their start points at the same end otherwise the surface will be twisted.
2. it's best to draw the rails and profile lines starting at the left hand end.
3. if things are not as you wish, Ctrl + Z will undo the operation.
4. if the surface is black use, Edit->Surface->Invert faces
5. if the surface is concave rather than convex,  rotate it 180 degrees.

A sample cb file is attached.

Objects selected can be, polyline, spline, circle, arc, rectangle
the plugin will convert them to polylines internally.

Edit: 27 Dec. 2021

Version 2 attached
1. added an options form, when the "Save" button is pressed all parameters are saved to Windows' Registry for subsequent operations.
2. it will appear in the Plugins menu as "Sweep2 Options"

The options are;

"Rail Resolution" : this is the number of surface facets along the rails, higher value gives smoother surface but keep it as low as possible. (default is 100)
"Cross Section Resolution":  this is the number of surface facets along the cross section, higher value gives smoother surface but keep it as low as possible. (default is 100)
"Height" : the height of the cross section and hence the surface at any point.
"Scaled" : the height is scaled according to the distance between rails at that point.
"As Cross Section" : the height will remain constant throughout at the actual height of the cross section object.

Edit:
version 3 attached.
1. A value can now be entered for the height of the surface.
« Last Edit: December 30, 2021, 09:42:01 am by EddyCurrent »
Filmed in Supermarionation

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3355
    • View Profile
Re: New Plugin - 2 Rail Sweep
« Reply #1 on: December 25, 2021, 14:21:15 pm »
Wow, nice Christmas present from Eddy to Cambam group. As always, Thank you Eddy, and Merry Christmas and Happy New Year to ALL.
My 2ยข

Win11, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, 4th Axis, Endurance Laser.

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8971
    • View Profile
Re: New Plugin - 2 Rail Sweep
« Reply #2 on: December 25, 2021, 14:39:19 pm »
Yes, Eddy!  Thank you for that.  I have uses for it, already!

Lloyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7410
    • View Profile
    • Cambam V1.0 French Doc
Re: New Plugin - 2 Rail Sweep
« Reply #3 on: December 25, 2021, 14:41:31 pm »
Hello

thanks eddy for this new interesting plugin ;)

++
David

Offline Bob La Londe

  • CNC Jedi
  • *****
  • Posts: 4484
  • ^ 8.5 pounds on my own hand poured bait.
    • View Profile
    • CNC Molds N Stuff
Re: New Plugin - 2 Rail Sweep
« Reply #4 on: December 25, 2021, 15:22:52 pm »
Wow.  Very slick.
Getting started on CNC?  In or passing through my area?
If I have the time I'll be glad to show you a little in my shop. 

Some Stuff I Make with CamBam
http://www.CNCMOLDS.com

Offline Dragonfly

  • CNC Jedi
  • *****
  • Posts: 2652
    • View Profile
Re: New Plugin - 2 Rail Sweep
« Reply #5 on: December 26, 2021, 13:41:45 pm »
I've seen this technique in two brand named commercial packages. But because they use underlying grayscale bitmap for the 3D relief they do not produce a stand-alone 3D object like this plugin.
Great work, Eddy!
I'll give it a try.

Offline pixelmaker

  • CNC Jedi
  • *****
  • Posts: 1967
    • View Profile
    • pixelmaker
Re: New Plugin - 2 Rail Sweep
« Reply #6 on: December 26, 2021, 13:45:27 pm »
Fantastic, thank you for this plugin.

ralf

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5263
  • Made in England
    • View Profile
Re: New Plugin - 2 Rail Sweep
« Reply #7 on: December 26, 2021, 18:06:46 pm »
Many thanks for your comments, I never thought it would be that well received however I did enjoy writing it and that's part of my impetus.
It has it's issues such as the surface being upside down etc. but having carried out tests I found next to zero factors that could influence a predictable outcome.

I might have a go at a 1 rail sweep next, time permitting but it might have less value for cnc work than the 2 rail sweep.
« Last Edit: December 26, 2021, 18:12:52 pm by EddyCurrent »
Filmed in Supermarionation

Offline Bob La Londe

  • CNC Jedi
  • *****
  • Posts: 4484
  • ^ 8.5 pounds on my own hand poured bait.
    • View Profile
    • CNC Molds N Stuff
Re: New Plugin - 2 Rail Sweep
« Reply #8 on: December 26, 2021, 18:58:40 pm »
It occurs to me that this might be just the ticket to go with the nonplanar parting line plugin. 

I'm going to have to play with it a little bit now.
Getting started on CNC?  In or passing through my area?
If I have the time I'll be glad to show you a little in my shop. 

Some Stuff I Make with CamBam
http://www.CNCMOLDS.com

Offline GeoffreyGRoy

  • Wookie
  • ****
  • Posts: 270
    • View Profile
Re: New Plugin - 2 Rail Sweep
« Reply #9 on: December 27, 2021, 07:48:36 am »
Dear Eddy

This is a plugin with some potential.  From some initial testing I have found some issues:

  • A rectangle inside a rectangle works and a circle inside a circle works, but not a polygon or circle inside a rectangle or vise versa
  • Shapes that intersect have problems - though this is not surprising, perhaps some warning should be offered
  • There are problems if one shape is a closed polyline and one is open
  • I know that you do not allow one shape to be a Point, but this would be useful.  The work round is to create a very short line segment.

I have attached some samples.

Geoff

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5263
  • Made in England
    • View Profile
Re: New Plugin - 2 Rail Sweep
« Reply #10 on: December 27, 2021, 11:31:06 am »
Geoff

Thanks for testing.

1. The start or first points of each object have to be lined up, the internal objects should be rotated until the surface is cleaner, they must also have the same direction.
2. intersections are never going to work.
3. I never considered that, do you have an example where that would create a useful surface ?
4. do you have an example where that would create a useful surface ?

I've attached an update to your cb file.
The only shapes that make sense to me are the ones where I've created a surface.

When choosing the rails for a 'shape within a shape', it's best to select the inner one first.
« Last Edit: December 27, 2021, 11:54:54 am by EddyCurrent »
Filmed in Supermarionation

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5263
  • Made in England
    • View Profile
Re: New Plugin - 2 Rail Sweep
« Reply #11 on: December 27, 2021, 16:25:58 pm »
Version 2 attached to first post in this thread.

1. added an options form, when the "Save" button is pressed all parameters are saved to Windows' Registry for subsequent operations.
2. it will appear in the Plugins menu as "Sweep2 Options"

The options are;

"Rail Resolution" : this is the number of surface facets along the rails, higher value gives smoother surface but keep it as low as possible. (default is 100)
"Cross Section Resolution":  this is the number of surface facets along the cross section, higher value gives smoother surface but keep it as low as possible. (default is 100)
"Height" : the height of the cross section and hence the surface at any point.
"Scaled" : the height is scaled according to the distance between rails at that point.
"As Cross Section" : the height will remain constant throughout at the actual height of the cross section object.
« Last Edit: December 27, 2021, 16:34:42 pm by EddyCurrent »
Filmed in Supermarionation

Offline Dragonfly

  • CNC Jedi
  • *****
  • Posts: 2652
    • View Profile
Re: New Plugin - 2 Rail Sweep
« Reply #12 on: December 27, 2021, 19:51:37 pm »
Installed under Linux.
I played with some simple rails and freehand drawn cross sections. It works. Seems that whether the surface comes out normal or inverted depends on which rail is selected first.

Quote
... all parameters are saved to Windows' Registry for subsequent operations.
I know that you and David are using different development platforms - VB and C# - but they are still Microsoft products.
Currently David's magnificent NumMove plugin does not remember values under Linux because David said he can't use Windows registry under Linux. But this plugin uses it and remember the options. I tried.  IIRC Mono creates a hidden folder for the registry in user's home.
My request is, if David is willing, as well as you, to jointly solve the registry usage with VB. Not a critical issue but I have to enter values every time I open NumMove. An I use it extensively.
Thanks.

Offline GeoffreyGRoy

  • Wookie
  • ****
  • Posts: 270
    • View Profile
Re: New Plugin - 2 Rail Sweep
« Reply #13 on: December 28, 2021, 02:07:50 am »
Dear Eddy

Thanks for the reply and update V2.

I have been trying to figure out how you got my examples to work.  In the attached CB file I have copied your Updated shapes (top most) from the CB file you returned. This works.   I have tried to duplicate this (bottom most shapes) but the error still appears (see image ProblemsB2.png).  Could you please explain what you did to make it work?  And, how you new it world work?

I am also including an example (Example.png) where a Point shape would be useful - in this case I have created a very short line at the centre of the arc. that produces close to what is required.

Geoff

Offline GeoffreyGRoy

  • Wookie
  • ****
  • Posts: 270
    • View Profile
Re: New Plugin - 2 Rail Sweep
« Reply #14 on: December 28, 2021, 03:25:25 am »
Dear Eddie

After some experimentation it seems the following is true:

From the Number of steps along the rails you divide up the two rails with the same number of steps.  If it happens that a line joining two respective point intervals (starting from their respective Start Points) intersects one of the rails then the problems occurs.  So if the two rails are "similar" then this is not likely to occur.  For concentric rails this might occur depending on their precise shape and orientation and the position of the Start Point of each rail.  In such cases we need to know where the start point is as this will give us some room to adjust the shapes, if that is possible.

For Polylines we can get this from the Point Collection, but it is not always easy to identify the point on the screen.  For other shapes the start point is not so obvious (unless the shape is converted to a Polyline and then checked).  It would be very useful, therefore, to mark the Start Point on each of the Rails during the selection process so that it is more clear what might be done to solve the problem (e.g Set the start point at a different vertex, rotate the shape, etc).

Just some thoughts

Geoff