CAM plugin


I’m exploring the possibility of writing a CAM plugin. It would basically need to look a a contour, be able to determine if an entity is a circle or an arc and it’s radius. I think I can figure out that part.

What I’m unsure of is how to plot XY coordinates around a contour. If a segment is a straight line, it would be plotted with a start and end point. If a segment is not a straight line, it would be represented by short line Yemenis strung together. If a segment is not a straight line but is try arc, it would be represented using an arc command.

This would output standard G codes.

G1 = linear move
G2 = arc move clockwise
G3 = Arc move counter clockwise

A G1 would look like G1X5Y10.

An arc move looks like G02X2Y0I0J-2

X2Y0 is the end point of the arc. I0 is the X arc center relative to the arc start point and J-2 is the Y center relative to the start point.

I know this a pretty broad scope question, but I’m just at the starting point right now. Given this information, what would be the best way to approach this?


(Dale Fugier) #2

Check the Rhino help file for the SimplifyCrv command, which replaces each curve segment that has the geometry of a line or an arc with a true line or arc. Perhaps this is what you need. I’m sure there is SDK access to this…