Author Topic: 'Way Points' to avoid obstacles  (Read 26288 times)

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1892
    • View Profile
Re: 'Way Points' to avoid obstacles
« Reply #15 on: February 10, 2015, 02:04:57 am »
Hi Eddy
This will save me quite a bit of time I suspect, As now on a particular file (5 hrs duration) I'm often doing something else while the machine is running and so as not to run into the clamps I insert a tool change
even though I'm using the same tool for all the mops so that the machine stops at the clearance plane and waits for me to reposition it at the next mop and continue on, And often it sits there for quite a while because I'm distracted doing something else.
Dave.

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5322
  • Made in England
    • View Profile
Re: 'Way Points' to avoid obstacles
« Reply #16 on: February 10, 2015, 08:55:52 am »
Dave, That's good to hear, it's just a simple thing but I'm going to find it useful too, in fact that's why I came up with it. Also keep in mind you can put other instructions in the txt file.
Filmed in Supermarionation

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5322
  • Made in England
    • View Profile
Re: 'Way Points' to avoid obstacles
« Reply #17 on: February 10, 2015, 19:02:16 pm »
Draws a line showing the waypoint route.

Code: [Select]
Sub main()
if view.SelectedEntities.Length > 0 then
dim pl as PointList
for each ent as Entity in view.SelectedEntities
if typeof ent is PointList then
pl = ent
else
msgbox("Must be a Pointlist")
exit sub
end if
WriteNCMOP(pl)
next ent
else
msgbox("Please select a Pointlist first")
end if
End sub

Sub WriteNCMOP(p as PointList)
 
Dim config As CamBam.CamBamConfig = CamBamConfig.Defaults
Dim path1 As String =  FileUtils.GetFullPath(config.SystemPath)
Dim ncfile = new CamBam.CAM.MOPNCFile(path1 & "\scripts\WayPoint.txt")
Dim str1 = ncfile.CustomMOPHeader
Dim PointListString as String
Dim inval as String
Dim poly = new polyline()

Do
inval=inputbox("Enter Height for Z during Waypoint move", "Z Height For Move","50")
Loop Until IsNumeric(inval)

PointListString = "G0 Z"&inval & VbCrLf
   
for each pt as Point3F in p.points
poly.Add(pt.x,pt.y,inval)
    PointListString = PointListString & "G0 X"&pt.x & " Y"& pt.y & VbCrLf
next pt

doc.Add(poly)
str1.SetValue(PointListString)
  ncfile.CustomMOPHeader = str1
ncfile.Name = "Waypoint - PointList " & p.ID
  CamBamUI.MainUI.InsertMOP(ncfile)
 End Sub

Filmed in Supermarionation

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5322
  • Made in England
    • View Profile
Re: 'Way Points' to avoid obstacles
« Reply #18 on: March 13, 2015, 10:37:22 am »
I've added a sample file, it consists of 4 pockets and 2 obstacles. The obstacles could be clamps or whatever.
The numbers have been kept simple to make the gcode readable.

Edit: sorry forgot about the text file, now added below.

How to use;

After unzipping move the vbs file into your CamBam 'scripts' folder as usual, put the cb file and txt file into the folder of your choice, but both need to be in the same folder.

1. Create the geometry for your job and add your MOPs
2. Where there is an obstacle to avoid, create a 'Pointlist' that defines a route past it, there can be many points in the pointlist, if the route is like a dog's back leg for example.
3. Select the pointlist and load the script, press F5, it will ask for a Z height that the tool should go to while it moves from one point to the next along the pointlist. If you did not have a pointlist selected it will show an error message telling you to select a point list first.
4. Create more pointlists if there are more obstacles.
5. In the 'tree view' move the waypoints in between the appropriate MOPs.
6. Generate toolpaths and gcode as normal
7. A line will be drawn showing the waypoint route, if you rotate the view it can be seen these have been drawn at the height you selected.

Now have a look at the gcode.
« Last Edit: March 13, 2015, 16:21:58 pm by EddyCurrent »
Filmed in Supermarionation

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1892
    • View Profile
Re: 'Way Points' to avoid obstacles
« Reply #19 on: March 13, 2015, 21:24:55 pm »
HI Eddy
Took A while for the penny to drop but once I understood what to do and made a couple of files myself
it works fine.
Dave

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5322
  • Made in England
    • View Profile
Re: 'Way Points' to avoid obstacles
« Reply #20 on: March 14, 2015, 08:35:26 am »
Dave, was there something missing or unclear with my example ? something I could do to improve it ?
Filmed in Supermarionation

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1892
    • View Profile
Re: 'Way Points' to avoid obstacles
« Reply #21 on: March 14, 2015, 09:06:24 am »
HI Eddy
I downloaded this file a couple of times (because I thought I'd done something wrong) produced the gcode
from the original file and found that the  path produced, A path at the end of the code that made a rapid to the last hole that went through the clamps. I did this a couple of times But after generating another file from scratch
I could see My mistake and produced a file that raised to the clearance plane  and jumped over my imaginary clamps   
dave.