Hi,
Imagine a hardwood chair leg. After anchoring my material to the spoilboard I’d like to cut several legs from the same board. I’d like each part placed and rotated depending on the specific grain of my board. I know I could edit the drawing and recalculate but a runtime solution would be much more efficient.

What I want to do is rotate a part and set a new 0,0 location based on 2 points. I want to be able to lay a pre-cut hardboard template down on my material. Once I've found pleasing grain to cut the part from my material, I want to use 2 predetermined points on the template to rotate and move my file to cut where I laid the template.

Has anyone ever done something like this? I know it's going to be possible but the path to the solution is a little foggy.

The part file I've attached is just a test file. there are 2 toolpaths. The first is just there to identify where the points are on the template. The second toolpath, the profile, represents the part I want to cut.
rotationtest.sbp

I would like to include prompts in my part file to ask the user to drive the bot to 2 points (or at least ask the user to enter coordinates). Once these points are identified, I would like to rotate the part based on the points and then cut the part.

I found this on the forum archive. This is what got me thinking.
http://www.talkshopbot.com/forum/arc...hp/t-1163.html


I commonly write sbp subroutines to cut a "feature" and then cut that feature several times, each time rotated to a different angle. The locking lap joint that I described in the tilting shop cart has a subroutine that cuts the pillars and another that cuts the wells; and both of these routines simply rotate their standard feature by a specified amount at run time.

If the feature is originally in terms of cartesian coordinates, convert to polar coordinates consisting of a distance (r) from the point of rotation (x0,y0) and the angle (a) from the point of rotation. To rotate the feature, just add the amount of rotation (d) to the angle a and convert back to cartesian coordinates using:

x = x0 + r * cos(a + d) and
y = y0 + r * sin(a + d)

I usually just use these expressions right in a M2 command:

M2 &X0 + &R * COS(&A + &D),&Y0 + &R * SIN(&A + &D)

------------------------------------------------

I thought I'd start by trying to write out what I imagine would happen in English. It's not bullet-proof but it's a starting point.

------------------------------------------------
At the computer, the part file is drawn with 0,0 centered on material.

0,0 is always the first reference point (A)
Refpoint B is somewhere else on the part.
The part always rotates around 0,0

A template is cut with the 2 points drilled through.

At the bot, the material is attached to the spoilboard. The user aligns the pre-cut template to the appropriate spot on material and marks 2 points (the 0,0 point of the new part and the second point) Both points are marked using holes drilled in the template.


load part file
Current reference pointA and pointB are set
This is the point of rotation
&refPointXA = 0
&refPointYA = 0

&refPointXB = -2 (changes depending on part)
&refPointYB = 16 (changes depending on part)

user is prompted for coordinates of new pointA
This is where the new 0,0 will be
INPUT >get input from user/keyboard or by driving bot manually to new pointA
&newPointXA = user input
&newPointYA = user input

user is prompted for coordinates of new pointB
INPUT >get input from user/keyboard or by driving bot manually to new pointB
&newPointXB = user input
&newPointYB = user input

Relocate zero with a Z2 at new pointA position
&newPointXA = &refPointXA
&newPointYA = &refPointYA

convert coordinates to polar

&refPointDistanceB
&refPointAngleB
&newPointDistanceB
&newPointAngleB

get angle difference
&AngleChange = &refPointAngleB - &newPointAngleB

Convert entire part to polar (all at once or as the file runs?)
Change angle for all coordinates by &AngleChange

Convert file back to cartesian coordinates.

Cut file in new location with calculated angle change
Bob's your uncle

Phew, that's all I've got. I wanted to make sure i thought it through before I asked y'all. Sorry for the very long post. If I get this working I'd love to share the technique with a nice video tutorial.