is there 5 axis

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
harshmacwan
Posts: 12
Joined: Sun May 30, 2021 3:03 pm

Re: is there 5 axis

Post by harshmacwan »

harshmacwan wrote: Mon Jun 07, 2021 4:00 pm
adamLange wrote: Sun Jun 06, 2021 2:34 am
harshmacwan wrote: Fri Jun 04, 2021 6:35 pm
Hi harshmacwan,

I pushed a new commit. I added a helloWorld:

/python/toolpathGeneration/simple_5_axis_example/helloWorld.py

Can you please try it?

I also fixed some socket options and homogenized the port numbers.

Adam
Amazing, This worked and GCODE was generated.

I have attached the code here.

Thanks a ton Adam for your help and contribution towards Open source CAD/CAM. Now me and my friends are on the track towards making a freecad work bench and seamless 5 axis generation. I will be very happy if you provide your suggestions.

Harsh

Code: Select all

(add tool offset moves from home ect...)
G43 H2
G21 G90 G93
G0 Z50
M3 S21390
G0 X-0.002905 Y0.010889 Z0.029513 A94.831881 B1.287190
G01 X-0.001804 Y0.011125 Z0.029510 A94.935841 B0.798657 F324.124272
G01 X-0.000680 Y0.011250 Z0.029508 A94.990894 B0.300746 F324.124272
G01 X0.000450 Y0.011261 Z0.029505 A94.995955 B-0.200153 F324.124272
G01 X0.001576 Y0.011160 Z0.029503 A94.951004 B-0.698973 F324.124272
G01 X0.002686 Y0.010946 Z0.029500 A94.856515 B-1.190664 F324.124272
G01 X0.003768 Y0.010622 Z0.029498 A94.713469 B-1.670248 F324.124272
G01 X0.004812 Y0.010192 Z0.029495 A94.523341 B-2.132890 F324.124272
G01 X0.005806 Y0.009660 Z0.029493 A94.288087 B-2.573943 F324.124272
G01 X0.006742 Y0.009032 Z0.029490 A94.010121 B-2.988992 F324.124272
G01 X0.007610 Y0.008314 Z0.029488 A93.692288 B-3.373917 F324.124272
G01 X0.008401 Y0.007514 Z0.029485 A93.337841 B-3.724909 F324.124272
G01 X0.009108 Y0.006639 Z0.029483 A92.950220 B-4.038673 F324.124272
G01 X0.009725 Y0.005698 Z0.029480 A92.532487 B-4.312639 F324.124272
G01 X0.010245 Y0.004701 Z0.029478 A92.089632 B-4.543422 F324.124272
G01 X0.010662 Y0.003657 Z0.029475 A91.626090 B-4.728820 F324.124272
G01 X0.010974 Y0.002578 Z0.029473 A91.146452 B-4.867080 F324.124272
G01 X0.011176 Y0.001474 Z0.029470 A90.655499 B-4.956891 F324.124272
G01 X0.011268 Y0.000355 Z0.029468 A90.158091 B-4.997413 F324.124272
G01 X0.011248 Y-0.000767 Z0.029465 A89.659176 B-4.988272 F324.124272

Hi Adam,

Now we are moving ahead with the project and while creating spline we are facing some issue.

We are getting a Broken Pipe issue with the socket connection while generating the gcode for spline. I have attached here the snap of that along with the file contains coordinates in the format of (x y z u v w). I have also attached the modified version of hellowolrd.py to read from the file and a freecad snap to see the spline with tool angle.

Let me know if you have any idea how to resolve the issue. Also, would it be possible to explain the process of how to debug the Modelica model so that we can get to know the exact issue?

Regards,

Harsh
Attachments
gcode_with_axis.txt
(4.37 KiB) Downloaded 62 times
Screenshot from 2021-06-12 22-36-44.png
Screenshot from 2021-06-12 22-36-44.png (388.36 KiB) Viewed 3705 times
helloWorld.py
(1.97 KiB) Downloaded 67 times
adamLange
Posts: 75
Joined: Sun May 24, 2015 12:15 am

Re: is there 5 axis

Post by adamLange »

Hi Harsh,

I ran your the example. Modelica solves the first 22 then it gets stuck solving the 23 pose and simulation run time runs out. I increased the modelica simulation run time and the same happened. To troubleshoot, after the simulation ran I used the plotting tab in OpenModelica and plotted a_axis.angle. In the beginning of the simulation the a axis was moving. At about 73 seconds the angle went to -25 degrees and got stuck there. You crashed the machine.

The pocketnc can only go -25 degrees in the A-axis. There's an icon in Machine.mo model (which I should rename to Pocketnc.mo) that says "limiter". If you double click it and look at the properties, you'll see that is negative limit is set to -25 degrees.

Adam
harshmacwan
Posts: 12
Joined: Sun May 30, 2021 3:03 pm

Re: is there 5 axis

Post by harshmacwan »

adamLange wrote: Sat Jun 12, 2021 8:32 pm Hi Harsh,

I ran your the example. Modelica solves the first 22 then it gets stuck solving the 23 pose and simulation run time runs out. I increased the modelica simulation run time and the same happened. To troubleshoot, after the simulation ran I used the plotting tab in OpenModelica and plotted a_axis.angle. In the beginning of the simulation the a axis was moving. At about 73 seconds the angle went to -25 degrees and got stuck there. You crashed the machine.

The pocketnc can only go -25 degrees in the A-axis. There's an icon in Machine.mo model (which I should rename to Pocketnc.mo) that says "limiter". If you double click it and look at the properties, you'll see that is negative limit is set to -25 degrees.

Adam
Is there any other solution to Generate Gcode?

Or we can need to adjust the angle?
adamLange
Posts: 75
Joined: Sun May 24, 2015 12:15 am

Re: is there 5 axis

Post by adamLange »

If you want your script to run to the end, you can just set the a-axis limiter in the modelica model to a very low number. The gcode would be generated but it would make the pocketnc mechanically crash if you ran the code. You can try running your gcode at sim.pocketnc.com.
harshmacwan
Posts: 12
Joined: Sun May 30, 2021 3:03 pm

Re: is there 5 axis

Post by harshmacwan »

adamLange wrote: Sat Jun 12, 2021 8:53 pm If you want your script to run to the end, you can just set the a-axis limiter in the modelica model to a very low number. The gcode would be generated but it would make the pocketnc mechanically crash if you ran the code. You can try running your gcode at sim.pocketnc.com.
Thanks I will check it out.

Harsh
aaron
Posts: 29
Joined: Fri Nov 21, 2014 2:25 pm
Contact:

Re: is there 5 axis

Post by aaron »

This is amazing news. I have pretty much completed a 5 axis router with rotating and tilting head (xyzbc I think) I was hoping to use Fusion 360 or cnc toolkit , but non of these options seem to work. I am a great fan of open sourcieness and freecad is amazing. I would love to help develop this capacity if I could. I am pretty useless at coding but will happily run some g code if anybody wants to try something out.
What chance is there of some kind of tutorial or walk through for a simpleton to generate 5 axis g code for himself?
Much respect to all you developers
Aaron
adamLange
Posts: 75
Joined: Sun May 24, 2015 12:15 am

Re: is there 5 axis

Post by adamLange »

Hi Aaron,
Sounds like a cool machine. I'd love to help make gcode to run it. This would be a great opportunity to demonstrate the process of how to make a post processor with modelIKa for a custom machine. Can you send a CAD model of your machine? Even a skeleton model would be okay. I just need to see the limits of the machine and how the joints are arranged with respect to one and other.
Adam
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: is there 5 axis

Post by sliptonic »

I've been working on visualizing and calculating rotation for 3+2 milling.
I'm attaching my test file and macro. This works to calculating the rotary joint angles to position the test cube but I had to add another placement property to the 'model' so that I could return it to a home position before calculating the next move.
rotationsall.gif
rotationsall.gif (777.42 KiB) Viewed 3412 times

Code: Select all

import math

def oneMove(obj, vec, angle):
    if angle == 0:
        return
    center = App.Vector(0,0,0)
    ci = obj.getGlobalPlacement().inverse().multVec(center)
    real_center = obj.Placement.multVec(ci)

    #print('center: {} \nci: {} \nreal_center: {}'.format(center, ci, real_center))

    shape = obj.Shape.copy()
    shape.rotate(real_center, vec, angle)

    obj.Placement = shape.Placement

   

#This assumes you've selected a face from a solid in the 3D window
obj=FreeCADGui.Selection.getSelectionEx()[0].Object
fname = FreeCADGui.Selection.getSelectionEx()[0].SubElementNames[0]
obj.Placement = obj.home

shp=obj.Shape
face = getattr(shp, fname)
#Calculate C rotation
facenormal = face.normalAt(0,0)

v = App.Vector(facenormal)
v.projectToPlane(App.Vector(0,0,0),App.Vector(0,0,1))

posRot = v.getAngle(App.Vector(0,1,0))
posRot = math.degrees(posRot) if not math.isnan(posRot) else 0

negRot = v.getAngle(App.Vector(0,-1,0))
negRot = math.degrees(negRot) if not math.isnan(negRot) else 0 

cRot = 0-negRot if negRot < posRot else posRot
print('Rotating C {} degrees'.format(cRot))

oneMove(obj,App.Vector(0,0,1),cRot)

#calculate A rotation
shp=obj.Shape
face = getattr(shp, fname)
facenormal = face.normalAt(0,0)

v = App.Vector(facenormal)
aRot = v.getAngle(App.Vector(0,0,1))
aRot = math.degrees(aRot) if not math.isnan(aRot) else 0

align = v.getAngle(App.Vector(0,1,0))
if math.isnan(align):
    aRot = 0
else:
    aRot = 0-aRot if math.degrees(align) >= 90 else aRot

print('Rotating A {} degrees'.format(aRot))

oneMove(obj,App.Vector(1,0,0),aRot)

pb = App.ActiveDocument.getObject("PropertyBag")
print('Before: A: {} C:{}'.format(pb.APosition,pb.CPosition))
pb.APosition = aRot #+ pb.APosition.Value
pb.CPosition = cRot #+ pb.CPosition.Value
print('After: A: {} C:{}'.format(pb.APosition,pb.CPosition))

App.ActiveDocument.recompute()
Attachments
rotationtest.FCStd
(531.98 KiB) Downloaded 70 times
harshmacwan
Posts: 12
Joined: Sun May 30, 2021 3:03 pm

Re: is there 5 axis

Post by harshmacwan »

adamLange wrote: Sun Jun 20, 2021 3:09 pm Hi Aaron,
Sounds like a cool machine. I'd love to help make gcode to run it. This would be a great opportunity to demonstrate the process of how to make a post processor with modelIKa for a custom machine. Can you send a CAD model of your machine? Even a skeleton model would be okay. I just need to see the limits of the machine and how the joints are arranged with respect to one and other.
Adam
This sounds exciting, Even I have one haas DT-1(3+2), I am also planning to make post processor for my machine. If you can teach us, It will be very helpful. I have Cad model file. I tried to attach here but its too large. Let me know How I can send it to you for your guidence.

Our work benching is in progress.

Thanks

Harsh
aaron
Posts: 29
Joined: Fri Nov 21, 2014 2:25 pm
Contact:

Re: is there 5 axis

Post by aaron »

Hi Adam
Sorry, I have been away. I will get CAD model to you very soon.
Aaron
Post Reply