Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Haas Lathe macro problem


pip
 Share

Recommended Posts

The company a friend works for, has bought a Haas lathe. They had only fanuc controlls before this, so this macro problem never apeared.  Is there a solution for this on a haas..  you cannot program a known position approach with "A"  you cannot use an "A" on the same line as "x" and "Z" ..  hope you can see what I am trying to do.. Starting on the face of a part drive along at A90 to unknown point then drive to a given point at A60. there by letting the controll determin where the intersection point is..

 

code

 

G42G1X[#4-1]Z-[#13-0.2]
G1A90
G1X[#3-[2*[#13-0.15]]]Z0.15A60
G1G40Z2

 

hope somebody can help. 

Link to comment
Share on other sites

Dunno about A-axis, but I'm assuming you meant C-axis. (A in some cases refer to a live tool aligned with X-axis) Are you trying to do face contouring? You should check if the control supports G12.1 and G13.1. With it, you can enter Y-coordinates using the C register and what's best, G41 and G42 works in that mode!

Link to comment
Share on other sites

Fanuc indeed does not support specifying angles in linear interpolation, as far as I know, like Siemens does (our controls support chamfer and radius, but naturally they are options...like everything else in Fanuc...) You have to use trigonometry, and in this case, the TAN macro B function. It's nothing but elementary school math :)

Link to comment
Share on other sites

I was dreading that answer Ron Branch..  The person who wrote these macros had not structure to his programs..  Oh well, reprogram it is then..

 

What doesn't kill harm you makes you stronger. :turned: :turned: :turned::scooter: :scooter: :scooter:

 

Edited to be sensitive.

Edited by 5th Axis Consulting Group
Link to comment
Share on other sites

If you know the starting points of the lines and their angles, you need a ray-ray intersection macro. The angles must be converted to direction vectors first.

 

The math: http://stackoverflow.com/questions/2931573/determining-if-two-rays-intersect

Example:
First point p1=(X10,Y10), angle=240
Second point p2=(X5,-Y10), angle=90

240 degrees direction vector d1=(cos(240),sin(240))=(X-0.5,Y-0.866)
90 degrees direction vector d2=(cos(90),sin(90))=(X0,Y1)

The first ray p1+x1*d1
The second ray is p2+x2*d2
The intersection is where p1+x1*d1=p2+x2*d2

p1.x+x1*d1.x=p2.x*x2+d2.x
p1.y+x1*d1.y=p2.y*x2+d2.y
you will finally get =>
x1=((p2.y-p1.y)*d2.x-(p2.x-p1.x)*d2.y)/(d2.x*d1.y-d2.y*d1.x)=10
x2=((p2.y-p1.y)*d1.x-(p2.x-p1.x)*d1.y)/(d2.x*d1.y-d2.y*d1.x)=11.34

When you plug these x1 and x2 into the first and second ray formulas, you will get the intersection point at (X5,Y1.34). Of course, the macro should check that they intersect at all (x1 and x2 positive) and they are not parallel (division by zero).

 

Happy writing :)
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...