├── CAM ├── CAM.cbp ├── CAM.sln ├── CAM.vcxproj ├── CMakeLists.txt ├── NCCode.cpp ├── NCCode.h ├── PythonStuff.cpp ├── stdafx.cpp └── stdafx.h ├── CMakeLists.txt ├── CamApp.py ├── CamContextTool.py ├── CamObject.py ├── DepthOp.py ├── DepthOpDlg.py ├── Drilling.py ├── DrillingDlg.py ├── Heeks2.py ├── HeeksCNC2.desktop ├── HeeksCNC2.svg ├── Machine.py ├── NcCode.py ├── OpDlg.py ├── Operation.py ├── Operations.py ├── OutputWindow.py ├── Pattern.py ├── PatternDlg.py ├── Patterns.py ├── Pocket.py ├── PocketDlg.py ├── PopupMenu.py ├── Profile.py ├── ProfileDlg.py ├── Program.py ├── ProgramDlg.py ├── ProgramWindow.py ├── PyProcess.py ├── README.md ├── ScriptOp.py ├── ScriptOpDlg.py ├── Sim ├── CMakeLists.txt ├── PythonStuff.cpp ├── ReadMe.txt ├── Sim.sln ├── Sim.vcxproj ├── bbox.cpp ├── bbox.hpp ├── cube_wireframe.hpp ├── cutsim_def.hpp ├── facet.hpp ├── gldata.cpp ├── gldata.hpp ├── glvertex.hpp ├── isosurface.hpp ├── machine.cpp ├── machine.hpp ├── marching_cubes.cpp ├── marching_cubes.hpp ├── octnode.cpp ├── octnode.hpp ├── octree.cpp ├── octree.hpp ├── stdafx.cpp ├── stdafx.h ├── volume.cpp └── volume.hpp ├── SketchOp.py ├── SketchOpDlg.py ├── Solid Examples ├── ballplate.step ├── ballplatestock.stl ├── bottom plate.stp ├── cutsphere.stl ├── hexagon curved with slot.step ├── hexagon infinity.step ├── hexagon with slot.step ├── shape.step ├── simple.STEP └── two tapered holes.step ├── SolidsDlg.py ├── SpeedOp.py ├── SpeedOpDlg.py ├── Stock.py ├── StockDlg.py ├── Stocks.py ├── Surface.py ├── SurfaceDlg.py ├── Surfaces.py ├── Tag.py ├── Tags.py ├── Tool.py ├── ToolDlg.py ├── Toolpath.py ├── Tools.py ├── area_funcs.py ├── attach.py ├── bitmaps ├── adapt.png ├── addtag.png ├── apply.png ├── attach.png ├── ballmill.png ├── bitmaps.svg ├── cancel.png ├── centredrill.png ├── chamfmill.png ├── climb.png ├── climb.svg ├── code.png ├── conventional.png ├── conventional.svg ├── cutting_rate.png ├── deflection_away.svg ├── deflection_into.svg ├── delete.png ├── depthop │ ├── clearance height.png │ ├── depthop.svg │ ├── drill clearance height.png │ ├── drill final depth.png │ ├── drill rapid down height.png │ ├── drill start depth.png │ ├── drill step down.png │ ├── drill z finish depth.png │ ├── drill z thru depth.png │ ├── final depth.png │ ├── rapid down height.png │ ├── start depth.png │ ├── step down.png │ ├── z finish depth.png │ └── z thru depth.png ├── dlgprofile.png ├── dlgprofile.svg ├── drill.png ├── drilling.png ├── drilling │ ├── clearance height.png │ ├── dont stop spindle.png │ ├── drilling.svg │ ├── dwell.png │ ├── feed retract.png │ ├── general.png │ ├── internal coolant off.png │ ├── internal coolant on.png │ ├── rapid retract.png │ ├── rapid to clearance.png │ ├── rapid to standoff.png │ ├── stand off.png │ └── stop spindle at bottom.png ├── enddraw.png ├── endmill.png ├── engraver.png ├── export.png ├── exptools.png ├── extrusion.png ├── fixture.png ├── fixtures.png ├── help.png ├── import.png ├── imptools.png ├── knife.png ├── locating.png ├── magic.png ├── opchamfer.png ├── opcontour.png ├── open.png ├── opennc.png ├── opprofile.png ├── ops.png ├── optap.png ├── optoolclear.png ├── output.png ├── outputgray.png ├── pattern.png ├── pattern │ ├── pattern.svg │ ├── shape.png │ └── shape2.png ├── patterns.png ├── pdf.png ├── pickend.png ├── pickstart.png ├── pocket.png ├── pocket │ ├── climb milling.png │ ├── conventional milling.png │ ├── general.png │ ├── material allowance.png │ ├── not tool down.png │ ├── pocket.svg │ ├── starting boundary.png │ ├── starting center.png │ ├── step over.png │ ├── tool down.png │ ├── use zig zag.png │ ├── zig angle.png │ └── zig unidirectional.png ├── postprocess.png ├── probe.png ├── profile │ ├── do finishing pass.png │ ├── general.png │ ├── no finishing pass.png │ ├── offset .png │ ├── offset extra.png │ ├── only finishing.png │ ├── profile.svg │ ├── roll radius.png │ ├── side inside or right.png │ ├── side inside.png │ ├── side left.png │ ├── side on.png │ ├── side outside or left.png │ ├── side outside.png │ └── side right.png ├── python.png ├── raft.png ├── rolloff.png ├── rollon.png ├── runpython.png ├── save.png ├── savenc.png ├── scriptop.png ├── selsketch.png ├── selsolid.png ├── setactive.png ├── setinactive.png ├── slotdrill.png ├── speed_reference.png ├── stock.png ├── stock │ └── general.png ├── stocks.png ├── surface.png ├── surface │ ├── different for each position.png │ ├── general.png │ ├── material allowance.png │ ├── min z.png │ ├── same for each position.png │ ├── surface.svg │ └── tolerance.png ├── surfaces.png ├── tagpos.png ├── tap.png ├── tomachine.png ├── tool.png ├── tool │ ├── ball_mill.png │ ├── ball_mill_corner.png │ ├── ball_mill_diameter.png │ ├── ball_mill_height.png │ ├── ball_mill_offset.png │ ├── centre_drill.png │ ├── centre_drill_angle.png │ ├── centre_drill_diameter.png │ ├── centre_drill_height.png │ ├── centre_drill_offset.png │ ├── chamfer.png │ ├── chamfer_angle.png │ ├── chamfer_diameter.png │ ├── chamfer_flat.png │ ├── chamfer_height.png │ ├── chamfer_offset.png │ ├── drill.png │ ├── drill_angle.png │ ├── drill_diameter.png │ ├── drill_height.png │ ├── drill_offset.png │ ├── end_mill.png │ ├── end_mill_corner.png │ ├── end_mill_diameter.png │ ├── end_mill_flat.png │ ├── end_mill_height.png │ ├── end_mill_offset.png │ ├── engraver.png │ ├── engraver_angle.png │ ├── engraver_diameter.png │ ├── engraver_flat.png │ ├── engraver_height.png │ ├── engraver_offset.png │ └── tool.svg ├── toolpathclear.png ├── tools.png ├── turnrough.png ├── turntool.png ├── unattach.png └── zigzag.png ├── build.sh ├── consts.py ├── coptest.sh ├── debian ├── cam.install ├── changelog ├── compat ├── control ├── copyright ├── dirs ├── rules └── source │ └── format ├── default.tooltable ├── depth_params.py ├── heeksCNC2.sh ├── heekscnc.png ├── icons ├── HeeksCAM.svg ├── adapt.png ├── arc.png ├── area.png ├── attach.png ├── ballmill.png ├── billets.png ├── branch_end.png ├── branch_end_minus.png ├── branch_end_plus.png ├── branch_minus.png ├── branch_plus.png ├── branch_split.png ├── branch_trunk.png ├── centredrill.png ├── chamfmill.png ├── circle.png ├── cone.png ├── coordsys.png ├── cube.png ├── cutting_rate.png ├── cyl.png ├── dimension.png ├── drill.png ├── drilling.png ├── edge.png ├── edges.png ├── ellipse.png ├── endmill.png ├── engraver.png ├── extrusion.png ├── face.png ├── faces.png ├── gear.png ├── group.png ├── iline.png ├── knife.png ├── line.png ├── locating.png ├── minus.png ├── nccode.png ├── noentry.png ├── octree.png ├── operations.png ├── pattern.png ├── patterns.png ├── picture.png ├── plus.png ├── pocket.png ├── point.png ├── probe.png ├── profile.png ├── program.png ├── raft.png ├── scriptop.png ├── sim.png ├── sketch.png ├── slotdrill.png ├── solid.png ├── speeds.png ├── sphere.png ├── spline.png ├── stlsolid.png ├── stock.png ├── stocks.png ├── surface.png ├── surfaces.png ├── tag.png ├── tags.png ├── tap.png ├── tapping.png ├── text.png ├── tool.png ├── tools.png ├── turnrough.png ├── turntool.png ├── unattach.png ├── unknown.png ├── vertex.png ├── vertices.png ├── waterline.png ├── wire.png ├── xml.png └── zigzag.png ├── kurve_funcs.py ├── logo.svg ├── nc ├── DeckelFP4Ma.py ├── Fanuc3000.py ├── Fanuc3000_read.py ├── __init__.py ├── anilam_crusader_m.py ├── anilam_crusader_m_read.py ├── bpmcp.py ├── cad_iso_read.py ├── cad_nc_read.py ├── cad_read.py ├── centroid1.py ├── centroid1_read.py ├── cutviewer.py ├── drag_knife.py ├── dynapath.py ├── emc2.py ├── emc2b.py ├── emc2b_crc.py ├── emc2tap.py ├── format.py ├── gantry_router.py ├── heiden.py ├── heiden_read.py ├── hm50.py ├── hpgl2d.py ├── hpgl2d_read.py ├── hpgl2dv.py ├── hpgl2dv_read.py ├── hpgl3d.py ├── hpgl3d_read.py ├── hxml_writer.py ├── iso.py ├── iso_codes.py ├── iso_crc.py ├── iso_modal.py ├── iso_read.py ├── mach3.py ├── machines.xml ├── makerbotHBP.py ├── makerbot_codes.py ├── mc1000vf.py ├── nc.py ├── nc_read.py ├── nclathe_read.py ├── num_reader.py ├── printbot3d.py ├── printbot3d_read.py ├── rez2.py ├── rez2_read.py ├── series1.py ├── series1_read.py ├── siegkx1.py ├── swap.py └── tnc151.py ├── ocl_funcs.py ├── recreator.py ├── test.bat ├── test.py ├── transform.py └── ubuntu_build.sh /CAM/CAM.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 67 | 68 | -------------------------------------------------------------------------------- /CAM/CAM.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CAM", "CAM.vcxproj", "{E96E2F07-F474-49BA-A614-38E1ABB26F9C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {E96E2F07-F474-49BA-A614-38E1ABB26F9C}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {E96E2F07-F474-49BA-A614-38E1ABB26F9C}.Debug|Win32.Build.0 = Debug|Win32 16 | {E96E2F07-F474-49BA-A614-38E1ABB26F9C}.Release|Win32.ActiveCfg = Release|Win32 17 | {E96E2F07-F474-49BA-A614-38E1ABB26F9C}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /CAM/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | 3 | #include "stdafx.h" 4 | 5 | // TODO: reference any additional headers you need in STDAFX.H 6 | // and not in this file 7 | -------------------------------------------------------------------------------- /CAM/stdafx.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifdef WIN32 4 | #include "windows.h" 5 | #endif 6 | 7 | extern "C" { 8 | #include 9 | #include 10 | } 11 | 12 | #include "geometry.h" 13 | #include "Point.h" 14 | #include "Box.h" 15 | #include "tinyxml.h" 16 | #include "IPoint.h" 17 | 18 | extern std::wstring cam_dir; 19 | #include "App.h" 20 | extern CApp* theApp; -------------------------------------------------------------------------------- /CamContextTool.py: -------------------------------------------------------------------------------- 1 | import ContextTool 2 | import wx 3 | 4 | class CamContextTool(ContextTool.CADContextTool): 5 | def __init__(self, title, bitmap_name, method): 6 | ContextTool.CADContextTool.__init__(self, title, bitmap_name, method) 7 | 8 | def BitmapPath(self): 9 | return wx.GetApp().cam_dir + '/bitmaps/'+ self.BitmapName() + '.png' 10 | 11 | 12 | class CamObjectContextTool(CamContextTool): 13 | def __init__(self, object, title, bitmap_name, method): 14 | CamContextTool.__init__(self, title, bitmap_name, method) 15 | self.object = object 16 | 17 | def Run(self, event): 18 | self.method(self.object) 19 | 20 | -------------------------------------------------------------------------------- /CamObject.py: -------------------------------------------------------------------------------- 1 | from Object import Object 2 | import os 3 | 4 | cam_dir = os.path.dirname(os.path.realpath(__file__)) 5 | 6 | class CamObject(Object): 7 | def __init__(self, type = 0, id_named = False): 8 | Object.__init__(self, type, id_named) 9 | 10 | def icon(self): 11 | return "unknown" 12 | 13 | def TypeName(self): 14 | return "Unknown" 15 | 16 | def GetTypeString(self): 17 | return self.TypeName() 18 | 19 | def GetIconFilePath(self): 20 | return cam_dir + '/icons/' + self.icon() + '.png' 21 | 22 | def HasColor(self): 23 | return False 24 | -------------------------------------------------------------------------------- /DepthOpDlg.py: -------------------------------------------------------------------------------- 1 | from SpeedOpDlg import SpeedOpDlg 2 | from HeeksObjDlg import HeeksObjDlg 3 | from NiceTextCtrl import LengthCtrl 4 | 5 | class DepthOpDlg(SpeedOpDlg): 6 | def __init__(self, object, drill_pictures, title): 7 | self.drill_pictures = drill_pictures 8 | SpeedOpDlg.__init__(self, object, False, title) 9 | 10 | def AddLeftControls(self): 11 | self.lgthClearanceHeight = LengthCtrl(self) 12 | self.MakeLabelAndControl('Clearance Height', self.lgthClearanceHeight).AddToSizer(self.sizerLeft) 13 | self.lgthRapidDownToHeight = LengthCtrl(self) 14 | self.MakeLabelAndControl('Rapid Safety Space', self.lgthRapidDownToHeight).AddToSizer(self.sizerLeft) 15 | self.lgthStartDepth = LengthCtrl(self) 16 | self.MakeLabelAndControl('Start Depth', self.lgthStartDepth).AddToSizer(self.sizerLeft) 17 | self.lgthFinalDepth = LengthCtrl(self) 18 | self.MakeLabelAndControl('Final Depth', self.lgthFinalDepth).AddToSizer(self.sizerLeft) 19 | self.lgthStepDown = LengthCtrl(self) 20 | self.MakeLabelAndControl('Step Down', self.lgthStepDown).AddToSizer(self.sizerLeft) 21 | self.lgthZFinishDepth = LengthCtrl(self) 22 | self.MakeLabelAndControl('Z Finish Depth', self.lgthZFinishDepth).AddToSizer(self.sizerLeft) 23 | self.lgthZThruDepth = LengthCtrl(self) 24 | self.MakeLabelAndControl('Z Through Depth', self.lgthZThruDepth).AddToSizer(self.sizerLeft) 25 | 26 | SpeedOpDlg.AddLeftControls(self) 27 | 28 | def AddRightControls(self): 29 | SpeedOpDlg.AddRightControls(self) 30 | 31 | def SetDefaultFocus(self): 32 | self.lgthClearanceHeight.SetFocus() 33 | 34 | def GetDataRaw(self): 35 | self.object.clearance_height = self.lgthClearanceHeight.GetValue() 36 | self.object.rapid_safety_space = self.lgthRapidDownToHeight.GetValue() 37 | self.object.start_depth = self.lgthStartDepth.GetValue() 38 | self.object.final_depth = self.lgthFinalDepth.GetValue() 39 | self.object.step_down = self.lgthStepDown.GetValue() 40 | self.object.z_finish_depth = self.lgthZFinishDepth.GetValue() 41 | self.object.z_thru_depth = self.lgthZThruDepth.GetValue() 42 | 43 | SpeedOpDlg.GetDataRaw(self) 44 | 45 | def SetFromDataRaw(self): 46 | self.lgthClearanceHeight.SetValue(self.object.clearance_height) 47 | self.lgthRapidDownToHeight.SetValue(self.object.rapid_safety_space) 48 | self.lgthStartDepth.SetValue(self.object.start_depth) 49 | self.lgthFinalDepth.SetValue(self.object.final_depth) 50 | self.lgthStepDown.SetValue(self.object.step_down) 51 | self.lgthZFinishDepth.SetValue(self.object.z_finish_depth) 52 | self.lgthZThruDepth.SetValue(self.object.z_thru_depth) 53 | 54 | SpeedOpDlg.SetFromDataRaw(self) 55 | 56 | def SetPictureByWindow(self, w): 57 | if w == self.lgthClearanceHeight: DepthOpDlg.SetPictureByName(self, "drill clearance height" if self.drill_pictures else "clearance height") 58 | elif w == self.lgthRapidDownToHeight: DepthOpDlg.SetPictureByName(self, "drill rapid down height" if self.drill_pictures else "rapid down height") 59 | elif w == self.lgthStartDepth: DepthOpDlg.SetPictureByName(self, "drill start depth" if self.drill_pictures else "start depth") 60 | elif w == self.lgthFinalDepth: DepthOpDlg.SetPictureByName(self, "drill final depth" if self.drill_pictures else "final depth") 61 | elif w == self.lgthStepDown: DepthOpDlg.SetPictureByName(self, "drill step down" if self.drill_pictures else "step down") 62 | elif w == self.lgthZFinishDepth: DepthOpDlg.SetPictureByName(self, "drill z finish depth" if self.drill_pictures else "z finish depth") 63 | elif w == self.lgthZThruDepth: DepthOpDlg.SetPictureByName(self, "drill z thru depth" if self.drill_pictures else "z thru depth") 64 | 65 | else: SpeedOpDlg.SetPictureByWindow(self, w) 66 | 67 | def SetPictureByName(self, name): 68 | self.SetPictureByNameAndFolder(name, 'depthop') 69 | -------------------------------------------------------------------------------- /Heeks2.py: -------------------------------------------------------------------------------- 1 | from CamApp import CamApp 2 | app = CamApp() 3 | app.MainLoop() 4 | -------------------------------------------------------------------------------- /HeeksCNC2.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Exec=/usr/bin/heeksCNC2.sh 4 | Icon=HeeksCNC2 5 | Terminal=false 6 | Name=HeeksCNC2 7 | GenericName=HeeksCNC2 8 | Comment=CAD-CAM Software using wxPython 9 | Categories=Graphics;Engineering;3DGraphics; 10 | -------------------------------------------------------------------------------- /Machine.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | class Machine: 4 | def __init__(self): 5 | 6 | self.post = "" 7 | self.reader = "" 8 | self.suffix = "" 9 | self.description = "" 10 | -------------------------------------------------------------------------------- /OpDlg.py: -------------------------------------------------------------------------------- 1 | from HeeksObjDlg import HeeksObjDlg 2 | from HDialog import HTypeObjectDropDown 3 | from HDialog import HControl 4 | import wx 5 | import Tool 6 | import Pattern 7 | import Surface 8 | 9 | def GetToolNumber(object): 10 | return object.tool_number 11 | 12 | class OpDlg(HeeksObjDlg): 13 | def __init__(self, op, title = "", want_tool_control = True, picture = True): 14 | self.want_tool_control = want_tool_control 15 | HeeksObjDlg.__init__(self, op, title, picture) 16 | 17 | def AddLeftControls(self): 18 | self.cmbTool = None 19 | if self.want_tool_control: 20 | self.cmbTool = HTypeObjectDropDown(self, Tool.type, wx.GetApp().program.tools, self.OnComboOrCheck, GetToolNumber) 21 | self.MakeLabelAndControl('Tool', self.cmbTool).AddToSizer(self.sizerLeft) 22 | 23 | self.cmbPattern = HTypeObjectDropDown(self, Pattern.type, wx.GetApp().program.patterns, self.OnComboOrCheck) 24 | self.MakeLabelAndControl('Pattern', self.cmbPattern).AddToSizer(self.sizerLeft) 25 | self.cmbSurface = HTypeObjectDropDown(self, Surface.type, wx.GetApp().program.surfaces, self.OnComboOrCheck) 26 | self.MakeLabelAndControl('Surface', self.cmbSurface).AddToSizer(self.sizerLeft) 27 | 28 | HeeksObjDlg.AddLeftControls(self) 29 | 30 | def AddRightControls(self): 31 | self.txtComment = wx.TextCtrl(self, wx.ID_ANY) 32 | self.MakeLabelAndControl('Comment', self.txtComment).AddToSizer(self.sizerRight) 33 | self.chkActive = wx.CheckBox(self, wx.ID_ANY, 'Active') 34 | HControl(wx.ALL, self.chkActive).AddToSizer(self.sizerRight) 35 | self.txtTitle = wx.TextCtrl(self, wx.ID_ANY) 36 | self.MakeLabelAndControl('Title', self.txtTitle).AddToSizer(self.sizerRight) 37 | 38 | HeeksObjDlg.AddRightControls(self) 39 | 40 | def SetDefaultFocus(self): 41 | if self.cmbTool: self.cmbTool.SetFocus() 42 | else: self.cmbPattern.SetFocus() 43 | 44 | def GetDataRaw(self): 45 | self.object.comment = self.txtComment.GetValue() 46 | self.object.active = self.chkActive.GetValue() 47 | self.object.title = self.txtTitle.GetValue() 48 | if self.object.title != self.object.GetTitle(): 49 | self.object.title_made_from_id = False 50 | if self.cmbTool: 51 | self.object.tool_number = self.cmbTool.GetSelectedId() 52 | else: 53 | self.object.tool_number = 0 54 | self.object.pattern = self.cmbPattern.GetSelectedId() 55 | self.object.surface = self.cmbSurface.GetSelectedId() 56 | HeeksObjDlg.GetDataRaw(self) 57 | 58 | def SetFromDataRaw(self): 59 | self.txtComment.SetValue(self.object.comment) 60 | self.chkActive.SetValue(self.object.active) 61 | self.txtTitle.SetValue(self.object.GetTitle()) 62 | if self.cmbTool: 63 | self.cmbTool.SelectById(self.object.tool_number) 64 | self.cmbPattern.SelectById(self.object.pattern) 65 | self.cmbSurface.SelectById(self.object.surface) 66 | HeeksObjDlg.SetFromDataRaw(self) 67 | 68 | def SetPictureByName(self, name): 69 | self.SetPictureByNameAndFolder(name, "op") 70 | 71 | def SetPictureByNameAndFolder(self, name, folder): 72 | if self.picture: 73 | self.picture.SetPicture(wx.GetApp().cam_dir + '/bitmaps/' + folder + '/' + name + '.png') 74 | 75 | def SetPictureByWindow(self, w): 76 | if w == self.cmbPattern: 77 | pattern_id = self.cmbPattern.GetSelectedId() 78 | if pattern_id != 0: 79 | # PatternDlg.RedrawBitmap(self.picture.bitmap, cad.GetIDObject(PatternType, pattern_id))) 80 | self.picture.Refresh() 81 | else: 82 | self.SetPictureByName('general') 83 | elif w == self.cmbSurface:self.SetPictureByNameAndFolder('general', 'surface') 84 | else: 85 | self.SetPictureByName('general') -------------------------------------------------------------------------------- /Operations.py: -------------------------------------------------------------------------------- 1 | from CamObject import CamObject 2 | from Profile import Profile 3 | from Pocket import Pocket 4 | 5 | type = 0 6 | 7 | class Operations(CamObject): 8 | def __init__(self): 9 | CamObject.__init__(self) 10 | 11 | def TypeName(self): 12 | return "Operations" 13 | 14 | def GetType(self): 15 | return type 16 | 17 | def icon(self): 18 | # the name of the PNG file in the HeeksCNC icons folder 19 | return "operations" 20 | 21 | def UsesID(self): 22 | return False 23 | 24 | def CanBeDeleted(self): 25 | return False 26 | 27 | def AutoExpand(self): 28 | return True 29 | 30 | def OneOfAKind(self): 31 | return True 32 | 33 | def MakeACopy(self): 34 | object = Operations() 35 | object.CopyFrom(self) 36 | return object 37 | 38 | def CallsObjListReadXml(self): 39 | return True 40 | -------------------------------------------------------------------------------- /Pattern.py: -------------------------------------------------------------------------------- 1 | from CamObject import CamObject 2 | import geom 3 | import cad 4 | 5 | type = 0 6 | 7 | class Pattern(CamObject): 8 | def __init__(self): 9 | CamObject.__init__(self, id_named = True) 10 | self.copies1 = 1 11 | self.x_shift1 = 10.0 12 | self.y_shift1 = 0.0 13 | self.copies2 = 1 14 | self.x_shift2 = 10.0 15 | self.y_shift2 = 0.0 16 | 17 | def GetType(self): 18 | return type 19 | 20 | def TypeName(self): 21 | return "Pattern" 22 | 23 | def icon(self): 24 | # the name of the PNG file in the HeeksCNC icons folder 25 | return "pattern" 26 | 27 | def HasEdit(self): 28 | return True 29 | 30 | def Edit(self): 31 | from PatternDlg import PatternDlg 32 | import wx 33 | dlg = PatternDlg(self) 34 | if dlg.ShowModal() == wx.ID_OK: 35 | dlg.GetData() 36 | return True 37 | return False 38 | 39 | def MakeACopy(self): 40 | copy = Pattern() 41 | copy.CopyFrom(self) 42 | return copy 43 | 44 | def CopyFrom(self, object): 45 | CamObject.CopyFrom(self, object) 46 | self.copies1 = object.copies1 47 | self.x_shift1 = object.x_shift1 48 | self.y_shift1 = object.y_shift1 49 | self.copies2 = object.copies2 50 | self.x_shift2 = object.x_shift2 51 | self.y_shift2 = object.y_shift2 52 | 53 | def WriteXml(self): 54 | cad.SetXmlValue('copies1', self.copies1) 55 | cad.SetXmlValue('x_shift1', self.x_shift1) 56 | cad.SetXmlValue('y_shift1', self.y_shift1) 57 | cad.SetXmlValue('copies2', self.copies2) 58 | cad.SetXmlValue('x_shift2', self.x_shift2) 59 | cad.SetXmlValue('y_shift2', self.y_shift2) 60 | CamObject.WriteXml(self) 61 | 62 | def ReadXml(self): 63 | self.copies1 = cad.GetXmlInt('copies1', self.copies1) 64 | self.x_shift1 = cad.GetXmlFloat('x_shift1', self.x_shift1) 65 | self.y_shift1 = cad.GetXmlFloat('y_shift1', self.y_shift1) 66 | self.copies2 = cad.GetXmlInt('copies2', self.copies2) 67 | self.x_shift2 = cad.GetXmlFloat('x_shift2', self.x_shift2) 68 | self.y_shift2 = cad.GetXmlFloat('y_shift2', self.y_shift2) 69 | CamObject.ReadXml(self) 70 | 71 | def GetMatrices(self, matrices): 72 | m2 = geom.Matrix() 73 | shift_m2 = geom.Matrix() 74 | shift_m2.Translate(geom.Point3D(self.x_shift2, self.y_shift2, 0.0)) 75 | shift_m1 = geom.Matrix() 76 | shift_m1.Translate(geom.Point3D(self.x_shift1, self.y_shift1, 0.0)) 77 | 78 | for j in range( 0, self.copies2): 79 | m = geom.Matrix(m2) 80 | for i in range(0, self.copies1): 81 | matrices.append(m) 82 | m = m * shift_m1 83 | m2 = m2 * shift_m2 84 | -------------------------------------------------------------------------------- /Patterns.py: -------------------------------------------------------------------------------- 1 | from CamObject import CamObject 2 | 3 | type = 0 4 | 5 | class Patterns(CamObject): 6 | def __init__(self): 7 | CamObject.__init__(self) 8 | 9 | def TypeName(self): 10 | return "Patterns" 11 | 12 | def GetType(self): 13 | return type 14 | 15 | def icon(self): 16 | # the name of the PNG file in the HeeksCNC icons folder 17 | return "patterns" 18 | 19 | def UsesID(self): 20 | return False 21 | 22 | def CanBeDeleted(self): 23 | return False 24 | 25 | def OneOfAKind(self): 26 | return True 27 | 28 | def MakeACopy(self): 29 | object = Patterns() 30 | object.CopyFrom(self) 31 | return object 32 | 33 | def CallsObjListReadXml(self): 34 | return True 35 | -------------------------------------------------------------------------------- /PopupMenu.py: -------------------------------------------------------------------------------- 1 | import HeeksCNC 2 | 3 | class PopupMenu: 4 | def __init__(self): 5 | if HeeksCNC.widgets == HeeksCNC.WIDGETS_WX: 6 | import wx 7 | self.menu = wx.Menu() 8 | self.functions = dict() 9 | self.next_id = 1 10 | 11 | def AddItem(self, label, func): 12 | if HeeksCNC.widgets == HeeksCNC.WIDGETS_WX: 13 | import wx 14 | id = self.next_id 15 | self.next_id = self.next_id + 1 16 | item = self.menu.Append(id, label) 17 | self.functions[id] = func 18 | HeeksCNC.cad.frame.Bind(wx.EVT_MENU, self.OnPopupItemSelected, item) 19 | 20 | def OnPopupItemSelected(self, event): 21 | func = self.functions[event.GetId()] 22 | func() 23 | 24 | -------------------------------------------------------------------------------- /ProgramDlg.py: -------------------------------------------------------------------------------- 1 | import wx 2 | from Program import Program 3 | from HeeksObjDlg import HeeksObjDlg 4 | from HDialog import HControl 5 | 6 | class ProgramDlg(HeeksObjDlg): 7 | def __init__(self, object, title = "Program"): 8 | HeeksObjDlg.__init__(self, object, title, add_picture = False) 9 | 10 | def AddLeftControls(self): 11 | # add the controls in one column 12 | self.machines = self.object.GetMachines() 13 | choices = [] 14 | for machine in self.machines: 15 | choices.append(machine.description) 16 | self.cmbMachine = wx.ComboBox(self, choices = choices) 17 | self.MakeLabelAndControl('Machine', self.cmbMachine).AddToSizer(self.sizerLeft) 18 | 19 | self.chkOutputSame = wx.CheckBox( self, label = "output file name follows data file name" ) 20 | HControl(wx.ALL, self.chkOutputSame).AddToSizer(self.sizerLeft) 21 | self.Bind(wx.EVT_CHECKBOX, self.OnCheckOutputSame, self.chkOutputSame) 22 | 23 | self.txtOutputFile = wx.TextCtrl(self) 24 | self.lblOutputFile, self.btnOutputFile = self.AddFileNameControl(self.sizerLeft, "output file", self.txtOutputFile) 25 | 26 | self.cmbUnits = wx.ComboBox(self, choices = ["mm", "inch"]) 27 | self.MakeLabelAndControl('Units', self.cmbUnits).AddToSizer(self.sizerLeft) 28 | 29 | self.chkAddComments = wx.CheckBox(self, wx.ID_ANY, 'Add Comments') 30 | HControl(wx.ALL, self.chkAddComments).AddToSizer(self.sizerLeft) 31 | 32 | self.txtMaterial = wx.TextCtrl(self, wx.ID_ANY) 33 | self.MakeLabelAndControl('Material', self.txtMaterial).AddToSizer(self.sizerLeft) 34 | 35 | def SetDefaultFocus(self): 36 | self.cmbMachine.SetFocus() 37 | 38 | def EnableControls(self): 39 | output_same = self.chkOutputSame.GetValue() 40 | self.txtOutputFile.Enable(output_same == False) 41 | self.btnOutputFile.Enable(output_same == False) 42 | self.lblOutputFile.Enable(output_same == False) 43 | 44 | def OnCheckOutputSame(self, event): 45 | if self.ignore_event_functions: return 46 | self.EnableControls() 47 | 48 | def GetDataRaw(self): 49 | if self.cmbMachine.GetSelection() != wx.NOT_FOUND: 50 | self.object.machine = self.machines[self.cmbMachine.GetSelection()] 51 | 52 | self.object.output_file_name_follows_data_file_name = self.chkOutputSame.GetValue() 53 | self.object.output_file = self.txtOutputFile.GetValue() 54 | 55 | if self.cmbUnits.GetValue() == "inch": 56 | self.object.units = 25.4 57 | else: 58 | self.object.units = 1.0 59 | 60 | self.object.add_comments = self.chkAddComments.GetValue() 61 | self.object.material = self.txtMaterial.GetValue() 62 | 63 | def SetFromDataRaw(self): 64 | self.cmbMachine.SetValue(self.object.machine.description) 65 | 66 | self.chkOutputSame.SetValue(self.object.output_file_name_follows_data_file_name) 67 | 68 | self.txtOutputFile.SetValue(self.object.output_file) 69 | 70 | if self.object.units == 25.4: 71 | self.cmbUnits.SetValue("inch") 72 | else: 73 | self.cmbUnits.SetValue("mm") 74 | 75 | self.chkAddComments.SetValue(self.object.add_comments) 76 | self.txtMaterial.SetValue(self.object.material) 77 | -------------------------------------------------------------------------------- /ProgramWindow.py: -------------------------------------------------------------------------------- 1 | import wx 2 | 3 | class ProgramWindow(wx.ScrolledWindow): 4 | def __init__(self, parent): 5 | wx.ScrolledWindow.__init__(self, parent, name = 'Program', style = wx.HSCROLL + wx.VSCROLL + wx.NO_FULL_REPAINT_ON_RESIZE) 6 | self.textCtrl = wx.TextCtrl(self, 100, "", style = wx.TE_MULTILINE + wx.TE_DONTWRAP) 7 | self.textCtrl.SetMaxLength(0) # Ensure the length is as long as this operating system supports. (It may be only 32kb or 64kb) 8 | self.Bind(wx.EVT_SIZE, self.OnSize) 9 | self.Resize() 10 | 11 | def OnSize(self, event): 12 | self.Resize() 13 | event.Skip() 14 | 15 | def Resize(self): 16 | self.textCtrl.SetSize(self.GetClientSize()) 17 | 18 | def Clear(self): 19 | self.textCtrl.Clear() 20 | 21 | def AppendText(self, value): 22 | self.textCtrl.AppendText(str(value)) -------------------------------------------------------------------------------- /PyProcess.py: -------------------------------------------------------------------------------- 1 | import wx 2 | import HeeksCNC 3 | 4 | class NcWriter: 5 | def __init__(self): 6 | self.currentx = 0.0 7 | self.currenty = 0.0 8 | self.currentz = 0.0 9 | self.absolute_flag = True 10 | 11 | ############################################################################ 12 | ## Internals 13 | 14 | def on_parse_start(self, name): 15 | pass 16 | 17 | def on_parse_end(self): 18 | pass 19 | 20 | ############################################################################ 21 | ## send to cad 22 | 23 | def begin_ncblock(self): 24 | self.block = "" 25 | 26 | def end_ncblock(self): 27 | HeeksCNC.program.nccode.blocks.append(self.block) 28 | 29 | def add_text(self, s, col=None, cdata=False): 30 | self.block += s 31 | 32 | def set_mode(self, units=None): 33 | pass # to do 34 | 35 | def set_tool(self, number=None): 36 | pass # to do 37 | 38 | def begin_path(self, col=None): 39 | pass # to do 40 | 41 | def end_path(self): 42 | pass # to do 43 | 44 | def add_line(self, x=None, y=None, z=None, a=None, b=None, c=None): 45 | pass # to do 46 | 47 | def add_arc(self, x=None, y=None, z=None, i=None, j=None, k=None, r=None, d=None): 48 | pass # to do 49 | 50 | def incremental(self): 51 | pass # to do 52 | 53 | def absolute(self): 54 | pass # to do 55 | 56 | def HeeksPyPostProcess(include_backplot_processing): 57 | HeeksCNC.output_window.Clear() 58 | 59 | # write the python file 60 | standard_paths = wx.StandardPaths.Get() 61 | file_str = (standard_paths.GetTempDir() + "/post.py").replace('\\', '/') 62 | 63 | if write_python_file(file_str): 64 | # call the python file 65 | execfile(file_str) 66 | 67 | # backplot the file 68 | HeeksPyBackplot(HeeksCNC.program.GetOutputFileName()) 69 | return True 70 | else: 71 | wx.MessageBox("couldn't write " + file_str) 72 | return False 73 | 74 | def HeeksPyBackplot(filepath): 75 | HeeksCNC.output_window.Clear() 76 | HeeksCNC.program.nccode.blocks = [] 77 | 78 | machine_module = __import__('nc.' + HeeksCNC.program.machine.file_name + '_read', fromlist = ['dummy']) 79 | 80 | parser = machine_module.Parser() 81 | 82 | parser.writer = NcWriter() 83 | parser.Parse(filepath) 84 | 85 | HeeksCNC.program.nccode.SetTextCtrl(HeeksCNC.output_window.textCtrl) 86 | 87 | def write_python_file(python_file_path): 88 | f = open(python_file_path, "w") 89 | f.write(HeeksCNC.program.python_program) 90 | f.close() 91 | return True 92 | 93 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![PyCAM rpi](https://user-images.githubusercontent.com/901376/82529777-a4dff700-9b33-11ea-9a34-a2799123e0e9.png) 2 | # PyCAM 3 | Dan Heeks's experimental CAD/CAM software built on Dan's PyCAD for the Raspberry Pi, not to be confused with the more famous PyCAM ( http://pycam.sourceforge.net/ ). 4 | ### see wiki for building instructions ### 5 | [Raspberry Pi build](https://github.com/danheeks/PyCAM/wiki/Raspberry-Pi-build) 6 | ### Heeks2 ### 7 | If I get it all working, I'll be calling it Heeks2, but I don't plan to change the source code projects names 8 | 9 | I have made an automatic build for Ubuntu 22.04. 10 | https://code.launchpad.net/~danheeks/+recipe/cam-daily 11 | To install for Ubuntu 22.04 type in a terminal: 12 | ``` 13 | sudo add-apt-repository ppa:danheeks/ppa 14 | sudo apt-get install cam 15 | ``` 16 | 17 | you should then get a launch icon labelled HeeksCNC 18 | ( screenshot from Ubuntu to follow... ) 19 | -------------------------------------------------------------------------------- /ScriptOp.py: -------------------------------------------------------------------------------- 1 | from Operation import Operation 2 | import cad 3 | from nc.nc import * 4 | from Object import PyProperty 5 | 6 | type = 0 7 | 8 | class ScriptOp(Operation): 9 | def __init__(self): 10 | Operation.__init__(self) 11 | self.str = '' 12 | self.ReadDefaultValues() 13 | 14 | def WriteXml(self): 15 | cad.SetXmlValue('script', self.str) 16 | Operation.WriteXml(self) 17 | 18 | def ReadXml(self): 19 | self.str = cad.GetXmlValue('script') 20 | Operation.ReadXml(self) 21 | 22 | def TypeName(self): 23 | return "ScriptOp" 24 | 25 | def GetType(self): 26 | return type 27 | 28 | def op_icon(self): 29 | # the name of the PNG file in the HeeksCNC icons folder 30 | return "scriptop" 31 | 32 | def HasEdit(self): 33 | return True 34 | 35 | def Edit(self): 36 | import ScriptOpDlg 37 | res = ScriptOpDlg.Do(self) 38 | return res 39 | 40 | def MakeACopy(self): 41 | copy = ScriptOp() 42 | copy.CopyFrom(self) 43 | return copy 44 | 45 | def CopyFrom(self, object): 46 | Operation.CopyFrom(self, object) 47 | self.str = object.str 48 | 49 | def GetProperties(self): 50 | properties = [] 51 | properties.append(PyProperty('Script', 'str', self)) 52 | properties[-1].type = cad.PROPERTY_TYPE_LONG_STRING 53 | properties += Operation.GetProperties(self) 54 | return properties 55 | 56 | def DoGCodeCalls(self): 57 | exec(self.str, globals()) 58 | 59 | class PyMultiLineProperty(PyProperty): 60 | def __init__(self, title, value_name, object, num_lines, recalculate = None): 61 | PyProperty.__init__(self, title, value_name, object, recalculate) 62 | self.number_of_lines = number_of_lines 63 | 64 | def GetNumberOfLines(self): 65 | return self.number_of_lines 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /ScriptOpDlg.py: -------------------------------------------------------------------------------- 1 | from OpDlg import HeeksObjDlg 2 | from NiceTextCtrl import LengthCtrl 3 | from NiceTextCtrl import DoubleCtrl 4 | import wx 5 | import cad 6 | from HDialog import HControl 7 | from HDialog import ComboBoxBinded 8 | from HDialog import control_border 9 | from OpDlg import OpDlg 10 | import ScriptOp 11 | 12 | class ScriptOpDlg(OpDlg): 13 | def __init__(self, object, title = 'Script Operation'): 14 | OpDlg.__init__(self, object, title, False, False) 15 | 16 | def AddLeftControls(self): 17 | # add all the controls to the left side 18 | sizer_vertical = wx.BoxSizer(wx.VERTICAL) 19 | static_label = wx.StaticText(self, wx.ID_ANY, 'Script') 20 | sizer_vertical.Add(static_label, 0, wx.RIGHT | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, control_border) 21 | self.txtScript = wx.TextCtrl(self, wx.ID_ANY, '', wx.DefaultPosition, wx.Size(300, 200), wx.TE_MULTILINE | wx.TE_DONTWRAP | wx.TE_RICH | wx.TE_RICH2) 22 | sizer_vertical.Add(self.txtScript , 1, wx.LEFT | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, control_border ); 23 | HControl(wx.EXPAND | wx.ALL, sizer_vertical).AddToSizer(self.sizerLeft) 24 | OpDlg.AddLeftControls(self) 25 | 26 | def GetDataRaw(self): 27 | self.object.str = self.txtScript.GetValue() 28 | OpDlg.GetDataRaw(self) 29 | 30 | def SetFromDataRaw(self): 31 | self.txtScript.SetValue(self.object.str) 32 | OpDlg.SetFromDataRaw(self) 33 | 34 | def Do(object): 35 | dlg = ScriptOpDlg(object) 36 | result = dlg.ShowModal() 37 | if result == wx.ID_OK: 38 | dlg.GetData() 39 | return True 40 | return False 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Sim/PythonStuff.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | 4 | #include 5 | 6 | #ifdef WIN32 7 | 8 | #include "windows.h" 9 | #include 10 | #include 11 | 12 | #else 13 | #include 14 | #include 15 | #endif 16 | 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include "octree.hpp" 28 | #include "isosurface.hpp" 29 | #include "marching_cubes.hpp" 30 | #include "strconv.h" 31 | 32 | std::wstring sim_dir; 33 | 34 | CApp* theApp = NULL; 35 | 36 | void SetResPath(const std::wstring& dir) 37 | { 38 | sim_dir = dir; 39 | } 40 | 41 | void SetApp(CApp* app) 42 | { 43 | theApp = app; 44 | } 45 | 46 | BOOST_PYTHON_MODULE(sim) { 47 | boost::python::class_("Octree", boost::python::no_init) 48 | .def(boost::python::init()) 49 | .def("init", &Octree::init) 50 | .def("sum", static_cast< void (Octree::*)(const Volume* vol) >(&Octree::sum)) 51 | .def("diff", static_cast< void (Octree::*)(const Volume* vol) >(&Octree::diff)) 52 | .def("get_root_scale", &Octree::get_root_scale) 53 | .def("get_leaf_scale", &Octree::leaf_scale) 54 | ; 55 | 56 | boost::python::class_("GLVertex") 57 | .def(boost::python::init()) 58 | .def(boost::python::init()) 59 | .def_readwrite("x", &GLVertex::x) 60 | .def_readwrite("y", &GLVertex::y) 61 | .def_readwrite("z", &GLVertex::z) 62 | ; 63 | 64 | boost::python::class_("GLData") 65 | .def(boost::python::init()) 66 | .def("swap", &GLData::swap) 67 | .def("draw", &GLData::draw) 68 | ; 69 | 70 | boost::python::class_("IsoSurfaceAlgorithm", boost::python::no_init) 71 | .def("updateGL", static_cast< void (IsoSurfaceAlgorithm::*)(void) >(&IsoSurfaceAlgorithm::updateGL)) 72 | ; 73 | 74 | boost::python::class_>("MarchingCubes", boost::python::no_init) 75 | .def(boost::python::init()) 76 | ; 77 | 78 | boost::python::class_("Volume", boost::python::no_init) 79 | .def("setColor", &Volume::setColor) 80 | .def("Render", &Volume::Render) 81 | ; 82 | 83 | boost::python::class_>("SphereVolume") 84 | .def(boost::python::init()) 85 | .def("setRadius", &SphereVolume::setRadius) 86 | .def("setCenter", &SphereVolume::setCenter) 87 | ; 88 | 89 | boost::python::class_>("RectVolume", boost::python::no_init) 90 | .def(boost::python::init()) 91 | .def("calcBB", &RectVolume2::calcBB) 92 | ; 93 | 94 | boost::python::class_>("CylinderVolume") 95 | .def(boost::python::init()) 96 | .def("calcBB", &CylinderVolume::calcBB) 97 | .def("dist", &CylinderVolume::dist) 98 | .def("setRadius", &CylinderVolume::setRadius) 99 | .def("setLength", &CylinderVolume::setLength) 100 | .def("setCenter", &CylinderVolume::setCenter) 101 | .def("setRotationCenter", &CylinderVolume::setRotationCenter) 102 | .def("setAngle", &CylinderVolume::setAngle) 103 | .def("Render", &CylinderVolume::Render) 104 | ; 105 | 106 | 107 | boost::python::def("SetResPath", SetResPath); 108 | boost::python::def("SetApp", SetApp); 109 | } 110 | -------------------------------------------------------------------------------- /Sim/ReadMe.txt: -------------------------------------------------------------------------------- 1 | This is a C++ project to make a python module used in my PyCAM project. 2 | Base on Kasuyasu Hamada's version of Anders Wallin's cutsim, from https://github.com/KASUYASU/cutsim 3 | GPL3 license -------------------------------------------------------------------------------- /Sim/Sim.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{F64C7D00-D65A-4D8B-B6A9-02A70983C938}") = "Sim", "Sim.vcxproj", "{414E2428-299E-48F0-B117-AEA317571724}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {414E2428-299E-48F0-B117-AEA317571724}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {414E2428-299E-48F0-B117-AEA317571724}.Debug|Win32.Build.0 = Debug|Win32 16 | {414E2428-299E-48F0-B117-AEA317571724}.Release|Win32.ActiveCfg = Release|Win32 17 | {414E2428-299E-48F0-B117-AEA317571724}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Sim/bbox.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 Anders Wallin (anders.e.e.wallin "at" gmail.com) 3 | * Copyright 2015 Kazuyasu Hamada (k-hamada@gifu-u.ac.jp) 4 | * 5 | * This file is part of OpenCAMlib. 6 | * 7 | * OpenCAMlib is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * OpenCAMlib is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with OpenCAMlib. If not, see . 19 | */ 20 | 21 | #ifndef BBOX_H 22 | #define BBOX_H 23 | 24 | #include "glvertex.hpp" 25 | 26 | /// axis-aligned bounding-box, stores max and min x,y,z coordinates 27 | /// in points minpt and maxpt and provides methods for clearing ad setting these 28 | class Bbox { 29 | public: 30 | /// default ctor; 31 | Bbox(); 32 | /// create box 33 | Bbox(double minx, double maxx, double miny, double maxy, double minz, double maxz); 34 | virtual ~Bbox() {}; 35 | /// index into maxpt and minpt returning a vector 36 | /// [minx maxx miny maxy minz maxz] 37 | double operator[](const unsigned int idx) const; 38 | /// return true if Point p is inside this Bbox 39 | bool isInside(GLVertex& p) const; 40 | /// return true if *this overlaps Bbox b 41 | bool overlaps(const Bbox& other) const; 42 | 43 | /// reset the Bbox (sets initialized=false) 44 | void clear(); 45 | /// Add a Point to the Bbox. 46 | /// This enlarges the Bbox so that p is contained within it. 47 | void addPoint(const GLVertex& p); 48 | /// string output 49 | friend std::ostream &operator<<(std::ostream& stream, const Bbox b); 50 | //DATA 51 | /// the maximum point 52 | GLVertex maxpt; 53 | /// the minimum point 54 | GLVertex minpt; 55 | #ifdef MULTI_AXIS 56 | GLVertex centerpt; // the mean point of maxpt & minpt 57 | GLVertex armvec; // the vector from centerpt to maxpt 58 | GLVertex angle; // the angle of volume. 59 | #endif 60 | private: 61 | /// false until one Point or one Triangle has been added 62 | bool initialized; 63 | }; 64 | 65 | #endif 66 | // end file bbox.h 67 | -------------------------------------------------------------------------------- /Sim/cutsim_def.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Kazuyasu Hamada (k-hamada@gifu-u.ac.jp) 3 | */ 4 | 5 | #ifndef DEFINITION_H 6 | #define DEFINITION_H 7 | 8 | #define MULTI_AXIS 9 | #define CALC_TOLERANCE (1e-6) 10 | 11 | //#define SIGN (-1.0) 12 | #define SIGN_A (-1.0) 13 | #define SIGN_B (-1.0) 14 | #define SIGN_C (-1.0) 15 | 16 | #define TOLERANCE (1e-2) 17 | #define COLLISION_TOLERANCE (2e-2) 18 | 19 | #define POOL_NODE 20 | 21 | //#define WIRE_FRAME 22 | 23 | #define DEFAULT_SCENE_RADIUS (100) 24 | 25 | #define DEFAULT_CUBE_SIZE (100.0) 26 | #define DEFAULT_MAX_DEPTH (9) 27 | 28 | #define DEFAULT_STEP_SIZE (0.1) 29 | 30 | #define TOOL_BODY_COLOR 0.9, 0.9, 0.85 31 | #define TOOL_FLUTE_COLOR 0.7, 0.7, 0.65 32 | #define STOCK_COLOR 0,1,1 33 | // PARTS must be gray color. 34 | #define PARTS_COLOR 255, 255, 255 35 | #define CUTTING_COLOR 255, 255, 0 36 | #define COLLISION_COLOR 255, 0, 0 37 | 38 | #define DEFAULT_TRAVERSE_FEED_RATE (1000.0) 39 | #define DEFAULT_FEED_RATE (200.0) 40 | 41 | #define DEFAULT_HOLDER_RADIUS (15.0) 42 | #define DEFAULT_HOLDER_LENGTH (20.0) 43 | #define DEFAULT_HOLDER_COLOR 0.2, 0.2, 0.2 44 | 45 | #define DEFAULT_SPINDLE_RADIUS (11.0) 46 | #define DEFAULT_SPINDLE_LENGTH (35.0) 47 | #define DEFAULT_SPINDLE_COLOR 0.9, 0.9, 0.9 48 | 49 | #define DEFAULT_MAX_X_LIMIT (150) 50 | #define DEFAULT_MIN_X_LIMIT (-150) 51 | #define DEFAULT_MAX_Y_LIMIT (200) 52 | #define DEFAULT_MIN_Y_LIMIT (-200) 53 | #define DEFAULT_MAX_Z_LIMIT (150) 54 | #define DEFAULT_MIN_Z_LIMIT (0) 55 | #define DEFAULT_MAX_FEED_RATE (1500.0) 56 | #define DEFAULT_MAX_SPINDLE_POWER (150.0) 57 | 58 | #define DEFAULT_MAX_TOOL_SLOT (100) 59 | 60 | #define DEFAULT_SPECIFIC_CUTTING_FORCE (2000) 61 | 62 | #define DEFAULT_ANIMATE_INTERVAL (3) 63 | 64 | #endif // DEFINITION_H 65 | -------------------------------------------------------------------------------- /Sim/facet.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FACET_H 2 | #define FACET_H 3 | 4 | #include 5 | 6 | #include "glvertex.hpp" 7 | 8 | class Facet { 9 | 10 | public: 11 | Facet(GLVertex n, GLVertex p1, GLVertex p2, GLVertex p3) { normal = n; v1 = p1; v2 = p2; v3 = p3; } 12 | GLVertex normal; 13 | GLVertex v1, v2, v3; 14 | }; 15 | 16 | #endif // FACET_H 17 | 18 | -------------------------------------------------------------------------------- /Sim/isosurface.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2011 Anders Wallin (anders.e.e.wallin "at" gmail.com) 3 | * 4 | * This file is part of Cutsim / OpenCAMlib. 5 | * 6 | * OpenCAMlib is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * OpenCAMlib is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with OpenCAMlib. If not, see . 18 | */ 19 | 20 | #ifndef ISOSURFACE_H 21 | #define ISOSURFACE_H 22 | 23 | #include 24 | #include 25 | 26 | #include "gldata.hpp" 27 | #include "octree.hpp" 28 | #include "octnode.hpp" 29 | 30 | /// abstract base class for isosurface extraction algorithms 31 | /// 32 | /// isosurface algorithms produce vertices and polygons based on an Octree 33 | /// vertices and polygons are added to a GLData using addVertex, addPolygon, etc. 34 | /// 35 | class IsoSurfaceAlgorithm { 36 | public: 37 | /// create algorithm wich writes to given GLData and reads from given Octree 38 | IsoSurfaceAlgorithm(GLData* gl, Octree* tr) : g(gl), tree(tr) {} 39 | virtual ~IsoSurfaceAlgorithm() { } 40 | 41 | // return polygons corresponding to the octree node 42 | /// update GLData 43 | virtual void updateGL() { 44 | //update_calls=0; 45 | //valid_count=0; 46 | //debugValid(); 47 | updateGL( tree->root ); 48 | //debugValid(); 49 | 50 | //std::cout << update_calls << " calls made\n"; 51 | //std::cout << valid_count << " valid_nodes\n"; 52 | } 53 | protected: 54 | /// update the GLData for the given Octnode. re-implement in sub-class 55 | virtual void updateGL( Octnode* node) =0 ; 56 | /// when the given Octnode is deleted all associated GLData vertices are removed here. 57 | void remove_node_vertices(Octnode* current ) { 58 | while( !current->vertexSetEmpty() ) { 59 | unsigned int delId = current->vertexSetTop(); 60 | current->removeIndex( delId ); 61 | g->removeVertex( delId ); 62 | } 63 | assert( current->vertexSetEmpty() ); // when done, set should be empty 64 | } 65 | 66 | /// count the valid/invalid nodes, for debugging 67 | void debugValid() { 68 | std::vector nodelist; // = new std::vector(); 69 | tree->get_all_nodes( tree->root, nodelist); 70 | int val=0,inv=0; 71 | BOOST_FOREACH( Octnode* node , nodelist ) { 72 | if ( node->valid() ) 73 | val++; 74 | else 75 | inv++; 76 | } 77 | } 78 | 79 | // DATA 80 | /// how many updateGL calls were made? for debug 81 | int update_calls; 82 | /// how many valid nodes? for debug 83 | int valid_count; 84 | /// the GLData to which we udpate vertices/polygons 85 | GLData* g; 86 | /// the Octree which we traverse to update GLData 87 | Octree* tree; 88 | }; 89 | 90 | #endif 91 | // end file isosurface.hpp 92 | -------------------------------------------------------------------------------- /Sim/machine.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Kazuyasu Hamada (k-hamada@gifu-u.ac.jp) 3 | */ 4 | #include "stdafx.h" 5 | 6 | #include "machine.hpp" 7 | 8 | Machine::Machine() { 9 | max_x_limit = DEFAULT_MAX_X_LIMIT; 10 | min_x_limit = DEFAULT_MIN_X_LIMIT; 11 | max_y_limit = DEFAULT_MAX_Y_LIMIT; 12 | min_y_limit = DEFAULT_MIN_Y_LIMIT; 13 | max_z_limit = DEFAULT_MAX_Z_LIMIT; 14 | min_z_limit = DEFAULT_MIN_Z_LIMIT; 15 | z_limit_offset = 0.0; 16 | 17 | max_a_limit = min_a_limit = max_b_limit = min_b_limit= max_c_limit = min_c_limit = NAN; 18 | 19 | max_feed_rate = DEFAULT_MAX_FEED_RATE; 20 | 21 | traverse_feed_rate = DEFAULT_TRAVERSE_FEED_RATE; 22 | 23 | max_spindle_power = DEFAULT_MAX_SPINDLE_POWER; 24 | 25 | holderradius = DEFAULT_HOLDER_RADIUS; 26 | holderlength = DEFAULT_HOLDER_LENGTH; 27 | spindleradius = DEFAULT_SPINDLE_RADIUS; 28 | spindlelength = DEFAULT_SPINDLE_LENGTH; 29 | } 30 | 31 | void Machine::loadMachineSpec() { 32 | 33 | } 34 | #ifdef MULTI_AXIS 35 | int Machine::checkLimit(double x, double y, double z, double a, double b, double c) { 36 | int result = NO_LIMIT_ERROR; 37 | 38 | if (x > max_x_limit) result |= MAX_X_LIMIT; 39 | else if (x < min_x_limit) result |= MIN_X_LIMIT; 40 | if (y > max_y_limit) result |= MAX_Y_LIMIT; 41 | else if (y < min_y_limit) result |= MIN_Y_LIMIT; 42 | if (z > max_z_limit-z_limit_offset) result |= MAX_Z_LIMIT; 43 | else if (z < min_z_limit-z_limit_offset) result |= MIN_Z_LIMIT; 44 | if ((max_a_limit != NAN) && (a > max_a_limit)) result |= MAX_A_LIMIT; 45 | else if ((min_a_limit != NAN) && (a < min_a_limit)) result |= MIN_A_LIMIT; 46 | if ((max_b_limit != NAN) && (b > max_b_limit)) result |= MAX_B_LIMIT; 47 | else if ((min_b_limit != NAN) && (b < min_b_limit)) result |= MIN_B_LIMIT; 48 | if ((max_c_limit != NAN) && (c > max_c_limit)) result |= MAX_C_LIMIT; 49 | else if ((min_c_limit != NAN) && (c < min_c_limit)) result |= MIN_C_LIMIT; 50 | 51 | return result; 52 | } 53 | #else 54 | int Machine::checkLimit(double x, double y, double z) { 55 | int result = NO_LIMIT_ERROR; 56 | 57 | if (x > max_x_limit) result |= MAX_X_LIMIT; 58 | else if (x < min_x_limit) result |= MIN_X_LIMIT; 59 | if (y > max_y_limit) result |= MAX_Y_LIMIT; 60 | else if (y < min_y_limit) result |= MIN_Y_LIMIT; 61 | if (z > max_z_limit-z_limit_offset) result |= MAX_Z_LIMIT; 62 | else if (z < min_z_limit-z_limit_offset) result |= MIN_Z_LIMIT; 63 | 64 | return result; 65 | } 66 | #endif 67 | 68 | // end of file machine.cpp 69 | -------------------------------------------------------------------------------- /Sim/machine.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Kazuyasu Hamada (k-hamada@gifu-u.ac.jp) 3 | */ 4 | 5 | #ifndef MACHINE_H 6 | #define MACHINE_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | typedef enum { 16 | NO_LIMIT_ERROR = 0, 17 | MAX_X_LIMIT = 0x001, 18 | MIN_X_LIMIT = 0x002, 19 | MAX_Y_LIMIT = 0x004, 20 | MIN_Y_LIMIT = 0x008, 21 | MAX_Z_LIMIT = 0x010, 22 | MIN_Z_LIMIT = 0x020, 23 | MAX_A_LIMIT = 0x040, 24 | MIN_A_LIMIT = 0x080, 25 | MAX_B_LIMIT = 0x100, 26 | MIN_B_LIMIT = 0x200, 27 | MAX_C_LIMIT = 0x400, 28 | MIN_C_LIMIT = 0x800, 29 | } MACHINE_LIMIT; 30 | 31 | /// OpenGL widget for displaying 3D graphics 32 | class Machine { 33 | 34 | public: 35 | Machine(); 36 | void loadMachineSpec(); 37 | #ifdef MULTI_AXIS 38 | int checkLimit(double x, double y, double z, double a, double b, double c); 39 | #else 40 | int checkLimit(double x, double y, double z); 41 | #endif 42 | // private: 43 | double max_x_limit, min_x_limit; 44 | double max_y_limit, min_y_limit; 45 | double max_z_limit, min_z_limit; 46 | double max_a_limit, min_a_limit; 47 | double max_b_limit, min_b_limit; 48 | double max_c_limit, min_c_limit; 49 | double z_limit_offset; 50 | double max_feed_rate; 51 | double traverse_feed_rate; 52 | double max_spindle_power; 53 | 54 | double holderradius; 55 | double holderlength; 56 | double spindleradius; 57 | double spindlelength; 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /Sim/marching_cubes.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2011 Anders Wallin (anders.e.e.wallin "at" gmail.com) 3 | * 4 | * This file is part of OpenCAMlib. 5 | * 6 | * OpenCAMlib is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * OpenCAMlib is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with OpenCAMlib. If not, see . 18 | */ 19 | 20 | #ifndef MARCHING_CUBES_H 21 | #define MARCHING_CUBES_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #include "isosurface.hpp" 30 | #include "bbox.hpp" 31 | #include "octnode.hpp" 32 | #include "gldata.hpp" 33 | 34 | /// Marching-cubes isosurface extraction from distance field stored in Octree 35 | /// see http://en.wikipedia.org/wiki/Marching_cubes 36 | /// 37 | class MarchingCubes : public IsoSurfaceAlgorithm { 38 | public: 39 | /// create algorithm 40 | MarchingCubes(GLData* gl, Octree* tr) : IsoSurfaceAlgorithm(gl,tr) { 41 | g->setTriangles(); 42 | g->setPolygonModeFill(); 43 | } 44 | virtual ~MarchingCubes() { } 45 | protected: 46 | void updateGL(Octnode* node); 47 | void mc_node(Octnode* node); 48 | /// based on the f[] values, generate a list of interpolated vertices, all on the edges of the node. 49 | /// These vertices are later used for defining triangles. 50 | std::vector interpolated_vertices(const Octnode* node, unsigned int edges) ; 51 | GLVertex interpolate(const Octnode* node, int idx1, int idx2); 52 | // DATA 53 | /// get table-index based on the funcion values (positive or negative) at the corners 54 | unsigned int mc_edgeTableIndex(const Octnode* node); 55 | /// Marching-Cubes edge table 56 | static const unsigned int edgeTable[256]; 57 | /// Marching-Cubes triangle table 58 | static const int triTable[256][16]; 59 | }; 60 | 61 | #endif 62 | // end file marching_cubes.hpp 63 | -------------------------------------------------------------------------------- /Sim/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | 3 | #include "stdafx.h" 4 | 5 | // TODO: reference any additional headers you need in STDAFX.H 6 | // and not in this file 7 | -------------------------------------------------------------------------------- /Sim/stdafx.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifdef WIN32 4 | #include "windows.h" 5 | #endif 6 | 7 | extern "C" { 8 | #include 9 | #include 10 | } 11 | 12 | #include "geometry.h" 13 | #include "Point.h" 14 | #include "Box.h" 15 | #include "tinyxml.h" 16 | #include "IPoint.h" 17 | 18 | extern std::wstring sim_dir; 19 | #include "App.h" 20 | extern CApp* theApp; -------------------------------------------------------------------------------- /SketchOp.py: -------------------------------------------------------------------------------- 1 | from DepthOp import DepthOp 2 | import cad 3 | from Object import PyProperty 4 | 5 | class SketchOp(DepthOp): 6 | def __init__(self, sketch): 7 | DepthOp.__init__(self) 8 | self.sketch = sketch 9 | 10 | def CopyFrom(self, object): 11 | DepthOp.CopyFrom(self, object) 12 | self.sketch = object.sketch 13 | 14 | def WriteXml(self): 15 | cad.SetXmlValue('sketch', self.sketch) 16 | DepthOp.WriteXml(self) 17 | 18 | def ReadXml(self): 19 | self.sketch = cad.GetXmlInt('sketch') 20 | DepthOp.ReadXml(self) 21 | 22 | def GetProperties(self): 23 | properties = [] 24 | 25 | properties.append(PyProperty("Sketch", 'sketch', self)) 26 | 27 | properties += DepthOp.GetProperties(self) 28 | 29 | return properties 30 | 31 | def OnGlCommands(self, select, marked, no_color): 32 | if marked and not select: 33 | object = cad.GetObjectFromId(cad.OBJECT_TYPE_SKETCH, self.sketch) 34 | if object != None: 35 | cad.Material(cad.Color(255, 255, 0)).glMaterial(1.0) 36 | cad.DrawEnableLighting() 37 | #cad.DrawDisableDepthTesting() 38 | cad.DrawEnableCullFace() 39 | cad.Sketch.RenderAsExtrusion(object, self.start_depth, self.final_depth) 40 | cad.DrawDisableCullFace() 41 | #cad.DrawEnableDepthTesting() 42 | cad.DrawDisableLighting() 43 | 44 | def DoEachSketch(self, callback, data): 45 | # data is a tuple, whatever you want to pass on 46 | # callback gets called for each separate sketch 47 | 48 | object = cad.GetObjectFromId(cad.OBJECT_TYPE_SKETCH, self.sketch) 49 | 50 | if object != None: 51 | if object.GetType() == cad.OBJECT_TYPE_SKETCH: 52 | re_ordered_sketch = None 53 | sketch_order = object.GetSketchOrder() 54 | if sketch_order == cad.SketchOrderType.SketchOrderTypeBad: 55 | re_ordered_sketch = object.MakeACopy() 56 | re_ordered_sketch.ReOrderSketch(cad.SketchOrderType.SketchOrderTypeReOrder) 57 | object = re_ordered_sketch 58 | sketch_order = object.GetSketchOrder() 59 | if (sketch_order == cad.SketchOrderType.SketchOrderTypeMultipleCurves) or (sketch_order == cad.SketchOrderType.SketchOrderHasCircles): 60 | new_separate_sketches = object.Split() 61 | for one_curve_sketch in new_separate_sketches: 62 | callback(one_curve_sketch, data) 63 | else: 64 | callback(object, data) 65 | 66 | 67 | -------------------------------------------------------------------------------- /SketchOpDlg.py: -------------------------------------------------------------------------------- 1 | from DepthOpDlg import DepthOpDlg 2 | from HDialog import HTypeObjectDropDown 3 | import wx 4 | import cad 5 | from HDialog import ComboBoxBinded 6 | 7 | class SketchOpDlg(DepthOpDlg): 8 | def __init__(self, object, title = 'Sketch Operation'): 9 | DepthOpDlg.__init__(self, object, False, title) 10 | 11 | def AddLeftControls(self): 12 | self.cmbSketch = HTypeObjectDropDown(self, cad.OBJECT_TYPE_SKETCH, cad.GetApp(), self.OnSketchCombo) 13 | self.btnSketchPick = wx.Button(self, wx.ID_ANY, 'Pick') 14 | self.MakeLabelAndControl('Sketches', self.cmbSketch, self.btnSketchPick).AddToSizer(self.sizerLeft) 15 | self.btnSketchPick.Bind(wx.EVT_BUTTON, self.OnSketchPick ) 16 | 17 | DepthOpDlg.AddLeftControls(self) 18 | 19 | def SetDefaultFocus(self): 20 | self.cmbSketch.SetFocus() 21 | 22 | def GetDataRaw(self): 23 | self.object.sketch = self.cmbSketch.GetSelectedId() 24 | DepthOpDlg.GetDataRaw(self) 25 | 26 | def SetFromDataRaw(self): 27 | self.cmbSketch.SelectById(self.object.sketch) 28 | DepthOpDlg.SetFromDataRaw(self) 29 | 30 | def OnSketchPick(self, event): 31 | self.EndModal(self.btnSketchPick.GetId()) 32 | 33 | def PickSketch(self): 34 | cad.ClearSelection() 35 | wx.GetApp().PickObjects('Pick a sketch', cad.OBJECT_TYPE_SKETCH, True) 36 | 37 | self.cmbSketch.Recreate() 38 | self.Fit() 39 | 40 | id = 0 41 | if cad.GetNumSelected() > 0: id = cad.GetSelectedObjects()[0].GetID() 42 | self.cmbSketch.SelectById(id) 43 | 44 | def OnSketchCombo(self, event): 45 | print('SketchOpDlg.OnSketchCombo') 46 | -------------------------------------------------------------------------------- /Solid Examples/ballplatestock.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/Solid Examples/ballplatestock.stl -------------------------------------------------------------------------------- /Solid Examples/cutsphere.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/Solid Examples/cutsphere.stl -------------------------------------------------------------------------------- /SolidsDlg.py: -------------------------------------------------------------------------------- 1 | from HeeksObjDlg import HeeksObjDlg 2 | from NiceTextCtrl import ObjectIdsCtrl 3 | import wx 4 | import cad 5 | 6 | class SolidsDlg(HeeksObjDlg): 7 | def __init__(self, object, title, add_picture = True): 8 | HeeksObjDlg.__init__(self, object, title, add_picture) 9 | 10 | def AddLeftControls(self): 11 | self.idsSolids = ObjectIdsCtrl(self) 12 | self.btnSolidsPick = wx.Button(self, wx.ID_ANY, 'Pick') 13 | self.MakeLabelAndControl('Solids', self.idsSolids, self.btnSolidsPick).AddToSizer(self.sizerLeft) 14 | self.Bind(wx.EVT_BUTTON, self.OnSolidsPick, self.btnSolidsPick) 15 | 16 | HeeksObjDlg.AddLeftControls(self) 17 | 18 | def SetDefaultFocus(self): 19 | self.idsSolids.SetFocus() 20 | 21 | def GetDataRaw(self): 22 | self.object.solids = self.idsSolids.GetIdList() 23 | HeeksObjDlg.GetDataRaw(self) 24 | 25 | def SetFromDataRaw(self): 26 | self.idsSolids.SetFromIdList(self.object.solids) 27 | HeeksObjDlg.SetFromDataRaw(self) 28 | 29 | def OnSolidsPick(self, event): 30 | self.EndModal(self.btnSolidsPick.GetId()) 31 | 32 | def PickSolids(self): 33 | cad.ClearSelection(True) 34 | filter = cad.Filter() 35 | filter.AddType(cad.OBJECT_TYPE_STL_SOLID) 36 | if wx.GetApp().IsSolidApp(): 37 | import step 38 | filter.AddType(step.GetSolidType()) 39 | wx.GetApp().PickObjects('Pick solids', filter, False) 40 | 41 | solids = [] 42 | for object in cad.GetSelectedObjects(): 43 | if object.GetIDGroupType() == cad.OBJECT_TYPE_STL_SOLID: 44 | solids.append(object.GetID()) 45 | 46 | self.idsSolids.SetFromIdList(solids) 47 | self.Fit() 48 | -------------------------------------------------------------------------------- /SpeedOp.py: -------------------------------------------------------------------------------- 1 | from Operation import Operation 2 | from HeeksConfig import HeeksConfig 3 | import cad 4 | from nc.nc import * 5 | import wx 6 | from Object import PyProperty 7 | from Object import PyPropertyLength 8 | 9 | ABS_MODE_ABSOLUTE = 1 10 | ABS_MODE_INCREMENTAL = 2 11 | 12 | class SpeedOp(Operation): 13 | def __init__(self): 14 | Operation.__init__(self) 15 | self.horizontal_feed_rate = 200.0 16 | self.vertical_feed_rate = 50.0 17 | self.spindle_speed = 7000.0 18 | 19 | def ReadDefaultValues(self): 20 | Operation.ReadDefaultValues(self) 21 | config = HeeksConfig() 22 | self.horizontal_feed_rate = config.ReadFloat("SpeedOpHFeedrate", 200.0) 23 | self.vertical_feed_rate = config.ReadFloat("SpeedOpVFeedrate", 50.0) 24 | self.spindle_speed = config.ReadFloat("SpeedOpSpindleSpeed", 7000.0) 25 | 26 | def WriteDefaultValues(self): 27 | Operation.WriteDefaultValues(self) 28 | config = HeeksConfig() 29 | config.WriteFloat("SpeedOpHFeedrate", self.horizontal_feed_rate) 30 | config.WriteFloat("SpeedOpVFeedrate", self.vertical_feed_rate) 31 | config.WriteFloat("SpeedOpSpindleSpeed", self.spindle_speed) 32 | 33 | def AppendTextToProgram(self): 34 | Operation.AppendTextToProgram(self) 35 | 36 | if self.spindle_speed != 0.0: 37 | wx.GetApp().program.python_program += "spindle(" + str(self.spindle_speed) + ")\n" 38 | 39 | wx.GetApp().program.python_program += "feedrate_hv(" + str(self.horizontal_feed_rate / wx.GetApp().program.units) + ", " 40 | wx.GetApp().program.python_program += str(self.vertical_feed_rate / wx.GetApp().program.units) + ")\n" 41 | wx.GetApp().program.python_program += "flush_nc()\n" 42 | 43 | def CopyFrom(self, object): 44 | Operation.CopyFrom(self, object) 45 | self.horizontal_feed_rate = object.horizontal_feed_rate 46 | self.vertical_feed_rate = object.vertical_feed_rate 47 | self.spindle_speed = object.spindle_speed 48 | 49 | def WriteXml(self): 50 | cad.BeginXmlChild('speedop') 51 | cad.SetXmlValue('hfeed', self.horizontal_feed_rate) 52 | cad.SetXmlValue('vfeed', self.vertical_feed_rate) 53 | cad.SetXmlValue('spin', self.spindle_speed) 54 | cad.EndXmlChild() 55 | Operation.WriteXml(self) 56 | 57 | def ReadXml(self): 58 | child_element = cad.GetFirstXmlChild() 59 | while child_element != None: 60 | if child_element == 'speedop': 61 | self.horizontal_feed_rate = cad.GetXmlFloat('hfeed', self.horizontal_feed_rate) 62 | self.vertical_feed_rate = cad.GetXmlFloat('vfeed', self.vertical_feed_rate) 63 | self.spindle_speed = cad.GetXmlFloat('spin', self.spindle_speed) 64 | child_element = cad.GetNextXmlChild() 65 | Operation.ReadXml(self) 66 | 67 | def GetProperties(self): 68 | properties = [] 69 | 70 | properties.append(PyPropertyLength("Horizontal Feed Rate", 'horizontal_feed_rate', self)) 71 | properties.append(PyPropertyLength("Vertical Feed Rate", 'vertical_feed_rate', self)) 72 | properties.append(PyProperty("Spindle Speed", 'spindle_speed', self)) 73 | 74 | properties += Operation.GetProperties(self) 75 | 76 | return properties 77 | 78 | def DoGCodeCalls(self): 79 | Operation.DoGCodeCalls(self) 80 | if self.spindle_speed != 0: 81 | spindle(self.spindle_speed) 82 | feedrate_hv(self.horizontal_feed_rate / wx.GetApp().program.units, self.vertical_feed_rate / wx.GetApp().program.units) 83 | flush_nc() 84 | -------------------------------------------------------------------------------- /SpeedOpDlg.py: -------------------------------------------------------------------------------- 1 | from OpDlg import OpDlg 2 | from NiceTextCtrl import LengthCtrl 3 | from NiceTextCtrl import DoubleCtrl 4 | 5 | class SpeedOpDlg(OpDlg): 6 | def __init__(self, object, controls_on_left, title): 7 | self.controls_on_left = controls_on_left 8 | OpDlg.__init__(self, object, title) 9 | 10 | def AddControls(self, sizer): 11 | self.lgthHFeed = LengthCtrl(self) 12 | self.MakeLabelAndControl('Horizontal Feedrate', self.lgthHFeed).AddToSizer(sizer) 13 | self.lgthVFeed = LengthCtrl(self) 14 | self.MakeLabelAndControl('Vertical Feedrate', self.lgthVFeed).AddToSizer(sizer) 15 | self.dblSpindleSpeed = DoubleCtrl(self) 16 | self.MakeLabelAndControl('Spindle Speed', self.dblSpindleSpeed).AddToSizer(sizer) 17 | 18 | def AddLeftControls(self): 19 | if self.controls_on_left: 20 | self.AddControls(self.sizerLeft) 21 | OpDlg.AddLeftControls(self) 22 | 23 | def AddRightControls(self): 24 | if not self.controls_on_left: 25 | self.AddControls(self.sizerRight) 26 | OpDlg.AddRightControls(self) 27 | 28 | def SetDefaultFocus(self): 29 | self.cmbTool.SetFocus() 30 | 31 | def GetDataRaw(self): 32 | self.object.horizontal_feed_rate = self.lgthHFeed.GetValue() 33 | self.object.vertical_feed_rate = self.lgthVFeed.GetValue() 34 | self.object.spindle_speed = self.dblSpindleSpeed.GetValue() 35 | 36 | OpDlg.GetDataRaw(self) 37 | 38 | def SetFromDataRaw(self): 39 | self.lgthHFeed.SetValue(self.object.horizontal_feed_rate) 40 | self.lgthVFeed.SetValue(self.object.vertical_feed_rate) 41 | self.dblSpindleSpeed.SetValue(self.object.spindle_speed) 42 | 43 | OpDlg.SetFromDataRaw(self) 44 | -------------------------------------------------------------------------------- /Stock.py: -------------------------------------------------------------------------------- 1 | from CamObject import CamObject 2 | import geom 3 | import cad 4 | import Stocks 5 | 6 | type = 0 7 | 8 | class Stock(CamObject): 9 | def __init__(self): 10 | CamObject.__init__(self, id_named = True) 11 | self.solids = [] 12 | 13 | def GetType(self): 14 | return type 15 | 16 | def TypeName(self): 17 | return "Stock" 18 | 19 | def icon(self): 20 | # the name of the PNG file in the HeeksCNC icons folder 21 | return "stock" 22 | 23 | def HasEdit(self): 24 | return True 25 | 26 | def Edit(self): 27 | import StockDlg 28 | return StockDlg.Do(self) 29 | 30 | def MakeACopy(self): 31 | copy = Stock() 32 | copy.CopyFrom(self) 33 | return copy 34 | 35 | def CopyFrom(self, object): 36 | CamObject.CopyFrom(self, object) 37 | self.solids = [] 38 | self.solids += object.solids 39 | 40 | def CanAddTo(self, owner): 41 | return owner.GetType() == Stocks.type 42 | 43 | def PreferredPasteTarget(self): 44 | return wx.GetApp().program.stocks 45 | 46 | def GetBox(self): 47 | self.box = geom.Box3D() 48 | # return the box around all the solids 49 | for solid in self.solids: 50 | object = cad.GetObjectFromId(cad.OBJECT_TYPE_STL_SOLID, solid) 51 | if object: 52 | if object.GetVisible(): 53 | self.box.InsertBox(object.GetBox()) 54 | return self.box 55 | 56 | def GetBoxWithInvisibles(self): 57 | self.box = geom.Box3D() 58 | # return the box around all the solids 59 | for solid in self.solids: 60 | object = cad.GetObjectFromId(cad.OBJECT_TYPE_STL_SOLID, solid) 61 | if object: 62 | self.box.InsertBox(object.GetBox()) 63 | return self.box 64 | 65 | def WriteXml(self): 66 | for solid in self.solids: 67 | cad.BeginXmlChild('solid') 68 | cad.SetXmlValue('id', solid) 69 | cad.EndXmlChild() 70 | CamObject.WriteXml(self) 71 | 72 | def ReadXml(self): 73 | child_element = cad.GetFirstXmlChild() 74 | while child_element != None: 75 | if child_element == 'solid': 76 | solid = cad.GetXmlInt('id') 77 | self.solids.append(solid) 78 | child_element = cad.GetNextXmlChild() 79 | #CamObject.ReadXml(self) 80 | -------------------------------------------------------------------------------- /StockDlg.py: -------------------------------------------------------------------------------- 1 | import wx 2 | import cad 3 | import Stock 4 | from SolidsDlg import SolidsDlg 5 | 6 | class StockDlg(SolidsDlg): 7 | def __init__(self, object, title = 'Stock'): 8 | SolidsDlg.__init__(self, object, title) 9 | 10 | def SetPictureByName(self, name): 11 | self.SetPictureByNameAndFolder(name, 'stock') 12 | 13 | def SetPictureByNameAndFolder(self, name, folder): 14 | if self.picture: 15 | self.picture.SetPicture(wx.GetApp().cam_dir + '/bitmaps/' + folder + '/' + name + '.png') 16 | 17 | def Do(object): 18 | dlg = StockDlg(object) 19 | while True: 20 | result = dlg.ShowModal() 21 | if result == wx.ID_OK: 22 | dlg.GetData() 23 | return True 24 | elif result == dlg.btnSolidsPick.GetId(): 25 | dlg.PickSolids() 26 | else: 27 | return False 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Stocks.py: -------------------------------------------------------------------------------- 1 | from CamObject import CamObject 2 | 3 | type = 0 4 | 5 | class Stocks(CamObject): 6 | def __init__(self): 7 | CamObject.__init__(self) 8 | 9 | def GetType(self): 10 | return type 11 | 12 | def TypeName(self): 13 | return "Stocks" 14 | 15 | def icon(self): 16 | # the name of the PNG file in the HeeksCNC icons folder 17 | return "stocks" 18 | 19 | def UsesID(self): 20 | return False 21 | 22 | def CanBeDeleted(self): 23 | return False 24 | 25 | def OneOfAKind(self): 26 | return True 27 | 28 | def MakeACopy(self): 29 | object = Stocks() 30 | object.CopyFrom(self) 31 | return object 32 | 33 | def CallsObjListReadXml(self): 34 | return True 35 | 36 | def GetBoxWithInvisibles(self): 37 | import geom 38 | box = geom.Box3D() 39 | for stock in self.GetChildren(): 40 | b = stock.GetBoxWithInvisibles() 41 | if b: 42 | box.InsertBox(b) 43 | return box 44 | -------------------------------------------------------------------------------- /Surface.py: -------------------------------------------------------------------------------- 1 | from CamObject import CamObject 2 | import cad 3 | import geom 4 | import Surfaces 5 | import wx 6 | from HeeksConfig import HeeksConfig 7 | 8 | type = 0 9 | 10 | class Surface(CamObject): 11 | def __init__(self): 12 | CamObject.__init__(self, id_named = True) 13 | self.solids = [] 14 | self.tolerance = 0.0 15 | self.material_allowance = 0.0 16 | self.same_for_each_pattern_position = True 17 | 18 | def GetType(self): 19 | return type 20 | 21 | def TypeName(self): 22 | return "Surface" 23 | 24 | def icon(self): 25 | # the name of the PNG file in the HeeksCNC icons folder 26 | return "surface" 27 | 28 | def HasEdit(self): 29 | return True 30 | 31 | def Edit(self): 32 | import SurfaceDlg 33 | return SurfaceDlg.Do(self) 34 | 35 | def MakeACopy(self): 36 | copy = Surface() 37 | copy.CopyFrom(self) 38 | return copy 39 | 40 | def CopyFrom(self, object): 41 | self.tolerance = object.tolerance 42 | self.material_allowance = object.material_allowance 43 | self.same_for_each_pattern_position = object.same_for_each_pattern_position 44 | self.solids = [] 45 | self.solids += object.solids 46 | CamObject.CopyFrom(self, object) 47 | 48 | def CanAddTo(self, owner): 49 | return owner.GetType() == Surfaces.type 50 | 51 | def PreferredPasteTarget(self): 52 | return wx.GetApp().program.surfaces 53 | 54 | def GetBox(self): 55 | box = geom.Box3D() 56 | # return the box around all the solids 57 | for solid in self.solids: 58 | object = cad.GetObjectFromId(cad.OBJECT_TYPE_STL_SOLID, solid) 59 | if object: 60 | box.InsertBox(object.GetBox()) 61 | return box 62 | 63 | def WriteXml(self): 64 | cad.SetXmlValue('tolerance', self.tolerance) 65 | cad.SetXmlValue('material_allowance', self.material_allowance) 66 | cad.SetXmlValue('same_for_posns', self.same_for_each_pattern_position) 67 | 68 | for solid in self.solids: 69 | cad.BeginXmlChild('solid') 70 | cad.SetXmlValue('id', solid) 71 | cad.EndXmlChild() 72 | 73 | CamObject.WriteXml(self) 74 | 75 | def ReadXml(self): 76 | self.tolerance = cad.GetXmlFloat('tolerance', self.tolerance) 77 | self.material_allowance = cad.GetXmlFloat('material_allowance', self.material_allowance) 78 | self.same_for_each_pattern_position = cad.GetXmlBool('same_for_posns', self.same_for_each_pattern_position) 79 | 80 | child_element = cad.GetFirstXmlChild() 81 | while child_element != None: 82 | if child_element == 'solid': 83 | solid = cad.GetXmlInt('id') 84 | self.solids.append(solid) 85 | child_element = cad.GetNextXmlChild() 86 | CamObject.ReadXml(self) 87 | 88 | def ReadDefaultValues(self): 89 | config = HeeksConfig() 90 | self.tolerance = config.ReadFloat("SurfTol", 0.01) 91 | self.material_allowance = config.ReadFloat("MatAllow", 0) 92 | self.same_for_each_pattern_position = config.ReadBool("SameForEach", True) 93 | 94 | def WriteDefaultValues(self): 95 | config = HeeksConfig() 96 | config.WriteFloat("SurfTol", self.tolerance) 97 | config.WriteFloat("MatAllow", self.material_allowance) 98 | config.WriteBool("SameForEach", self.same_for_each_pattern_position) 99 | -------------------------------------------------------------------------------- /SurfaceDlg.py: -------------------------------------------------------------------------------- 1 | import wx 2 | import cad 3 | import Surface 4 | from SolidsDlg import SolidsDlg 5 | from NiceTextCtrl import LengthCtrl 6 | from HDialog import HControl 7 | 8 | class SurfaceDlg(SolidsDlg): 9 | def __init__(self, object, title = 'Surface'): 10 | SolidsDlg.__init__(self, object, title) 11 | 12 | def SetPictureByName(self, name): 13 | self.SetPictureByNameAndFolder(name, 'surface') 14 | 15 | def SetPictureByNameAndFolder(self, name, folder): 16 | if self.picture: 17 | self.picture.SetPicture(wx.GetApp().cam_dir + '/bitmaps/' + folder + '/' + name + '.png') 18 | 19 | def AddLeftControls(self): 20 | # add the controls in one column 21 | self.lgthTolerance = LengthCtrl(self) 22 | self.MakeLabelAndControl("Tolerance", self.lgthTolerance).AddToSizer(self.sizerLeft) 23 | self.lgthMaterialAllowance = LengthCtrl(self) 24 | self.MakeLabelAndControl("Material Allowance", self.lgthMaterialAllowance).AddToSizer(self.sizerLeft) 25 | self.chkSameForEachPosition = wx.CheckBox(self, wx.ID_ANY, 'Same for Each Pattern Position') 26 | HControl(wx.ALL, self.chkSameForEachPosition).AddToSizer(self.sizerLeft) 27 | SolidsDlg.AddLeftControls(self) 28 | 29 | def GetDataRaw(self): 30 | self.object.tolerance = self.lgthTolerance.GetValue() 31 | self.object.material_allowance = self.lgthMaterialAllowance.GetValue() 32 | self.object.same_for_each_pattern_position = self.chkSameForEachPosition.IsChecked() 33 | SolidsDlg.GetDataRaw(self) 34 | 35 | def SetFromDataRaw(self): 36 | self.lgthTolerance.SetValue(self.object.tolerance) 37 | self.lgthMaterialAllowance.SetValue(self.object.material_allowance) 38 | self.chkSameForEachPosition.SetValue(self.object.same_for_each_pattern_position) 39 | SolidsDlg.SetFromDataRaw(self) 40 | 41 | def Do(object): 42 | dlg = SurfaceDlg(object) 43 | while True: 44 | result = dlg.ShowModal() 45 | if result == wx.ID_OK: 46 | dlg.GetData() 47 | return True 48 | elif result == dlg.btnSolidsPick.GetId(): 49 | dlg.PickSolids() 50 | else: 51 | return False 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Surfaces.py: -------------------------------------------------------------------------------- 1 | from CamObject import CamObject 2 | 3 | type = 0 4 | 5 | class Surfaces(CamObject): 6 | def __init__(self): 7 | CamObject.__init__(self) 8 | 9 | def GetType(self): 10 | return type 11 | 12 | def TypeName(self): 13 | return "Surfaces" 14 | 15 | def icon(self): 16 | # the name of the PNG file in the HeeksCNC icons folder 17 | return "surfaces" 18 | 19 | def UsesID(self): 20 | return False 21 | 22 | def CanBeDeleted(self): 23 | return False 24 | 25 | def OneOfAKind(self): 26 | return True 27 | 28 | def MakeACopy(self): 29 | object = Surfaces() 30 | object.CopyFrom(self) 31 | return object 32 | 33 | def CallsObjListReadXml(self): 34 | return True 35 | -------------------------------------------------------------------------------- /Tag.py: -------------------------------------------------------------------------------- 1 | from CamObject import CamObject 2 | import geom 3 | from HeeksConfig import HeeksConfig 4 | import cad 5 | from Object import PyProperty 6 | from Object import PyPropertyLength 7 | 8 | type = 0 9 | 10 | class Tag(CamObject): 11 | def __init__(self): 12 | CamObject.__init__(self) 13 | self.pos = geom.Point(0,0) 14 | self.ReadDefaultValues() 15 | 16 | def GetType(self): 17 | return type 18 | 19 | def TypeName(self): 20 | return "Tag" 21 | 22 | def icon(self): 23 | # the name of the PNG file in the HeeksCNC icons folder 24 | return "tag" 25 | 26 | def UsesID(self): 27 | return False 28 | 29 | def MakeACopy(self): 30 | copy = Tag() 31 | copy.CopyFrom(self) 32 | return copy 33 | 34 | def CopyFrom(self, object): 35 | CamObject.CopyFrom(self, object) 36 | self.pos = object.pos 37 | self.width = object.width 38 | self.angle = object.angle 39 | self.height = object.height 40 | 41 | def WriteXml(self): 42 | cad.SetXmlValue('x', self.pos.x) 43 | cad.SetXmlValue('y', self.pos.y) 44 | cad.SetXmlValue('width', self.width) 45 | cad.SetXmlValue('angle', self.angle) 46 | cad.SetXmlValue('height', self.height) 47 | CamObject.WriteXml(self) 48 | 49 | def ReadXml(self): 50 | self.pos.x = cad.GetXmlFloat('x', self.pos.x) 51 | self.pos.y = cad.GetXmlFloat('y', self.pos.y) 52 | self.width = cad.GetXmlFloat('width', self.width) 53 | self.angle = cad.GetXmlFloat('angle', self.angle) 54 | self.height = cad.GetXmlFloat('height', self.height) 55 | CamObject.ReadXml(self) 56 | 57 | def ReadDefaultValues(self): 58 | config = HeeksConfig() 59 | self.width = config.ReadFloat("Width", 10.0) 60 | self.angle = config.ReadFloat("Angle", 45.0) 61 | self.height = config.ReadFloat("Height", 4.0) 62 | 63 | def WriteDefaultValues(self): 64 | config = HeeksConfig() 65 | config.WriteFloat("Width", self.width) 66 | config.WriteFloat("Angle", self.angle) 67 | config.WriteFloat("Height", self.height) 68 | 69 | def GetProperties(self): 70 | properties = [] 71 | 72 | properties.append(PyProperty("Position", 'pos', self)) 73 | properties.append(PyPropertyLength("Width", 'width', self)) 74 | properties.append(PyProperty("Angle", 'angle', self)) 75 | properties.append(PyPropertyLength("Height", 'height', self)) 76 | 77 | properties += CamObject.GetProperties(self) 78 | 79 | return properties 80 | 81 | def OnGlCommands(self, select, marked, no_color): 82 | if not no_color: cad.DrawColor(cad.Color(0,0,0)) 83 | cad.DrawSymbol(3 if marked else 0, self.pos.x, self.pos.y, 0.0) 84 | if not no_color: cad.DrawColor(cad.Color(0,255,0)) 85 | cad.DrawSymbol(1, self.pos.x, self.pos.y, 0.0) 86 | 87 | -------------------------------------------------------------------------------- /Tags.py: -------------------------------------------------------------------------------- 1 | from CamObject import CamObject 2 | 3 | type = 0 4 | 5 | class Tags(CamObject): 6 | def __init__(self): 7 | CamObject.__init__(self) 8 | 9 | def GetType(self): 10 | return type 11 | 12 | def TypeName(self): 13 | return "Tags" 14 | 15 | def icon(self): 16 | # the name of the PNG file in the HeeksCNC icons folder 17 | return "tags" 18 | 19 | def UsesID(self): 20 | return False 21 | 22 | def CanBeDeleted(self): 23 | return False 24 | 25 | def MakeACopy(self): 26 | copy = Tags() 27 | copy.CopyFrom(self) 28 | return copy 29 | 30 | def CallsObjListReadXml(self): 31 | return True 32 | -------------------------------------------------------------------------------- /Toolpath.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/Toolpath.py -------------------------------------------------------------------------------- /Tools.py: -------------------------------------------------------------------------------- 1 | from Tool import Tool 2 | from consts import * 3 | import cad 4 | from CamObject import CamObject 5 | import wx 6 | 7 | type = 0 8 | 9 | class Tools(CamObject): 10 | def __init__(self): 11 | CamObject.__init__(self) 12 | 13 | def TypeName(self): 14 | return "Tools" 15 | 16 | def GetType(self): 17 | return type 18 | 19 | def icon(self): 20 | # the name of the PNG file in the HeeksCNC icons folder 21 | return "tools" 22 | 23 | def CanBeDeleted(self): 24 | return False 25 | 26 | def OneOfAKind(self): 27 | return True 28 | 29 | def UsesID(self): 30 | return False 31 | 32 | def AddToPopupMenu(self, menu): 33 | menu.AddItem("save as default tools", self.OnSaveDefault) 34 | 35 | def OnSaveDefault(self): 36 | self.save_default() 37 | 38 | def save_default(self): 39 | import pickle 40 | f = open(wx.GetApp().cam_dir + "/default_tools.txt", "wb") 41 | for tool in self.children: 42 | pickle.dump(tool, f) 43 | f.close() 44 | 45 | def load_default(self): 46 | self.Clear() 47 | 48 | try: 49 | cad.OpenXmlFile(wx.GetApp().cam_dir + "/default.tooltable", self) 50 | except: 51 | # no default file found, add 2 tools 52 | cad.AddUndoably(Tool(diameter = 3.0, type = TOOL_TYPE_SLOTCUTTER, tool_number = 1), self, None) 53 | cad.AddUndoably(Tool(diameter = 6.0, type = TOOL_TYPE_SLOTCUTTER, tool_number = 2), self, None) 54 | return 55 | 56 | def MakeACopy(self): 57 | object = Tools() 58 | object.CopyFrom(self) 59 | return object 60 | 61 | def CallsObjListReadXml(self): 62 | return True 63 | 64 | def FindAllTools(self): 65 | tools = [] 66 | tools.append( (0, "No tool") ) 67 | for child in self.children: 68 | tools.append( (child.tool_number, child.name()) ) 69 | return tools 70 | 71 | def FindFirstTool(self, type): 72 | for child in self.GetChildren(): 73 | if child.type == type: 74 | return child 75 | return None 76 | 77 | def FindTool(self, tool_number): 78 | for child in self.children: 79 | if child.tool_number == tool_number: 80 | return child 81 | return None 82 | -------------------------------------------------------------------------------- /bitmaps/adapt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/adapt.png -------------------------------------------------------------------------------- /bitmaps/addtag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/addtag.png -------------------------------------------------------------------------------- /bitmaps/apply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/apply.png -------------------------------------------------------------------------------- /bitmaps/attach.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/attach.png -------------------------------------------------------------------------------- /bitmaps/ballmill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/ballmill.png -------------------------------------------------------------------------------- /bitmaps/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/cancel.png -------------------------------------------------------------------------------- /bitmaps/centredrill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/centredrill.png -------------------------------------------------------------------------------- /bitmaps/chamfmill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/chamfmill.png -------------------------------------------------------------------------------- /bitmaps/climb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/climb.png -------------------------------------------------------------------------------- /bitmaps/code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/code.png -------------------------------------------------------------------------------- /bitmaps/conventional.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/conventional.png -------------------------------------------------------------------------------- /bitmaps/cutting_rate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/cutting_rate.png -------------------------------------------------------------------------------- /bitmaps/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/delete.png -------------------------------------------------------------------------------- /bitmaps/depthop/clearance height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/clearance height.png -------------------------------------------------------------------------------- /bitmaps/depthop/drill clearance height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/drill clearance height.png -------------------------------------------------------------------------------- /bitmaps/depthop/drill final depth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/drill final depth.png -------------------------------------------------------------------------------- /bitmaps/depthop/drill rapid down height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/drill rapid down height.png -------------------------------------------------------------------------------- /bitmaps/depthop/drill start depth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/drill start depth.png -------------------------------------------------------------------------------- /bitmaps/depthop/drill step down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/drill step down.png -------------------------------------------------------------------------------- /bitmaps/depthop/drill z finish depth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/drill z finish depth.png -------------------------------------------------------------------------------- /bitmaps/depthop/drill z thru depth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/drill z thru depth.png -------------------------------------------------------------------------------- /bitmaps/depthop/final depth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/final depth.png -------------------------------------------------------------------------------- /bitmaps/depthop/rapid down height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/rapid down height.png -------------------------------------------------------------------------------- /bitmaps/depthop/start depth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/start depth.png -------------------------------------------------------------------------------- /bitmaps/depthop/step down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/step down.png -------------------------------------------------------------------------------- /bitmaps/depthop/z finish depth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/z finish depth.png -------------------------------------------------------------------------------- /bitmaps/depthop/z thru depth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/depthop/z thru depth.png -------------------------------------------------------------------------------- /bitmaps/dlgprofile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/dlgprofile.png -------------------------------------------------------------------------------- /bitmaps/drill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drill.png -------------------------------------------------------------------------------- /bitmaps/drilling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling.png -------------------------------------------------------------------------------- /bitmaps/drilling/clearance height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling/clearance height.png -------------------------------------------------------------------------------- /bitmaps/drilling/dont stop spindle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling/dont stop spindle.png -------------------------------------------------------------------------------- /bitmaps/drilling/dwell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling/dwell.png -------------------------------------------------------------------------------- /bitmaps/drilling/feed retract.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling/feed retract.png -------------------------------------------------------------------------------- /bitmaps/drilling/general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling/general.png -------------------------------------------------------------------------------- /bitmaps/drilling/internal coolant off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling/internal coolant off.png -------------------------------------------------------------------------------- /bitmaps/drilling/internal coolant on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling/internal coolant on.png -------------------------------------------------------------------------------- /bitmaps/drilling/rapid retract.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling/rapid retract.png -------------------------------------------------------------------------------- /bitmaps/drilling/rapid to clearance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling/rapid to clearance.png -------------------------------------------------------------------------------- /bitmaps/drilling/rapid to standoff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling/rapid to standoff.png -------------------------------------------------------------------------------- /bitmaps/drilling/stand off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling/stand off.png -------------------------------------------------------------------------------- /bitmaps/drilling/stop spindle at bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/drilling/stop spindle at bottom.png -------------------------------------------------------------------------------- /bitmaps/enddraw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/enddraw.png -------------------------------------------------------------------------------- /bitmaps/endmill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/endmill.png -------------------------------------------------------------------------------- /bitmaps/engraver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/engraver.png -------------------------------------------------------------------------------- /bitmaps/export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/export.png -------------------------------------------------------------------------------- /bitmaps/exptools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/exptools.png -------------------------------------------------------------------------------- /bitmaps/extrusion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/extrusion.png -------------------------------------------------------------------------------- /bitmaps/fixture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/fixture.png -------------------------------------------------------------------------------- /bitmaps/fixtures.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/fixtures.png -------------------------------------------------------------------------------- /bitmaps/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/help.png -------------------------------------------------------------------------------- /bitmaps/import.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/import.png -------------------------------------------------------------------------------- /bitmaps/imptools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/imptools.png -------------------------------------------------------------------------------- /bitmaps/knife.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/knife.png -------------------------------------------------------------------------------- /bitmaps/locating.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/locating.png -------------------------------------------------------------------------------- /bitmaps/magic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/magic.png -------------------------------------------------------------------------------- /bitmaps/opchamfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/opchamfer.png -------------------------------------------------------------------------------- /bitmaps/opcontour.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/opcontour.png -------------------------------------------------------------------------------- /bitmaps/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/open.png -------------------------------------------------------------------------------- /bitmaps/opennc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/opennc.png -------------------------------------------------------------------------------- /bitmaps/opprofile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/opprofile.png -------------------------------------------------------------------------------- /bitmaps/ops.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/ops.png -------------------------------------------------------------------------------- /bitmaps/optap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/optap.png -------------------------------------------------------------------------------- /bitmaps/optoolclear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/optoolclear.png -------------------------------------------------------------------------------- /bitmaps/output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/output.png -------------------------------------------------------------------------------- /bitmaps/outputgray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/outputgray.png -------------------------------------------------------------------------------- /bitmaps/pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pattern.png -------------------------------------------------------------------------------- /bitmaps/pattern/shape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pattern/shape.png -------------------------------------------------------------------------------- /bitmaps/pattern/shape2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pattern/shape2.png -------------------------------------------------------------------------------- /bitmaps/patterns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/patterns.png -------------------------------------------------------------------------------- /bitmaps/pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pdf.png -------------------------------------------------------------------------------- /bitmaps/pickend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pickend.png -------------------------------------------------------------------------------- /bitmaps/pickstart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pickstart.png -------------------------------------------------------------------------------- /bitmaps/pocket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket.png -------------------------------------------------------------------------------- /bitmaps/pocket/climb milling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket/climb milling.png -------------------------------------------------------------------------------- /bitmaps/pocket/conventional milling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket/conventional milling.png -------------------------------------------------------------------------------- /bitmaps/pocket/general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket/general.png -------------------------------------------------------------------------------- /bitmaps/pocket/material allowance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket/material allowance.png -------------------------------------------------------------------------------- /bitmaps/pocket/not tool down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket/not tool down.png -------------------------------------------------------------------------------- /bitmaps/pocket/starting boundary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket/starting boundary.png -------------------------------------------------------------------------------- /bitmaps/pocket/starting center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket/starting center.png -------------------------------------------------------------------------------- /bitmaps/pocket/step over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket/step over.png -------------------------------------------------------------------------------- /bitmaps/pocket/tool down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket/tool down.png -------------------------------------------------------------------------------- /bitmaps/pocket/use zig zag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket/use zig zag.png -------------------------------------------------------------------------------- /bitmaps/pocket/zig angle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket/zig angle.png -------------------------------------------------------------------------------- /bitmaps/pocket/zig unidirectional.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/pocket/zig unidirectional.png -------------------------------------------------------------------------------- /bitmaps/postprocess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/postprocess.png -------------------------------------------------------------------------------- /bitmaps/probe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/probe.png -------------------------------------------------------------------------------- /bitmaps/profile/do finishing pass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/do finishing pass.png -------------------------------------------------------------------------------- /bitmaps/profile/general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/general.png -------------------------------------------------------------------------------- /bitmaps/profile/no finishing pass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/no finishing pass.png -------------------------------------------------------------------------------- /bitmaps/profile/offset .png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/offset .png -------------------------------------------------------------------------------- /bitmaps/profile/offset extra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/offset extra.png -------------------------------------------------------------------------------- /bitmaps/profile/only finishing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/only finishing.png -------------------------------------------------------------------------------- /bitmaps/profile/roll radius.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/roll radius.png -------------------------------------------------------------------------------- /bitmaps/profile/side inside or right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/side inside or right.png -------------------------------------------------------------------------------- /bitmaps/profile/side inside.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/side inside.png -------------------------------------------------------------------------------- /bitmaps/profile/side left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/side left.png -------------------------------------------------------------------------------- /bitmaps/profile/side on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/side on.png -------------------------------------------------------------------------------- /bitmaps/profile/side outside or left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/side outside or left.png -------------------------------------------------------------------------------- /bitmaps/profile/side outside.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/side outside.png -------------------------------------------------------------------------------- /bitmaps/profile/side right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/profile/side right.png -------------------------------------------------------------------------------- /bitmaps/python.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/python.png -------------------------------------------------------------------------------- /bitmaps/raft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/raft.png -------------------------------------------------------------------------------- /bitmaps/rolloff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/rolloff.png -------------------------------------------------------------------------------- /bitmaps/rollon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/rollon.png -------------------------------------------------------------------------------- /bitmaps/runpython.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/runpython.png -------------------------------------------------------------------------------- /bitmaps/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/save.png -------------------------------------------------------------------------------- /bitmaps/savenc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/savenc.png -------------------------------------------------------------------------------- /bitmaps/scriptop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/scriptop.png -------------------------------------------------------------------------------- /bitmaps/selsketch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/selsketch.png -------------------------------------------------------------------------------- /bitmaps/selsolid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/selsolid.png -------------------------------------------------------------------------------- /bitmaps/setactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/setactive.png -------------------------------------------------------------------------------- /bitmaps/setinactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/setinactive.png -------------------------------------------------------------------------------- /bitmaps/slotdrill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/slotdrill.png -------------------------------------------------------------------------------- /bitmaps/speed_reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/speed_reference.png -------------------------------------------------------------------------------- /bitmaps/stock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/stock.png -------------------------------------------------------------------------------- /bitmaps/stock/general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/stock/general.png -------------------------------------------------------------------------------- /bitmaps/stocks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/stocks.png -------------------------------------------------------------------------------- /bitmaps/surface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/surface.png -------------------------------------------------------------------------------- /bitmaps/surface/different for each position.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/surface/different for each position.png -------------------------------------------------------------------------------- /bitmaps/surface/general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/surface/general.png -------------------------------------------------------------------------------- /bitmaps/surface/material allowance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/surface/material allowance.png -------------------------------------------------------------------------------- /bitmaps/surface/min z.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/surface/min z.png -------------------------------------------------------------------------------- /bitmaps/surface/same for each position.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/surface/same for each position.png -------------------------------------------------------------------------------- /bitmaps/surface/tolerance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/surface/tolerance.png -------------------------------------------------------------------------------- /bitmaps/surfaces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/surfaces.png -------------------------------------------------------------------------------- /bitmaps/tagpos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tagpos.png -------------------------------------------------------------------------------- /bitmaps/tap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tap.png -------------------------------------------------------------------------------- /bitmaps/tomachine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tomachine.png -------------------------------------------------------------------------------- /bitmaps/tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool.png -------------------------------------------------------------------------------- /bitmaps/tool/ball_mill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/ball_mill.png -------------------------------------------------------------------------------- /bitmaps/tool/ball_mill_corner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/ball_mill_corner.png -------------------------------------------------------------------------------- /bitmaps/tool/ball_mill_diameter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/ball_mill_diameter.png -------------------------------------------------------------------------------- /bitmaps/tool/ball_mill_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/ball_mill_height.png -------------------------------------------------------------------------------- /bitmaps/tool/ball_mill_offset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/ball_mill_offset.png -------------------------------------------------------------------------------- /bitmaps/tool/centre_drill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/centre_drill.png -------------------------------------------------------------------------------- /bitmaps/tool/centre_drill_angle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/centre_drill_angle.png -------------------------------------------------------------------------------- /bitmaps/tool/centre_drill_diameter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/centre_drill_diameter.png -------------------------------------------------------------------------------- /bitmaps/tool/centre_drill_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/centre_drill_height.png -------------------------------------------------------------------------------- /bitmaps/tool/centre_drill_offset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/centre_drill_offset.png -------------------------------------------------------------------------------- /bitmaps/tool/chamfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/chamfer.png -------------------------------------------------------------------------------- /bitmaps/tool/chamfer_angle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/chamfer_angle.png -------------------------------------------------------------------------------- /bitmaps/tool/chamfer_diameter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/chamfer_diameter.png -------------------------------------------------------------------------------- /bitmaps/tool/chamfer_flat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/chamfer_flat.png -------------------------------------------------------------------------------- /bitmaps/tool/chamfer_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/chamfer_height.png -------------------------------------------------------------------------------- /bitmaps/tool/chamfer_offset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/chamfer_offset.png -------------------------------------------------------------------------------- /bitmaps/tool/drill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/drill.png -------------------------------------------------------------------------------- /bitmaps/tool/drill_angle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/drill_angle.png -------------------------------------------------------------------------------- /bitmaps/tool/drill_diameter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/drill_diameter.png -------------------------------------------------------------------------------- /bitmaps/tool/drill_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/drill_height.png -------------------------------------------------------------------------------- /bitmaps/tool/drill_offset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/drill_offset.png -------------------------------------------------------------------------------- /bitmaps/tool/end_mill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/end_mill.png -------------------------------------------------------------------------------- /bitmaps/tool/end_mill_corner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/end_mill_corner.png -------------------------------------------------------------------------------- /bitmaps/tool/end_mill_diameter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/end_mill_diameter.png -------------------------------------------------------------------------------- /bitmaps/tool/end_mill_flat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/end_mill_flat.png -------------------------------------------------------------------------------- /bitmaps/tool/end_mill_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/end_mill_height.png -------------------------------------------------------------------------------- /bitmaps/tool/end_mill_offset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/end_mill_offset.png -------------------------------------------------------------------------------- /bitmaps/tool/engraver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/engraver.png -------------------------------------------------------------------------------- /bitmaps/tool/engraver_angle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/engraver_angle.png -------------------------------------------------------------------------------- /bitmaps/tool/engraver_diameter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/engraver_diameter.png -------------------------------------------------------------------------------- /bitmaps/tool/engraver_flat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/engraver_flat.png -------------------------------------------------------------------------------- /bitmaps/tool/engraver_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/engraver_height.png -------------------------------------------------------------------------------- /bitmaps/tool/engraver_offset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tool/engraver_offset.png -------------------------------------------------------------------------------- /bitmaps/toolpathclear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/toolpathclear.png -------------------------------------------------------------------------------- /bitmaps/tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/tools.png -------------------------------------------------------------------------------- /bitmaps/turnrough.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/turnrough.png -------------------------------------------------------------------------------- /bitmaps/turntool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/turntool.png -------------------------------------------------------------------------------- /bitmaps/unattach.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/unattach.png -------------------------------------------------------------------------------- /bitmaps/zigzag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/bitmaps/zigzag.png -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | TEMP_FOLDER=/tmp/Heeks2 2 | cd ~/PyCAD 3 | git pull 4 | cd CAD/build 5 | make 6 | cp cad.so ../../ 7 | cd ~/PyCAD/Step/build 8 | make 9 | cp step.so ../../ 10 | cd ~/PyCAD/Geom/build 11 | make 12 | cp geom.so ../../ 13 | cd ~/PyCAM 14 | git pull 15 | cd CAM/build 16 | make 17 | cp cam.so ../../ 18 | 19 | # make zip file 20 | cd ../../../ 21 | rm -r $TEMP_FOLDER 22 | rm Heeks2.zip 23 | mkdir $TEMP_FOLDER 24 | mkdir $TEMP_FOLDER/PyCAD 25 | cp PyCAD/*.py $TEMP_FOLDER/PyCAD 26 | cp PyCAD/heekscad.png $TEMP_FOLDER/PyCAD 27 | cp PyCAD/cad.so $TEMP_FOLDER/PyCAD 28 | cp PyCAD/geom.so $TEMP_FOLDER/PyCAD 29 | cp PyCAD/step.so $TEMP_FOLDER/PyCAD 30 | mkdir $TEMP_FOLDER/PyCAD/bitmaps 31 | mkdir $TEMP_FOLDER/PyCAD/bitmaps/angle 32 | mkdir $TEMP_FOLDER/PyCAD/bitmaps/mirror 33 | mkdir $TEMP_FOLDER/PyCAD/icons 34 | cp PyCAD/bitmaps/*.png $TEMP_FOLDER/PyCAD/bitmaps 35 | cp PyCAD/bitmaps/angle/*.png $TEMP_FOLDER/PyCAD/bitmaps/angle 36 | cp PyCAD/bitmaps/mirror/*.png $TEMP_FOLDER/PyCAD/bitmaps/mirror 37 | cp PyCAD/icons/*.png $TEMP_FOLDER/PyCAD/icons 38 | 39 | # copy wx - to do only user what is needed 40 | mkdir $TEMP_FOLDER/lib 41 | mkdir $TEMP_FOLDER/lib/wx 42 | echo 'copying wx files' 43 | SITE_PACKAGES=/home/pi/.local/lib/python3.7/site-packages 44 | cp $SITE_PACKAGES/wx/*.py $TEMP_FOLDER/lib/wx 45 | cp $SITE_PACKAGES/wx/*.so $TEMP_FOLDER/lib/wx 46 | cp $SITE_PACKAGES/wx/*.so.4 $TEMP_FOLDER/lib/wx 47 | 48 | # copy reportlab 49 | cd PyCAM 50 | python coppy.py $SITE_PACKAGES/reportlab $TEMP_FOLDER/lib/reportlab 51 | cd ../ 52 | 53 | # copy boost and opencascade libraries 54 | echo 'copy other libraries' 55 | cp /usr/local/lib/*.so.11 $TEMP_FOLDER/lib 56 | cp /usr/local/lib/libboost_python37.so.1.73.0 $TEMP_FOLDER/lib 57 | 58 | echo 'copying PyCAM' 59 | mkdir $TEMP_FOLDER/PyCAM 60 | mkdir $TEMP_FOLDER/PyCAM/icons 61 | mkdir $TEMP_FOLDER/PyCAM/bitmaps 62 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/depthop 63 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/drilling 64 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/pattern 65 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/pocket 66 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/profile 67 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/stock 68 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/surface 69 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/tool 70 | mkdir $TEMP_FOLDER/PyCAM/nc 71 | cp PyCAM/*.py $TEMP_FOLDER/PyCAM 72 | cp PyCAM/cam.so $TEMP_FOLDER/PyCAM 73 | cp PyCAM/default.tooltable $TEMP_FOLDER/PyCAM 74 | cp PyCAM/bitmaps/*.png $TEMP_FOLDER/PyCAM/bitmaps 75 | cp PyCAM/bitmaps/depthop/*.png $TEMP_FOLDER/PyCAM/bitmaps/depthop 76 | cp PyCAM/bitmaps/drilling/*.png $TEMP_FOLDER/PyCAM/bitmaps/drilling 77 | cp PyCAM/bitmaps/pattern/*.png $TEMP_FOLDER/PyCAM/bitmaps/pattern 78 | cp PyCAM/bitmaps/pocket/*.png $TEMP_FOLDER/PyCAM/bitmaps/pocket 79 | cp PyCAM/bitmaps/profile/*.png $TEMP_FOLDER/PyCAM/bitmaps/profile 80 | cp PyCAM/bitmaps/stock/*.png $TEMP_FOLDER/PyCAM/bitmaps/stock 81 | cp PyCAM/bitmaps/surface/*.png $TEMP_FOLDER/PyCAM/bitmaps/surface 82 | cp PyCAM/bitmaps/tool/*.png $TEMP_FOLDER/PyCAM/bitmaps/tool 83 | cp PyCAM/icons/*.png $TEMP_FOLDER/PyCAM/icons 84 | cp PyCAM/nc/*.py $TEMP_FOLDER/PyCAM/nc 85 | cp PyCAM/nc/*.xml $TEMP_FOLDER/PyCAM/nc 86 | 87 | # make a run file 88 | touch $TEMP_FOLDER/run.sh 89 | chmod u+x $TEMP_FOLDER/run.sh 90 | echo 'export LD_LIBRARY_PATH="../lib"'>>$TEMP_FOLDER/run.sh 91 | echo 'cd PyCAM'>>$TEMP_FOLDER/run.sh 92 | echo 'python3 test.py'>>$TEMP_FOLDER/run.sh 93 | echo 'read -p "press Enter to finish..."'>>$TEMP_FOLDER/run.sh 94 | 95 | cd /tmp 96 | echo 'making zip file...' 97 | zip -r -q /home/pi/Heeks2.zip Heeks2 98 | echo 'finished' 99 | 100 | -------------------------------------------------------------------------------- /consts.py: -------------------------------------------------------------------------------- 1 | CUT_MODE_CONVENTIONAL = 1 2 | CUT_MODE_CLIMB = 2 3 | 4 | ENTRY_STYLE_UNDEFINED = 0 5 | ENTRY_STYLE_PLUNGE = 1 6 | ENTRY_STYLE_RAMP = 2 7 | ENTRY_STYLE_HELICAL = 3 8 | 9 | TOOL_TYPE_DRILL = 1 10 | TOOL_TYPE_CENTREDRILL = 2 11 | TOOL_TYPE_ENDMILL = 3 12 | TOOL_TYPE_SLOTCUTTER = 4 13 | TOOL_TYPE_BALLENDMILL = 5 14 | TOOL_TYPE_CHAMFER = 6 15 | TOOL_TYPE_ENGRAVER = 7 16 | TOOL_TYPE_TURNINGTOOL = 8 17 | TOOL_TYPE_TOUCHPROBE = 9 18 | TOOL_TYPE_TOOLLENGTHSWITCH = 10 19 | TOOL_TYPE_EXTRUSION = 11 20 | TOOL_TYPE_TAPTOOL = 12 21 | TOOL_TYPE_UNDEFINED = 13 22 | 23 | TOOL_MATERIAL_HSS = 0 24 | TOOL_MATERIAL_CARBIDE = 1 25 | TOOL_MATERIAL_UNDEFINED = 2 26 | 27 | EXTRUSION_MATERIAL_UNDEFINED = 0 28 | EXTRUSION_MATERIAL_ABS = 1 29 | EXTRUSION_MATERIAL_PLA = 2 30 | EXTRUSION_MATERIAL_HDPE = 3 31 | 32 | ABS_MODE_ABSOLUTE = 1 33 | ABS_MODE_INCREMENTAL = 2 34 | 35 | PATH_CONTROL_EXACT_PATH = 0 36 | PATH_CONTROL_EXACT_STOP = 1 37 | PATH_CONTROL_BEST_POSSIBLE_SPEED = 2 38 | PATH_CONTROL_UNDEFINED = 3 39 | -------------------------------------------------------------------------------- /coptest.sh: -------------------------------------------------------------------------------- 1 | TEMP_FOLDER=/tmp/Heeks2 2 | SITE_PACKAGES=/home/pi/.local/lib/python3.7/site-packages 3 | python coppy.py $SITE_PACKAGES/reportlab $TEMP_FOLDER/lib/reportlab 4 | -------------------------------------------------------------------------------- /debian/cam.install: -------------------------------------------------------------------------------- 1 | HeeksCNC2.desktop usr/share/applications 2 | HeeksCNC2.svg usr/share/icons/hicolor/scalable/apps 3 | heeksCNC2.sh usr/bin 4 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | cam (0.0.25) unstable; urgency=low 2 | 3 | * New upstream version 4 | 5 | -- Dan Heeks Fri, 9 Sep 2022 11:23:00 +0000 6 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Package: cam 2 | Source: heeks2 3 | Version: 0.0.1 4 | Section: editors 5 | Priority: extra 6 | Maintainer: Dan Heeks 7 | Build-Depends: debhelper (>= 9.0.0), cmake, python3-dev, freeglut3-dev, libboost-python-dev, cad-dev 8 | Standards-Version: 3.9.3 9 | Homepage: https://github.com/danheeks/PyCAM 10 | Vcs-Git: https://github.com/danheeks/PyCAM.git 11 | Vcs-Browser: https://github.com/danheeks/PyCAM 12 | 13 | Package: cam 14 | Architecture: any 15 | Depends: ${shlibs:Depends}, cad 16 | Description: CAD/CAM software using CAD ( from Heeks2 project ) 17 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: blue 3 | Source: 4 | 5 | Files: * 6 | Copyright: 2008-2022 Dan Heeks 7 | 8 | License: GPL-2+ 9 | This package is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation; either version 2 of the License, or 12 | (at your option) any later version. 13 | . 14 | This package is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | . 19 | You should have received a copy of the GNU General Public License 20 | along with this program. If not, see 21 | . 22 | On Debian systems, the complete text of the GNU General 23 | Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". -------------------------------------------------------------------------------- /debian/dirs: -------------------------------------------------------------------------------- 1 | usr/bin 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | # Uncomment this to turn on verbose mode. 5 | #export DH_VERBOSE=1 6 | 7 | %: 8 | dh $@ 9 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /default.tooltable: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /depth_params.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | class depth_params: 4 | def __init__(self, clearance_height, rapid_safety_space, start_depth, step_down, z_finish_depth, z_thru_depth, final_depth, user_depths): 5 | self.clearance_height = clearance_height 6 | self.rapid_safety_space = math.fabs(rapid_safety_space) 7 | self.start_depth = start_depth 8 | self.step_down = math.fabs(step_down) 9 | self.z_finish_depth = math.fabs(z_finish_depth) 10 | self.z_thru_depth = math.fabs(z_thru_depth) 11 | self.final_depth = final_depth 12 | self.user_depths = user_depths 13 | 14 | def get_depths(self): 15 | if self.user_depths != '': 16 | depths = self.user_depths 17 | else: 18 | depth = self.final_depth - self.z_thru_depth 19 | depths = [depth] 20 | depth += self.z_finish_depth 21 | if depth + 0.0000001 < self.start_depth: 22 | if self.z_finish_depth > 0.0000001: depths.insert(0, depth) 23 | depth += self.z_thru_depth 24 | layer_count = int((self.start_depth - depth) / self.step_down - 0.0000001) + 1 25 | if layer_count > 0: 26 | layer_depth = (self.start_depth - depth)/layer_count 27 | for i in range(1, layer_count): 28 | depth += layer_depth 29 | depths.insert(0, depth) 30 | 31 | return depths 32 | -------------------------------------------------------------------------------- /heeksCNC2.sh: -------------------------------------------------------------------------------- 1 | python3 /usr/PyCAM/Heeks2.py 2 | -------------------------------------------------------------------------------- /heekscnc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/heekscnc.png -------------------------------------------------------------------------------- /icons/adapt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/adapt.png -------------------------------------------------------------------------------- /icons/arc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/arc.png -------------------------------------------------------------------------------- /icons/area.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/area.png -------------------------------------------------------------------------------- /icons/attach.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/attach.png -------------------------------------------------------------------------------- /icons/ballmill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/ballmill.png -------------------------------------------------------------------------------- /icons/billets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/billets.png -------------------------------------------------------------------------------- /icons/branch_end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/branch_end.png -------------------------------------------------------------------------------- /icons/branch_end_minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/branch_end_minus.png -------------------------------------------------------------------------------- /icons/branch_end_plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/branch_end_plus.png -------------------------------------------------------------------------------- /icons/branch_minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/branch_minus.png -------------------------------------------------------------------------------- /icons/branch_plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/branch_plus.png -------------------------------------------------------------------------------- /icons/branch_split.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/branch_split.png -------------------------------------------------------------------------------- /icons/branch_trunk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/branch_trunk.png -------------------------------------------------------------------------------- /icons/centredrill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/centredrill.png -------------------------------------------------------------------------------- /icons/chamfmill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/chamfmill.png -------------------------------------------------------------------------------- /icons/circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/circle.png -------------------------------------------------------------------------------- /icons/cone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/cone.png -------------------------------------------------------------------------------- /icons/coordsys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/coordsys.png -------------------------------------------------------------------------------- /icons/cube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/cube.png -------------------------------------------------------------------------------- /icons/cutting_rate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/cutting_rate.png -------------------------------------------------------------------------------- /icons/cyl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/cyl.png -------------------------------------------------------------------------------- /icons/dimension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/dimension.png -------------------------------------------------------------------------------- /icons/drill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/drill.png -------------------------------------------------------------------------------- /icons/drilling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/drilling.png -------------------------------------------------------------------------------- /icons/edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/edge.png -------------------------------------------------------------------------------- /icons/edges.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/edges.png -------------------------------------------------------------------------------- /icons/ellipse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/ellipse.png -------------------------------------------------------------------------------- /icons/endmill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/endmill.png -------------------------------------------------------------------------------- /icons/engraver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/engraver.png -------------------------------------------------------------------------------- /icons/extrusion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/extrusion.png -------------------------------------------------------------------------------- /icons/face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/face.png -------------------------------------------------------------------------------- /icons/faces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/faces.png -------------------------------------------------------------------------------- /icons/gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/gear.png -------------------------------------------------------------------------------- /icons/group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/group.png -------------------------------------------------------------------------------- /icons/iline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/iline.png -------------------------------------------------------------------------------- /icons/knife.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/knife.png -------------------------------------------------------------------------------- /icons/line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/line.png -------------------------------------------------------------------------------- /icons/locating.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/locating.png -------------------------------------------------------------------------------- /icons/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/minus.png -------------------------------------------------------------------------------- /icons/nccode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/nccode.png -------------------------------------------------------------------------------- /icons/noentry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/noentry.png -------------------------------------------------------------------------------- /icons/octree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/octree.png -------------------------------------------------------------------------------- /icons/operations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/operations.png -------------------------------------------------------------------------------- /icons/pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/pattern.png -------------------------------------------------------------------------------- /icons/patterns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/patterns.png -------------------------------------------------------------------------------- /icons/picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/picture.png -------------------------------------------------------------------------------- /icons/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/plus.png -------------------------------------------------------------------------------- /icons/pocket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/pocket.png -------------------------------------------------------------------------------- /icons/point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/point.png -------------------------------------------------------------------------------- /icons/probe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/probe.png -------------------------------------------------------------------------------- /icons/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/profile.png -------------------------------------------------------------------------------- /icons/program.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/program.png -------------------------------------------------------------------------------- /icons/raft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/raft.png -------------------------------------------------------------------------------- /icons/scriptop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/scriptop.png -------------------------------------------------------------------------------- /icons/sim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/sim.png -------------------------------------------------------------------------------- /icons/sketch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/sketch.png -------------------------------------------------------------------------------- /icons/slotdrill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/slotdrill.png -------------------------------------------------------------------------------- /icons/solid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/solid.png -------------------------------------------------------------------------------- /icons/speeds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/speeds.png -------------------------------------------------------------------------------- /icons/sphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/sphere.png -------------------------------------------------------------------------------- /icons/spline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/spline.png -------------------------------------------------------------------------------- /icons/stlsolid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/stlsolid.png -------------------------------------------------------------------------------- /icons/stock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/stock.png -------------------------------------------------------------------------------- /icons/stocks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/stocks.png -------------------------------------------------------------------------------- /icons/surface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/surface.png -------------------------------------------------------------------------------- /icons/surfaces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/surfaces.png -------------------------------------------------------------------------------- /icons/tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/tag.png -------------------------------------------------------------------------------- /icons/tags.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/tags.png -------------------------------------------------------------------------------- /icons/tap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/tap.png -------------------------------------------------------------------------------- /icons/tapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/tapping.png -------------------------------------------------------------------------------- /icons/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/text.png -------------------------------------------------------------------------------- /icons/tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/tool.png -------------------------------------------------------------------------------- /icons/tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/tools.png -------------------------------------------------------------------------------- /icons/turnrough.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/turnrough.png -------------------------------------------------------------------------------- /icons/turntool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/turntool.png -------------------------------------------------------------------------------- /icons/unattach.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/unattach.png -------------------------------------------------------------------------------- /icons/unknown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/unknown.png -------------------------------------------------------------------------------- /icons/vertex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/vertex.png -------------------------------------------------------------------------------- /icons/vertices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/vertices.png -------------------------------------------------------------------------------- /icons/waterline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/waterline.png -------------------------------------------------------------------------------- /icons/wire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/wire.png -------------------------------------------------------------------------------- /icons/xml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/xml.png -------------------------------------------------------------------------------- /icons/zigzag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danheeks/PyCAM/342863e4c5629663ad90e723f514b118310ba8e2/icons/zigzag.png -------------------------------------------------------------------------------- /nc/DeckelFP4Ma.py: -------------------------------------------------------------------------------- 1 | import nc 2 | import iso 3 | import math 4 | import datetime 5 | import time 6 | from format import Format 7 | 8 | now = datetime.datetime.now() 9 | 10 | class Creator(iso.Creator): 11 | def __init__(self): 12 | iso.Creator.__init__(self) 13 | self.output_tool_definitions = False 14 | self.fmt = Format(dp_wanted = False, add_trailing_zeros = True, add_plus = True) 15 | 16 | def SPACE_STR(self): return ' ' 17 | def PROGRAM(self): return None 18 | def PROGRAM_END(self): return( 'T0' + self.SPACE() + 'M06' + self.SPACE() + 'M02') 19 | 20 | ############################################################################ 21 | ## Begin Program 22 | 23 | 24 | def program_begin(self, id, comment): 25 | self.write( ('(Created with Deckel FP4Ma post processor ' + str(now.strftime("%Y/%m/%d %H:%M")) + ')' + '\n') ) 26 | iso.Creator.program_begin(self, id, comment) 27 | 28 | 29 | nc.creator = Creator() 30 | 31 | -------------------------------------------------------------------------------- /nc/Fanuc3000.py: -------------------------------------------------------------------------------- 1 | import nc.nc 2 | import emc2b 3 | 4 | class Creator(emc2b.Creator): 5 | def __init__(self): 6 | emc2b.Creator.__init__(self) 7 | self.fmt = Format(add_leading_zeros = 2, add_trailing_zeros = True, dp_wanted = False) 8 | 9 | nc.nc.creator = Creator() 10 | 11 | -------------------------------------------------------------------------------- /nc/Fanuc3000_read.py: -------------------------------------------------------------------------------- 1 | import nc.iso_read 2 | 3 | class Parser(nc.iso_read.Parser): 4 | def __init__(self, writer): 5 | nc.iso_read.Parser.__init__(self, writer) 6 | 7 | def eval_float(self, value): 8 | # there are no decimal places, so divide the number by 1000 9 | v = nc.iso_read.Parser.eval_float(self, value) * 0.001 10 | return v -------------------------------------------------------------------------------- /nc/__init__.py: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # __init__.py 3 | # 4 | # This is here to make python see NC folder 5 | # 6 | # Hirutso Enni, 2009-01-13 7 | -------------------------------------------------------------------------------- /nc/anilam_crusader_m.py: -------------------------------------------------------------------------------- 1 | # Preliminary postprocessor support for Anilam Crusader M CNC controller 2 | # This code modified from iso.py and emc2.py distriuted with HeeksCAD as of Sep 2010 3 | # Kurt Jensen 6 Sep 2010 4 | # Use at your own risk. 5 | import nc 6 | import iso 7 | 8 | class Creator(iso.Creator): 9 | def init(self): 10 | iso.Creator.init(self) 11 | self.arc_centre_absolute = True 12 | 13 | def SPACE(self): return(' ') 14 | 15 | # This version of COMMENT removes comments from the resultant GCode 16 | # Note: The Anilam hates comments when importing code. 17 | 18 | def COMMENT(self,comment): return('') 19 | 20 | def program_begin(self, id, comment): 21 | self.write('%\n'); # Start of file token that Anilam Crusader M likes 22 | # No Comments for the Anilam crusaher M, please...... 23 | #self.write( ('(' + comment + ')' + '\n') ) 24 | 25 | def program_end(self): 26 | self.write_blocknum() 27 | self.write('G29E\n') # End of code signal for Anilam Crusader M 28 | self.write('%\n') # EOF signal for Anilam Crusader M 29 | 30 | ############################################################################ 31 | ## Settings 32 | 33 | def imperial(self): 34 | self.write_blocknum() 35 | self.write( self.IMPERIAL() + '\n') 36 | self.fmt.number_of_decimal_places = 4 37 | 38 | def metric(self): 39 | self.write_blocknum() 40 | self.write( self.METRIC() + '\n' ) 41 | self.fmt.number_of_decimal_places = 3 42 | 43 | def absolute(self): 44 | self.write_blocknum() 45 | self.write( self.ABSOLUTE() + '\n') 46 | 47 | def incremental(self): 48 | self.write_blocknum() 49 | self.write( self.INCREMENTAL() + '\n' ) 50 | 51 | def polar(self, on=True): 52 | if (on) : 53 | self.write_blocknum() 54 | self.write(self.POLAR_ON() + '\n' ) 55 | else : 56 | self.write_blocknum() 57 | self.write(self.POLAR_OFF() + '\n' ) 58 | 59 | def set_plane(self, plane): 60 | if (plane == 0) : 61 | self.write_blocknum() 62 | self.write('G17\n') 63 | elif (plane == 1) : 64 | self.write_blocknum() 65 | self.write('G18\n') 66 | elif (plane == 2) : 67 | self.write_blocknum() 68 | self.write('G19\n') 69 | 70 | def comment(self, text): 71 | self.write_blocknum() 72 | 73 | ############################################################################ 74 | ## Tools 75 | 76 | def tool_change(self, id): 77 | self.write_blocknum() 78 | self.write(('T%i' % id) + '\n') 79 | self.t = id 80 | 81 | def tool_defn(self, id, name='', params=None): 82 | self.write_blocknum() 83 | self.write(('T10%.2d' % id) + ' ') 84 | 85 | if (radius != None): 86 | self.write(('X%.3f' % radius) + ' ') 87 | 88 | if (length != None): 89 | self.write('Z%.3f' % length) 90 | 91 | self.write('\n') 92 | 93 | # This is the coordinate system we're using. G54->G59, G59.1, G59.2, G59.3 94 | # These are selected by values from 1 to 9 inclusive. 95 | def workplane(self, id): 96 | if ((id >= 1) and (id <= 6)): 97 | self.write_blocknum() 98 | self.write( (self.WORKPLANE() % (id + self.WORKPLANE_BASE())) + '\n') 99 | if ((id >= 7) and (id <= 9)): 100 | self.write_blocknum() 101 | self.write( ((self.WORKPLANE() % (6 + self.WORKPLANE_BASE())) + ('.%i' % (id - 6))) + '\n') 102 | 103 | # inhibit N codes being generated for line numbers: 104 | def write_blocknum(self): 105 | pass 106 | 107 | def drill(self, x=None, y=None, dwell=None, depthparams = None, retract_mode=None, spindle_mode=None, internal_coolant_on=None, rapid_to_clearance = None): 108 | self.write('(Canned drill cycle ops are not yet supported here on this Anilam Crusader M postprocessor)') 109 | 110 | nc.creator = Creator() 111 | 112 | -------------------------------------------------------------------------------- /nc/anilam_crusader_m_read.py: -------------------------------------------------------------------------------- 1 | # Preliminary backplot support for Anilam Crusader M CNC controller 2 | # This code modified from iso_read.py and emc2_read.py distriuted with HeeksCAD as of Sep 2010 3 | # Kurt Jensen 6 Sep 2010 4 | # Use at your own risk. 5 | import iso_read as iso 6 | import sys 7 | 8 | # Override some iso parser methods to interpret arc centers as relative to origin, not relative to start of arc. 9 | 10 | class Parser(iso.Parser): 11 | def __init__(self, writer): 12 | iso.Parser.__init__(self, writer) 13 | self.arc_centre_absolute = True 14 | -------------------------------------------------------------------------------- /nc/bpmcp.py: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # bpmcp.py 3 | # 4 | # Post Processor for MCP's Bridgeport 5 | # It is just an ISO machine, but I don't want the tool definition lines 6 | # 7 | # Dan Heeks, 13th Aug 2024 8 | 9 | import nc 10 | import iso_modal 11 | import math 12 | 13 | ################################################################################ 14 | class Creator(iso_modal.Creator): 15 | 16 | def __init__(self): 17 | iso_modal.Creator.__init__(self) 18 | self.output_tool_definitions = False 19 | 20 | # def PROGRAM_END(self): return( 'M09\nT0' + self.SPACE() + 'M06\nM30') 21 | 22 | def spindle(self, s, clockwise): 23 | self.write('M08\n') # coolant on 24 | iso_modal.Creator.spindle(self, s, clockwise) 25 | 26 | def tool_change(self, id, newline = True): 27 | self.write('M09\n') # coolant off 28 | iso_modal.Creator.tool_change(self, id, newline) 29 | self.write('G43' + self.SPACE() + 'H' + str(id) + '\n') 30 | 31 | ################################################################################ 32 | 33 | nc.creator = Creator() 34 | -------------------------------------------------------------------------------- /nc/centroid1_read.py: -------------------------------------------------------------------------------- 1 | import iso_read as iso 2 | import sys 3 | 4 | # just use the iso reader 5 | 6 | class Parser(iso.Parser): 7 | def __init__(self, writer): 8 | iso.Parser.__init__(self, writer) 9 | -------------------------------------------------------------------------------- /nc/cutviewer.py: -------------------------------------------------------------------------------- 1 | def tool_defn(self, id, params): 2 | self.write('(TOOL/') 3 | type = params['type'] 4 | if type == 0:#eDrill = 0, 5 | #;TOOL/DRILL, Diameter, Point Angle, Height 6 | self.write('DRILL, ' + str(params['diameter'])) 7 | self.write(', ' + str(params['cutting edge angle'] * 2.0)) 8 | self.write(', ' + str(params['cutting edge height'])) 9 | elif type == 1:#eCentreDrill, 10 | #;TOOL/CDRILL, D1, A1, L, D2, A2, H (see Fig. below) 11 | self.write('CDRILL, ' + str(params['flat radius'] * 2)) 12 | self.write(', ' + str(params['cutting edge angle'])) 13 | self.write(', ' + str(params['flat radius'] * 2)) 14 | self.write(', ' + str(params['diameter'])) 15 | self.write(', ' + str(params['cutting edge angle'] * 2.0)) 16 | self.write(', ' + str(params['cutting edge height'])) 17 | elif type == 2 or type == 3 or type == 4:#eSlotCutter,#eEndmill,#eBallEndMill, 18 | #TOOL/MILL, Diameter, Corner radius, Height, Taper Angle 19 | self.write('MILL, ' + str(params['diameter'])) 20 | self.write(', ' + str(params['corner radius'])) 21 | self.write(', ' + str(params['cutting edge height'])) 22 | self.write(', ' + str(params['cutting edge angle'])) 23 | elif type == 5 or type == 6:#eChamfer,#eEngravingTool, 24 | #;TOOL/CHAMFER, Diameter, Point Angle, Height 25 | #;TOOL/CHAMFER, Diameter, Point Angle, Height, Chamfer Length 26 | self.write('CHAMFER, ' + str(params['diameter'])) 27 | self.write(', ' + str(params['cutting edge angle'])) 28 | self.write(', ' + str(params['cutting edge height'])) 29 | else:#eUndefinedToolType 30 | pass 31 | self.write(')\n') 32 | 33 | # to do 34 | #;TOOL/CRMILL, Diameter1, Diameter2, Radius, Height, Length 35 | -------------------------------------------------------------------------------- /nc/drag_knife.py: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # drag knife.py 3 | # 4 | # NC code creator for attaching Z coordinates to a surface 5 | # 6 | # Dan Heeks 26th April 2012 7 | 8 | import recreator 9 | dragging = False 10 | from kurve_funcs import cut_curve as cut_curve 11 | import nc 12 | import area 13 | 14 | ################################################################################ 15 | class Creator(recreator.Redirector): 16 | 17 | def __init__(self, original, drag_distance): 18 | recreator.Redirector.__init__(self, original) 19 | 20 | self.drag_distance = drag_distance 21 | self.path = None 22 | 23 | def cut_path(self): 24 | if self.path == None: return 25 | 26 | print self.drag_distance 27 | self.path.OffsetForward(self.drag_distance, False) 28 | 29 | nc.creator = nc.creator.original 30 | 31 | if self.path.getNumVertices() > 0: 32 | v = self.path.FirstVertex() 33 | nc.creator.feed(v.p.x, v.p.y) 34 | 35 | cut_curve(self.path) 36 | nc.creator = self 37 | 38 | self.path = area.Curve() 39 | 40 | def feed(self, x=None, y=None, z=None, a=None, b=None, c=None): 41 | px = self.x 42 | py = self.y 43 | pz = self.z 44 | recreator.Redirector.feed(self, x, y, z, a, b, c) 45 | if self.x == None or self.y == None or self.z == None: 46 | return 47 | if px == self.x and py == self.y: 48 | return 49 | 50 | # add a line to the path 51 | if self.path == None: self.path = area.Curve() 52 | self.path.append(area.Point(self.x, self.y)) 53 | 54 | def arc(self, x=None, y=None, z=None, i=None, j=None, k=None, r=None, ccw = True): 55 | recreator.Redirector.arc(self, x, y, z, i, j, k, r, ccw) 56 | 57 | # add an arc to the path 58 | if self.path == None: self.path = area.Curve() 59 | self.path.append(area.Vertex(1 if ccw else -1, area.Point(self.x, self.y), area.Point(i, j))) 60 | 61 | def drag_begin(drag_distance): 62 | global dragging 63 | if dragging == True: 64 | drag_end() 65 | nc.creator = Creator(nc.creator, drag_distance) 66 | dragging = True 67 | 68 | def drag_end(): 69 | global dragging 70 | nc.creator.cut_path() 71 | nc.creator = nc.creator.original 72 | attached = False 73 | -------------------------------------------------------------------------------- /nc/dynapath.py: -------------------------------------------------------------------------------- 1 | import nc 2 | import iso 3 | import math 4 | import datetime 5 | import time 6 | from format import Format 7 | 8 | now = datetime.datetime.now() 9 | 10 | class Creator(iso.Creator): 11 | def __init__(self): 12 | iso.Creator.__init__(self) 13 | self.output_tool_definitions = False 14 | self.m_codes_on_their_own_line = True 15 | self.output_g98_and_g99 = False 16 | #self.fmt = Format(dp_wanted = False, add_trailing_zeros = True, add_plus = True) 17 | 18 | #def SPACE_STR(self): return ' ' 19 | def PROGRAM(self): return None 20 | def RETRACT(self, height): return('R' + (self.fmt.string(height))) 21 | def PECK_DEPTH(self, depth): return('O' + (self.fmt.string(depth))) 22 | 23 | def program_begin(self, id, name=''): 24 | self.write('(' + name + ')\n') 25 | 26 | def imperial(self): 27 | #self.g_list.append(self.IMPERIAL()) 28 | self.fmt.number_of_decimal_places = 4 29 | 30 | def metric(self): 31 | #self.g_list.append(self.METRIC()) 32 | self.fmt.number_of_decimal_places = 3 33 | 34 | def comment(self, text): 35 | pass 36 | 37 | nc.creator = Creator() 38 | 39 | -------------------------------------------------------------------------------- /nc/emc2b.py: -------------------------------------------------------------------------------- 1 | import nc.nc 2 | import nc.iso_modal 3 | import math 4 | 5 | class Creator(nc.iso_modal.Creator): 6 | def __init__(self): 7 | nc.iso_modal.Creator.__init__(self) 8 | self.output_block_numbers = False 9 | self.output_tool_definitions = False 10 | self.output_g43_on_tool_change_line = True 11 | self.output_time_created = True 12 | 13 | def GetTitle(self): 14 | return 'emc2b' + ' Cutter Radius Compensation' if self.useCrc else '' 15 | 16 | def SPACE(self): 17 | if self.start_of_line == True: 18 | self.start_of_line = False 19 | return '' 20 | else: 21 | return ' ' 22 | 23 | def PROGRAM(self): return None 24 | def PROGRAM_END(self): return( 'T0' + self.SPACE() + 'M06' + self.SPACE() + 'M02') 25 | 26 | nc.nc.creator = Creator() 27 | 28 | -------------------------------------------------------------------------------- /nc/emc2b_crc.py: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # emc2b_crc.py 3 | # 4 | # a class derived from emc2b machine, with Cutter Radius Compensation turned on. 5 | # 6 | # Dan Heeks, 18th Jan 2011 7 | 8 | import nc 9 | import emc2b 10 | import math 11 | 12 | ################################################################################ 13 | class Creator(emc2b.Creator): 14 | 15 | def __init__(self): 16 | emc2b.Creator.__init__(self) 17 | self.useCrc = True 18 | 19 | ################################################################################ 20 | 21 | nc.creator = Creator() 22 | -------------------------------------------------------------------------------- /nc/emc2tap.py: -------------------------------------------------------------------------------- 1 | import nc 2 | import iso_codes 3 | import emc2 4 | 5 | 6 | 7 | class CodesEMC2(iso_codes.Codes): 8 | def SPACE(self): return(' ') 9 | def TAP(self): return('G33.1') 10 | def TAP_DEPTH(self, format, depth): return(self.SPACE() + 'K' + (format % depth)) 11 | 12 | 13 | # This version of COMMENT removes comments from the resultant GCode 14 | #def COMMENT(self,comment): return('') 15 | 16 | iso_codes.codes = CodesEMC2() 17 | 18 | 19 | class CreatorEMC2tap(emc2.CreatorEMC2): 20 | def init(self): 21 | iso.CreatorEMC2.init(self) 22 | 23 | 24 | # G33.1 tapping with EMC for now 25 | # unsynchronized (chuck) taps NIY (tap_mode = 1) 26 | def tap(self, x=None, y=None, z=None, zretract=None, depth=None, standoff=None, dwell_bottom=None, pitch=None, stoppos=None, spin_in=None, spin_out=None, tap_mode=None, direction=None): 27 | # mystery parameters: 28 | # zretract=None, dwell_bottom=None,pitch=None, stoppos=None, spin_in=None, spin_out=None): 29 | # I dont see how to map these to EMC Gcode 30 | 31 | if (standoff == None): 32 | # This is a bad thing. All the drilling cycles need a retraction (and starting) height. 33 | return 34 | if (z == None): 35 | return # We need a Z value as well. This input parameter represents the top of the hole 36 | if (pitch == None): 37 | return # We need a pitch value. 38 | if (direction == None): 39 | return # We need a direction value. 40 | 41 | if (tap_mode != 0): 42 | self.comment('only rigid tapping currently supported') 43 | return 44 | 45 | self.write_preps() 46 | self.write_blocknum() 47 | self.write_spindle() 48 | self.write('\n') 49 | 50 | # rapid to starting point; z first, then x,y iff given 51 | 52 | # Set the retraction point to the 'standoff' distance above the starting z height. 53 | retract_height = z + standoff 54 | 55 | # unsure if this is needed: 56 | if self.z != retract_height: 57 | self.rapid(z = retract_height) 58 | 59 | # then continue to x,y if given 60 | if (x != None) or (y != None): 61 | self.write_blocknum() 62 | self.write(iso_codes.codes.RAPID() ) 63 | 64 | if (x != None): 65 | self.write(iso_codes.codes.X() + (self.fmt % x)) 66 | self.x = x 67 | 68 | if (y != None): 69 | self.write(iso_codes.codes.Y() + (self.fmt % y)) 70 | self.y = y 71 | self.write('\n') 72 | 73 | self.write_blocknum() 74 | self.write( iso_codes.codes.TAP() ) 75 | self.write( iso_codes.codes.TAP_DEPTH(self.ffmt,pitch) + iso_codes.codes.SPACE() ) 76 | self.write(iso_codes.codes.Z() + (self.fmt % (z - depth))) # This is the 'z' value for the bottom of the tap. 77 | self.write_misc() 78 | self.write('\n') 79 | 80 | self.z = retract_height # this cycle returns to the start position, so remember that as z value 81 | 82 | 83 | 84 | nc.creator = CreatorEMC2tap() 85 | 86 | -------------------------------------------------------------------------------- /nc/format.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | class Format: 4 | def __init__(self, number_of_decimal_places = 3, add_leading_zeros = 1, add_trailing_zeros = False, dp_wanted = True, add_plus = False, no_minus = False, round_down = False): 5 | self.number_of_decimal_places = number_of_decimal_places 6 | self.add_leading_zeros = add_leading_zeros # fill the start of the number with zeros, so there are at least this number of digits before the decimal point 7 | self.add_trailing_zeros = add_trailing_zeros # fill the end of the number with zeros, as defined by "number_of_decimal_places" 8 | self.dp_wanted = dp_wanted 9 | self.add_plus = add_plus 10 | self.no_minus = no_minus 11 | self.round_down = round_down 12 | 13 | def string(self, number): 14 | if number == None: 15 | return 'None' 16 | multiplier = math.pow(10, self.number_of_decimal_places) 17 | 18 | f = float(number) * multiplier 19 | 20 | if self.round_down == False: 21 | if f < 0: f = f - .5 22 | else: f = f + .5 23 | 24 | f = int(f) / multiplier 25 | s = str(f) 26 | 27 | minus = False 28 | if s[0] == '-': 29 | minus = True 30 | if self.no_minus: 31 | s = s[1:] 32 | 33 | dot = s.find('.') 34 | if dot == -1: 35 | before_dp = s 36 | after_dp = '' 37 | else: 38 | before_dp = s[0:dot] 39 | after_dp = s[dot + 1: dot + 1 + self.number_of_decimal_places] 40 | 41 | before_dp = before_dp.zfill(self.add_leading_zeros) 42 | if self.add_trailing_zeros: 43 | for i in range(0, self.number_of_decimal_places - len(after_dp)): 44 | after_dp += '0' 45 | else: 46 | after_dp = after_dp.rstrip('0') 47 | 48 | s = '' 49 | 50 | if minus == False: 51 | if self.add_plus == True: 52 | s += '+' 53 | s += before_dp 54 | if len(after_dp): 55 | if self.dp_wanted: s += '.' 56 | s += after_dp 57 | 58 | return s 59 | 60 | class Address: 61 | def __init__(self, text, fmt = Format(), modal = True): 62 | self.text = text 63 | self.fmt = fmt 64 | self.modal = modal 65 | self.str = None 66 | self.previous = None 67 | 68 | def set(self, number): 69 | self.str = self.text + self.fmt.string(number) 70 | 71 | def write(self, writer): 72 | if self.str == None: return '' 73 | if self.modal: 74 | if self.str != self.previous: 75 | writer.write(self.str) 76 | self.previous = self.str 77 | else: 78 | writer.write(self.str) 79 | self.str = None 80 | 81 | class AddressPlusMinus(Address): 82 | def __init__(self, text, fmt = Format(), modal = True): 83 | Address.__init__(self, text, fmt, modal) 84 | self.str2 = None 85 | self.previous2 = None 86 | 87 | def set(self, number, text_plus, text_minus): 88 | Address.set(self, number) 89 | if float(number) > 0.0: 90 | self.str2 = text_plus 91 | else: 92 | self.str2 = text_minus 93 | 94 | def write(self, writer): 95 | Address.write(self, writer) 96 | if self.str2 == None: return '' 97 | if self.modal: 98 | if self.str2 != self.previous2: 99 | writer.write(writer.SPACE()) 100 | writer.write(self.str2) 101 | self.previous2 = self.str2 102 | else: 103 | writer.write(writer.SPACE()) 104 | writer.write(self.str2) 105 | self.str2 = None 106 | -------------------------------------------------------------------------------- /nc/gantry_router.py: -------------------------------------------------------------------------------- 1 | import nc 2 | import emc2 3 | 4 | class Creator(emc2.Creator): 5 | def init(self): 6 | emc2.Creator.init(self) 7 | 8 | def program_begin(self, id, comment): 9 | self.write( ('(' + comment + ')' + '\n') ) 10 | 11 | def tool_defn(self, id, name='', params=None): 12 | pass 13 | 14 | def spindle(self, s, clockwise): 15 | pass 16 | 17 | nc.creator = Creator() 18 | 19 | -------------------------------------------------------------------------------- /nc/hm50.py: -------------------------------------------------------------------------------- 1 | import nc 2 | import emc2 3 | 4 | class Creator(emc2.Creator): 5 | def init(self): 6 | iso.Creator.init(self) 7 | 8 | def program_begin(self, id, comment): 9 | self.write( ('(' + comment + ')' + '\n') ) 10 | 11 | def tool_change(self, id): 12 | self.write_blocknum() 13 | self.write('G53 G00 Z30\n') 14 | self.write_blocknum() 15 | self.write((self.TOOL() % id) + '\n') 16 | self.write_blocknum() 17 | self.write('G01 Z100.000 F800.000\n') 18 | self.write_blocknum() 19 | self.write('M0\n') 20 | self.write_blocknum() 21 | self.write('G01 Z10.000 F300.000\n') 22 | 23 | 24 | nc.creator = Creator() 25 | -------------------------------------------------------------------------------- /nc/hpgl2d.py: -------------------------------------------------------------------------------- 1 | # hpgl2d.py 2 | # 3 | # Copyright (c) 2009, Dan Heeks 4 | # This program is released under the BSD license. See the file COPYING for details. 5 | # 6 | 7 | import nc 8 | import math 9 | 10 | class Creator(nc.Creator): 11 | def __init__(self): 12 | nc.Creator.__init__(self) 13 | self.x = int(0) 14 | self.y = int(0) # these are in machine units, like 0.01mm or maybe 0.25mm 15 | self.metric() # set self.units_to_mc_units 16 | 17 | def imperial(self): 18 | self.units_to_mc_units = 2540 # multiplier from inches to machine units 19 | 20 | def metric(self): 21 | self.units_to_mc_units = 100 # multiplier from mm to machine units 22 | 23 | def program_begin(self, id, name=''): 24 | self.write('IN;\n') 25 | self.write('VS32,1;\n') 26 | self.write('VS32,2;\n') 27 | self.write('VS32,3;\n') 28 | self.write('VS32,4;\n') 29 | self.write('VS32,5;\n') 30 | self.write('VS32,6;\n') 31 | self.write('VS32,7;\n') 32 | self.write('VS32,8;\n') 33 | self.write('WU0;\n') 34 | self.write('PW0.349,1;\n') 35 | self.write('PW0.349,2;\n') 36 | self.write('PW0.349,3;\n') 37 | self.write('PW0.349,4;\n') 38 | self.write('PW0.349,5;\n') 39 | self.write('PW0.349,6;\n') 40 | self.write('PW0.349,7;\n') 41 | self.write('PW0.349,8;\n') 42 | self.write('SP1;\n') 43 | 44 | def program_end(self): 45 | self.write('SP0;\n') 46 | 47 | def closest_int(self, f): 48 | if math.fabs(f) < 0.3: 49 | return 0 50 | elif f > 0: 51 | return int(f + 0.5) 52 | else: 53 | return int(f - 0.5) 54 | 55 | def get_machine_x_y(self, x=None, y=None): 56 | machine_x = self.x 57 | machine_y = self.y 58 | if x != None: 59 | machine_x = self.closest_int(x * self.units_to_mc_units) 60 | if y != None: 61 | machine_y = self.closest_int(y * self.units_to_mc_units) 62 | return machine_x, machine_y 63 | 64 | def rapid(self, x=None, y=None, z=None, a=None, b=None, c=None): 65 | # ignore the z, any rapid will be assumed to be done with the pen up 66 | mx, my = self.get_machine_x_y(x, y) 67 | if mx != self.x or my != self.y: 68 | self.write(('PU%i' % mx) + (' %i;\n' % my)) 69 | self.x = mx 70 | self.y = my 71 | 72 | def feed(self, x=None, y=None, z=None, a=None, b=None, c=None): 73 | # ignore the z, any feed will be assumed to be done with the pen down 74 | mx, my = self.get_machine_x_y(x, y) 75 | if mx != self.x or my != self.y: 76 | self.write(('PD%i' % mx) + (' %i;\n' % my)) 77 | self.x = mx 78 | self.y = my 79 | 80 | def arc(self, cw, x=None, y=None, z=None, i=None, j=None, k=None, r=None): 81 | mx, my = self.get_machine_x_y(x, y) 82 | if mx != self.x or my != self.y: 83 | cx = float(self.x) / self.units_to_mc_units + i 84 | cy = float(self.y) / self.units_to_mc_units + j 85 | sdx = -i 86 | sdy = -j 87 | edx = x - cx 88 | edy = y - cy 89 | start_angle = math.atan2(sdy, sdx) 90 | end_angle = math.atan2(edy, edx) 91 | if cw: 92 | if start_angle < end_angle: start_angle += 2 * math.pi 93 | else: 94 | if end_angle < start_angle: end_angle += 2 * math.pi 95 | 96 | a = math.fabs(end_angle - start_angle) 97 | if cw: a = -a 98 | 99 | mcx, mcy = self.get_machine_x_y(cx, cy) 100 | 101 | self.write(('AA%i' % mcx) + (',%i' % mcy) + (',%d;\n' % (a * 180 / math.pi))) 102 | 103 | def arc_cw(self, x=None, y=None, z=None, i=None, j=None, k=None, r=None): 104 | self.arc(True, x, y, z, i, j, k, r) 105 | 106 | def arc_ccw(self, x=None, y=None, z=None, i=None, j=None, k=None, r=None): 107 | self.arc(False, x, y, z, i, j, k, r) 108 | 109 | nc.creator = Creator() 110 | -------------------------------------------------------------------------------- /nc/hpgl2d_read.py: -------------------------------------------------------------------------------- 1 | import num_reader 2 | import sys 3 | import math 4 | 5 | class Parser(num_reader.NumReader): 6 | 7 | def __init__(self, writer): 8 | num_reader.NumReader.__init__(self, writer) 9 | self.i = 0 10 | self.j = 0 11 | self.x = 0 12 | self.y = 0 13 | self.down_z = 0 14 | self.up_z = 20 15 | self.up = True 16 | self.units_to_mm = 0.01 17 | 18 | def ParsePuOrPd(self, up): 19 | self.line_index = self.line_index + 1 20 | x = self.get_number() 21 | if len(x) > 0: 22 | y = self.get_number() 23 | if len(y) > 0: 24 | if up: color = "rapid" 25 | else: color = "feed" 26 | self.add_word(color) 27 | self.writer.begin_path(color) 28 | if up: z = self.up_z 29 | else: z = self.down_z 30 | if self.up != up: 31 | self.writer.add_line(self.x * self.units_to_mm, self.y * self.units_to_mm, z) 32 | self.writer.add_line(int(x) * self.units_to_mm, int(y) * self.units_to_mm, z) 33 | self.writer.end_path() 34 | self.up = up 35 | self.x = int(x) 36 | self.y = int(y) 37 | 38 | def ParseAA(self): 39 | self.line_index = self.line_index + 1 40 | cx = self.get_number() 41 | if len(cx) > 0: 42 | cy = self.get_number() 43 | if len(cy) > 0: 44 | a = self.get_number() 45 | if len(a) > 0: 46 | self.add_word("feed") 47 | self.writer.begin_path("feed") 48 | z = self.down_z 49 | if self.up: 50 | self.writer.add_line(self.x * self.units_to_mm, self.y * self.units_to_mm, z) 51 | 52 | sdx = self.x - int(cx) 53 | sdy = self.y - int(cy) 54 | 55 | start_angle = math.atan2(sdy, sdx) 56 | 57 | end_angle = start_angle + int(a) * math.pi/180 58 | 59 | radius = math.sqrt(sdx*sdx + sdy*sdy) 60 | 61 | ex = int(cx) + radius * math.cos(end_angle) 62 | ey = int(cy) + radius * math.sin(end_angle) 63 | 64 | if int(a) > 0: d = 1 65 | else: d = -1 66 | 67 | self.writer.add_arc(ex * self.units_to_mm, ey * self.units_to_mm, 0.0, int(-sdx) * self.units_to_mm, int(-sdy) * self.units_to_mm, d) 68 | self.writer.end_path() 69 | self.up = False 70 | self.x = int(ex) 71 | self.y = int(ey) 72 | 73 | def ParseFromFirstLetter(self, c): 74 | if c == 'P': 75 | self.line_index = self.line_index + 1 76 | if self.line_index < self.line_length: 77 | c1 = self.line[self.line_index] 78 | self.parse_word += c1 79 | if c1 == 'U': # PU 80 | self.ParsePuOrPd(True) 81 | elif c1 == 'D': # PD 82 | self.ParsePuOrPd(False) 83 | elif c == 'A': 84 | self.line_index = self.line_index + 1 85 | if self.line_index < self.line_length: 86 | c1 = self.line[self.line_index] 87 | self.parse_word += c1 88 | if c1 == 'A': # AA, arc absolute 89 | self.ParseAA() 90 | 91 | -------------------------------------------------------------------------------- /nc/hpgl2dv.py: -------------------------------------------------------------------------------- 1 | # hpgl2dv.py 2 | # 3 | # Copyright (c) 2009, Dan Heeks 4 | # This program is released under the BSD license. See the file COPYING for details. 5 | # 6 | 7 | # This is the same as the hpgl2d machine, but uses units of 0.25mm instead of 0.01mm 8 | 9 | import nc 10 | import hpgl2d 11 | 12 | class Creator(hpgl2d.Creator): 13 | def init(self): 14 | hpgl2d.Creator.init(self) 15 | 16 | def imperial(self): 17 | self.units_to_mc_units = 101.6 # multiplier from inches to machine units 18 | 19 | def metric(self): 20 | self.units_to_mc_units = 4 # multiplier from mm to machine units 21 | 22 | nc.creator = Creator() 23 | -------------------------------------------------------------------------------- /nc/hpgl2dv_read.py: -------------------------------------------------------------------------------- 1 | import hpgl2d_read as hpgl 2 | import sys 3 | 4 | # same as hpgl2d, but with 0.25mm units, instead of 0.01mm 5 | 6 | class Parser(hpgl.Parser): 7 | def __init__(self, writer): 8 | hpgl.Parser.__init__(self, writer) 9 | self.units_to_mm = 0.25 10 | -------------------------------------------------------------------------------- /nc/hpgl3d.py: -------------------------------------------------------------------------------- 1 | # hpgl3d.py 2 | # 3 | # Copyright (c) 2009, Dan Heeks 4 | # This program is released under the BSD license. See the file COPYING for details. 5 | # 6 | 7 | import nc 8 | import hpgl2d 9 | import math 10 | 11 | class Creator(hpgl2d.Creator): 12 | def __init__(self): 13 | hpgl2d.Creator.__init__(self) 14 | self.z = int(0) 15 | self.metric() # set self.units_to_mc_units 16 | self.doing_rapid = True 17 | 18 | def program_begin(self, id, name=''): 19 | self.write(';;^IN;!MC0;\n') 20 | self.write('V50.0;^PR;Z0,0,10500;^PA;\n') 21 | self.write('!RC15;\n') 22 | self.write('!MC1;\n') 23 | 24 | def program_end(self): 25 | self.write('!VZ50.0;!ZM0;\n') 26 | self.write('!MC0;^IN;\n') 27 | 28 | def get_machine_xyz(self, x=None, y=None, z=None): 29 | machine_x = self.x 30 | machine_y = self.y 31 | machine_z = self.z 32 | if x != None: 33 | machine_x = self.closest_int(x * self.units_to_mc_units) 34 | if y != None: 35 | machine_y = self.closest_int(y * self.units_to_mc_units) 36 | if z != None: 37 | machine_z = self.closest_int(z * self.units_to_mc_units) 38 | return machine_x, machine_y, machine_z 39 | 40 | def rapid(self, x=None, y=None, z=None, a=None, b=None, c=None): 41 | # do a rapid move. 42 | # for now, do all rapid moves at V50 ( 50 mm/s ) 43 | mx, my, mz = self.get_machine_xyz(x, y, z) 44 | if mx != self.x or my != self.y or mz != self.z: 45 | if self.doing_rapid == False: self.write('V50.0;') 46 | self.write(('Z%i' % mx) + (',%i' % my) + (',%i;\n' % mz)) 47 | self.x = mx 48 | self.y = my 49 | self.z = mz 50 | self.doing_rapid = True 51 | 52 | def feed(self, x=None, y=None, z=None, a=None, b=None, c=None): 53 | # do a feed move. 54 | # for now, do all feed moves at V10 ( 10 mm/s ) 55 | mx, my, mz = self.get_machine_xyz(x, y, z) 56 | if mx != self.x or my != self.y or mz != self.z: 57 | if self.doing_rapid == True: self.write('V10.0;') 58 | self.write(('Z%i' % mx) + (',%i' % my) + (',%i;\n' % mz)) 59 | self.x = mx 60 | self.y = my 61 | self.z = mz 62 | self.doing_rapid = False 63 | 64 | nc.creator = Creator() 65 | -------------------------------------------------------------------------------- /nc/hpgl3d_read.py: -------------------------------------------------------------------------------- 1 | import num_reader 2 | import sys 3 | import math 4 | 5 | class Parser(num_reader.NumReader): 6 | 7 | def __init__(self, writer): 8 | num_reader.NumReader.__init__(self, writer) 9 | self.x = 0 10 | self.y = 0 11 | self.z = 10000 12 | self.f = 0 13 | self.units_to_mm = 0.01 14 | 15 | def ParseV(self): 16 | self.line_index = self.line_index + 1 17 | f = self.get_number() 18 | if len(f) > 0: 19 | self.f = float(f) 20 | self.add_word("prep") 21 | 22 | def ParseZ(self): 23 | self.line_index = self.line_index + 1 24 | x = self.get_number() 25 | if len(x) > 0: 26 | y = self.get_number() 27 | if len(y) > 0: 28 | z = self.get_number() 29 | if len(z) > 0: 30 | if self.f > 40: color = "rapid" 31 | else: color = "feed" 32 | self.add_word(color) 33 | self.writer.begin_path(color) 34 | self.writer.add_line(int(x) * self.units_to_mm, int(y) * self.units_to_mm, int(z) * self.units_to_mm) 35 | self.writer.end_path() 36 | self.x = int(x) 37 | self.y = int(y) 38 | self.z = int(z) 39 | 40 | def ParseFromFirstLetter(self, c): 41 | if c == 'Z': 42 | self.ParseZ() 43 | elif c == 'V': 44 | self.ParseV() 45 | 46 | -------------------------------------------------------------------------------- /nc/iso_codes.py: -------------------------------------------------------------------------------- 1 | class Codes(): 2 | pass 3 | 4 | codes = Codes() 5 | -------------------------------------------------------------------------------- /nc/iso_crc.py: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # iso_crc.py 3 | # 4 | # a class derived from iso machine, with Cutter Radius Compensation turned on. 5 | # 6 | # Dan Heeks, 4th May 2010 7 | 8 | import nc 9 | import iso 10 | import math 11 | 12 | ################################################################################ 13 | class Creator(iso.Creator): 14 | 15 | def __init__(self): 16 | iso.Creator.__init__(self) 17 | self.useCrc = True 18 | 19 | ################################################################################ 20 | 21 | nc.creator = Creator() 22 | -------------------------------------------------------------------------------- /nc/iso_modal.py: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # iso_modal.py 3 | # 4 | # a class derived from iso machine, but with XYZF G1, G2 etc modal to reduce the size of the file. 5 | # 6 | # Dan Heeks, 4th May 2010 7 | 8 | import nc.nc 9 | import nc.iso 10 | import math 11 | 12 | ################################################################################ 13 | class Creator(nc.iso.Creator): 14 | 15 | def __init__(self): 16 | nc.iso.Creator.__init__(self) 17 | self.f_modal = True 18 | self.g0123_modal = True 19 | self.drill_modal = True 20 | ################################################################################ 21 | 22 | nc.creator = Creator() 23 | -------------------------------------------------------------------------------- /nc/mach3.py: -------------------------------------------------------------------------------- 1 | import nc 2 | import iso 3 | 4 | class Creator(iso.Creator): 5 | def init(self): 6 | iso.Creator.init(self) 7 | 8 | def SPACE(self): return(' ') 9 | 10 | def program_begin(self, id, comment): 11 | self.write( ('(' + 'GCode created using the HeeksCNC Mach3 post processor' + ')' + '\n') ) 12 | self.write( ('(' + comment + ')' + '\n') ) 13 | 14 | def tool_change(self, id): 15 | self.write('G43H%i'% id +'\n') 16 | self.write((self.TOOL() % id) + '\n') 17 | self.t = id 18 | 19 | nc.creator = Creator() 20 | 21 | -------------------------------------------------------------------------------- /nc/machines.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /nc/mc1000vf.py: -------------------------------------------------------------------------------- 1 | import nc 2 | import iso_modal 3 | import math 4 | import datetime 5 | import time 6 | 7 | now = datetime.datetime.now() 8 | 9 | class Creator(iso_modal.Creator): 10 | def __init__(self): 11 | iso_modal.Creator.__init__(self) 12 | #self.output_block_numbers = False 13 | self.output_tool_definitions = False 14 | self.output_h_and_d_at_tool_change=True 15 | 16 | def SPACE(self): 17 | return '' 18 | def TOOL(self): return('G53G0Z0.0\nT%iM6') 19 | 20 | def PROGRAM_END(self): return( 'G53G0Z0.0\nG53G0X-600.0Y0.0\nM30') 21 | def ABSOLUTE(self): return('G90\n') 22 | 23 | def set_plane(self, plane): 24 | return 25 | 26 | def tool_change(self, id): 27 | if self.output_comment_before_tool_change: 28 | self.comment('tool change to ' + self.tool_defn_params[id]['name']); 29 | 30 | if self.output_cutviewer_comments: 31 | import cutviewer 32 | if id in self.tool_defn_params: 33 | cutviewer.tool_defn(self, id, self.tool_defn_params[id]) 34 | if (self.t != None) and (self.z_for_g53 != None): 35 | self.write('G53 Z' + str(self.z_for_g53) + '\n') 36 | self.write(self.SPACE() + (self.TOOL() % id)) 37 | if self.output_g43_on_tool_change_line == True: 38 | self.write(self.SPACE() + 'G43') 39 | self.write('\n') 40 | if self.output_h_and_d_at_tool_change == True: 41 | if self.output_g43_on_tool_change_line == False: 42 | self.write(self.SPACE() + 'G43') 43 | self.write(self.SPACE() + 'D' + str(id) + self.SPACE() + 'H' + str(id) + '\n') 44 | self.write('G54\n') 45 | 46 | self.t = id 47 | self.move_done_since_tool_change = False 48 | 49 | def metric(self): 50 | self.g_list.append(self.METRIC()) 51 | self.fmt.number_of_decimal_places = 3 52 | self.fmt.add_trailing_zeros = True 53 | 54 | 55 | 56 | nc.creator = Creator() 57 | 58 | -------------------------------------------------------------------------------- /nc/num_reader.py: -------------------------------------------------------------------------------- 1 | import nc_read as nc 2 | import sys 3 | import math 4 | 5 | # a base class for hpgl parsers, and maybe others 6 | 7 | class NumReader(nc.Parser): 8 | 9 | def __init__(self, writer): 10 | nc.Parser.__init__(self, writer) 11 | 12 | def get_number(self): 13 | number = '' 14 | 15 | # skip spaces and commas at start of number 16 | while(self.line_index < self.line_length): 17 | c = self.line[self.line_index] 18 | if c == ' ' or c == ',': 19 | self.parse_word += c 20 | else: 21 | break 22 | self.line_index = self.line_index + 1 23 | 24 | while(self.line_index < self.line_length): 25 | c = self.line[self.line_index] 26 | if c == '.' or c == '0' or c == '1' or c == '2' or c == '3' or c == '4' or c == '5' or c == '6' or c == '7' or c == '8' or c == '9' or c == '-': 27 | number += c 28 | else: 29 | break 30 | self.parse_word += c 31 | self.line_index = self.line_index + 1 32 | 33 | return number 34 | 35 | def add_word(self, color): 36 | self.writer.add_text(self.parse_word, color, None) 37 | self.parse_word = "" 38 | 39 | def Parse(self, name): 40 | self.file_in = open(name, 'r') 41 | 42 | while self.readline(): 43 | self.writer.begin_ncblock() 44 | 45 | self.parse_word = "" 46 | self.line_index = 0 47 | self.line_length = len(self.line) 48 | 49 | while self.line_index < self.line_length: 50 | c = self.line[self.line_index] 51 | self.parse_word += c 52 | 53 | self.ParseFromFirstLetter(c) 54 | 55 | self.line_index = self.line_index + 1 56 | 57 | self.writer.add_text(self.parse_word, None, None) 58 | 59 | self.writer.end_ncblock() 60 | 61 | self.file_in.close() 62 | 63 | 64 | -------------------------------------------------------------------------------- /nc/printbot3d.py: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # printbot3d.py 3 | # 4 | # Dan Heeks 18th October 2010 5 | 6 | import nc 7 | import iso_modal 8 | import math 9 | 10 | ################################################################################ 11 | class CreatorPrintbot(iso_modal.CreatorIsoModal): 12 | 13 | def __init__(self): 14 | iso_modal.CreatorIsoModal.__init__(self) 15 | 16 | def tool_defn(self, id, name='', params=None): 17 | pass 18 | 19 | def write_blocknum(self): 20 | pass 21 | 22 | def set_plane(self, plane): 23 | pass 24 | 25 | def workplane(self, id): 26 | pass 27 | 28 | # Extruder Control 29 | 30 | def extruder_on(self): 31 | self.write('M101\n') 32 | 33 | def extruder_off(self): 34 | self.write('M103\n') 35 | 36 | def set_extruder_flowrate(self, flowrate): 37 | # re-use the spindle speed function 38 | self.spindle(flowrate, True) 39 | 40 | def extruder_temp(self, temp): 41 | self.write((maker.codes.EXTRUDER_TEMP(temp)) + ('\n')) 42 | 43 | # General 44 | def rapid(x=None, y=None, z=None, a=None, b=None, c=None): 45 | # do a G1 even for rapid moves 46 | iso_modal.CreatorIsoModal.feed(self, x, y, z) 47 | 48 | def feed(self, x=None, y=None, z=None, a = None, b = None, c = None): 49 | iso_modal.CreatorIsoModal.feed(self, x, y, z) 50 | 51 | ################################################################################ 52 | 53 | nc.creator = CreatorPrintbot() 54 | -------------------------------------------------------------------------------- /nc/printbot3d_read.py: -------------------------------------------------------------------------------- 1 | import iso_read as iso 2 | import sys 3 | 4 | # based on the iso reader 5 | 6 | class Parser(iso.Parser): 7 | def __init__(self, writer): 8 | iso.Parser.__init__(self, writer) 9 | 10 | def ParseWord(self, word): 11 | iso.Parser.ParseWord(self, word) 12 | if (word == 'M103'): 13 | self.path_col = "rapid" 14 | self.col = "rapid" 15 | elif (word == 'M101'): 16 | self.path_col = "feed" 17 | self.col = "feed" 18 | -------------------------------------------------------------------------------- /nc/series1.py: -------------------------------------------------------------------------------- 1 | import nc 2 | import iso_modal 3 | import math 4 | 5 | ################################################################################ 6 | class Creator(iso_modal.Creator): 7 | 8 | def __init__(self): 9 | iso_modal.Creator.__init__(self) 10 | self.arc_centre_positive = True 11 | self.drillExpanded = True 12 | self.can_do_helical_arcs = False 13 | self.fmt.number_of_decimal_places = 2 14 | 15 | def tool_defn(self, id, name='', params=None): 16 | pass 17 | 18 | def dwell(self, t): 19 | # to do, find out what dwell is on this machine 20 | pass 21 | 22 | def metric(self): 23 | iso_modal.Creator.metric(self) 24 | self.fmt.number_of_decimal_places = 2 25 | 26 | def SPACE(self): 27 | return('') 28 | 29 | ################################################################################ 30 | 31 | nc.creator = Creator() 32 | -------------------------------------------------------------------------------- /nc/series1_read.py: -------------------------------------------------------------------------------- 1 | import iso_read as iso 2 | import sys 3 | 4 | # use the iso reader, but with i_and_j_always_positive 5 | 6 | class Parser(iso.Parser): 7 | def __init__(self, writer): 8 | iso.Parser.__init__(self, writer) 9 | self.arc_centre_positive = True 10 | -------------------------------------------------------------------------------- /nc/siegkx1.py: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # siegkx1.py 3 | # 4 | # Post Processor for the Sieg KX1 machine 5 | # It is just an ISO machine, but I don't want the tool definition lines 6 | # 7 | # Dan Heeks, 5th March 2009 8 | 9 | import nc.nc 10 | import nc.iso_modal 11 | import math 12 | import datetime 13 | 14 | now = datetime.datetime.now() 15 | 16 | ################################################################################ 17 | class Creator(nc.iso_modal.Creator): 18 | 19 | def __init__(self): 20 | nc.iso_modal.Creator.__init__(self) 21 | self.output_tool_definitions = False 22 | self.output_time_created = True 23 | 24 | def GetTitle(self): 25 | return 'siegkx1' 26 | 27 | nc.nc.creator = Creator() 28 | -------------------------------------------------------------------------------- /nc/swap.py: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # attach.py 3 | # 4 | # NC code creator for attaching Z coordinates to a surface 5 | # 6 | 7 | import recreator 8 | import nc 9 | 10 | swap = False 11 | 12 | PUT_Y_VALUE_IN_A = 1 13 | 14 | ################################################################################ 15 | class Creator(recreator.Redirector): 16 | 17 | def __init__(self, original, type, factor): 18 | recreator.Redirector.__init__(self, original) 19 | self.factor = factor 20 | self.type = type 21 | 22 | def feed(self, x=None, y=None, z=None, a=None, b=None, c=None): 23 | if self.type == PUT_Y_VALUE_IN_A: 24 | a = None 25 | if y != None: a = y * self.factor 26 | self.original.feed(x, None, z, a, b, c) 27 | 28 | def rapid(self, x=None, y=None, z=None, a=None, b=None, c=None): 29 | if self.type == PUT_Y_VALUE_IN_A: 30 | a = None 31 | if y != None: a = y * self.factor 32 | self.original.rapid(x, None, z, a, b, c) 33 | 34 | def arc(self, x=None, y=None, z=None, i=None, j=None, k=None, r=None, ccw = True): 35 | # to do 36 | pass 37 | 38 | ################################################################################ 39 | 40 | def use_a_for_y(radius): 41 | cancel_swap() 42 | if radius < 0.001: 43 | return 44 | global swap 45 | radians_factor = 1 / radius 46 | factor = radians_factor * 180 / 3.1415926535897932384 47 | nc.creator = Creator(nc.creator, PUT_Y_VALUE_IN_A, factor) 48 | swap = True 49 | 50 | def cancel_swap(): 51 | global swap 52 | if swap: 53 | nc.creator = nc.creator.original 54 | swap = False 55 | -------------------------------------------------------------------------------- /nc/tnc151.py: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # tnc151.py 3 | # 4 | # Post Processor for the Heidenhain TNC151 machine 5 | # 6 | 7 | import nc 8 | import iso_modal 9 | import math 10 | 11 | ################################################################################ 12 | class Creator(iso_modal.Creator): 13 | 14 | def __init__(self): 15 | iso_modal.Creator.__init__(self) 16 | self.fmt.add_plus = True 17 | self.fmt.add_trailing_zeros = True 18 | self.f.fmt.add_plus = True 19 | self.s.fmt.add_plus = True 20 | self.n = 1 21 | self.waiting_t = None 22 | self.waiting_for_program_begin = False 23 | 24 | ######## Codes 25 | 26 | def SPACE(self): return(' ') 27 | def TOOL(self): return('T%i') 28 | 29 | ######## Overridden functions 30 | 31 | def write_blocknum(self): 32 | self.write(self.BLOCK() % self.n) 33 | self.n += 1 34 | 35 | def program_begin(self, id, name=''): 36 | self.waiting_for_program_begin = True 37 | 38 | def write_waiting_program_begin(self): 39 | if self.waiting_for_program_begin == True: 40 | self.write('% 123') 41 | self.waiting_for_program_begin = False 42 | 43 | def imperial(self): 44 | self.write_waiting_program_begin() 45 | self.write(' G70\n') 46 | self.fmt.number_of_decimal_places = 4 47 | 48 | def metric(self): 49 | self.write_waiting_program_begin() 50 | self.write(' G71\n') 51 | self.fmt.number_of_decimal_places = 3 52 | 53 | 54 | # no tool definition lines wanted 55 | def tool_defn(self, id, name='', params=None): 56 | pass 57 | 58 | # no comments wanted 59 | def comment(self, text): 60 | pass 61 | 62 | def spindle(self, s, clockwise): 63 | iso_modal.Creator.spindle(self, s, clockwise) 64 | self.write_waiting_tool_change() 65 | 66 | def tool_change(self, id): 67 | self.waiting_t = id 68 | 69 | def write_waiting_tool_change(self): 70 | if self.waiting_t: 71 | if len(self.g_list) > 0: 72 | self.write_blocknum() 73 | for g in self.g_list: 74 | self.write(self.SPACE() + g) 75 | self.g_list = [] 76 | self.write('\n') 77 | self.write_blocknum() 78 | self.write(self.SPACE() + (self.TOOL() % self.waiting_t)) 79 | self.write_preps() 80 | self.write_spindle() 81 | self.write_misc() 82 | self.write('\n') 83 | self.t = self.waiting_t 84 | self.waiting_t = None 85 | 86 | def workplane(self, id): 87 | pass 88 | ################################################################################ 89 | 90 | nc.creator = Creator() 91 | -------------------------------------------------------------------------------- /test.bat: -------------------------------------------------------------------------------- 1 | "C:\Users\Dan Heeks\AppData\Local\Programs\Python\Python36-32\python" test.py 2 | pause -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | from CamApp import CamApp 2 | app = CamApp() 3 | app.MainLoop() 4 | -------------------------------------------------------------------------------- /ubuntu_build.sh: -------------------------------------------------------------------------------- 1 | TEMP_FOLDER=/tmp/Heeks2 2 | cd ~/PyCAD 3 | git pull 4 | cd CAD/build 5 | make 6 | cp cad.so ../../ 7 | cd ~/PyCAD/Step/build 8 | make 9 | cp step.so ../../ 10 | cd ~/PyCAD/Geom/build 11 | make 12 | cp geom.so ../../ 13 | cd ~/PyCAM 14 | git pull 15 | cd CAM/build 16 | make 17 | cp cam.so ../../ 18 | 19 | # make zip file 20 | cd ../../../ 21 | rm -r $TEMP_FOLDER 22 | rm Heeks2.zip 23 | mkdir $TEMP_FOLDER 24 | mkdir $TEMP_FOLDER/PyCAD 25 | cp PyCAD/*.py $TEMP_FOLDER/PyCAD 26 | cp PyCAD/heekscad.png $TEMP_FOLDER/PyCAD 27 | cp PyCAD/cad.so $TEMP_FOLDER/PyCAD 28 | cp PyCAD/geom.so $TEMP_FOLDER/PyCAD 29 | cp PyCAD/step.so $TEMP_FOLDER/PyCAD 30 | mkdir $TEMP_FOLDER/PyCAD/bitmaps 31 | mkdir $TEMP_FOLDER/PyCAD/bitmaps/angle 32 | mkdir $TEMP_FOLDER/PyCAD/bitmaps/mirror 33 | mkdir $TEMP_FOLDER/PyCAD/icons 34 | cp PyCAD/bitmaps/*.png $TEMP_FOLDER/PyCAD/bitmaps 35 | cp PyCAD/bitmaps/angle/*.png $TEMP_FOLDER/PyCAD/bitmaps/angle 36 | cp PyCAD/bitmaps/mirror/*.png $TEMP_FOLDER/PyCAD/bitmaps/mirror 37 | cp PyCAD/icons/*.png $TEMP_FOLDER/PyCAD/icons 38 | 39 | # copy wx - to do only user what is needed 40 | mkdir $TEMP_FOLDER/lib 41 | mkdir $TEMP_FOLDER/lib/wx 42 | echo 'copying wx files' 43 | SITE_PACKAGES=/home/dan/.local/lib/python3.8/site-packages 44 | cp $SITE_PACKAGES/wx/*.py $TEMP_FOLDER/lib/wx 45 | cp $SITE_PACKAGES/wx/*.so $TEMP_FOLDER/lib/wx 46 | cp $SITE_PACKAGES/wx/*.so.5 $TEMP_FOLDER/lib/wx 47 | 48 | # copy reportlab 49 | #cd PyCAM 50 | #python coppy.py $SITE_PACKAGES/reportlab $TEMP_FOLDER/lib/reportlab 51 | #cd ../ 52 | 53 | # copy boost and opencascade libraries 54 | echo 'copy other libraries' 55 | cp /usr/local/lib/*.so.11 $TEMP_FOLDER/lib 56 | cp /usr/local/lib/libboost_python38.so.1.76.0 $TEMP_FOLDER/lib 57 | 58 | echo 'copying PyCAM' 59 | mkdir $TEMP_FOLDER/PyCAM 60 | mkdir $TEMP_FOLDER/PyCAM/icons 61 | mkdir $TEMP_FOLDER/PyCAM/bitmaps 62 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/depthop 63 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/drilling 64 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/pattern 65 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/pocket 66 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/profile 67 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/stock 68 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/surface 69 | mkdir $TEMP_FOLDER/PyCAM/bitmaps/tool 70 | mkdir $TEMP_FOLDER/PyCAM/nc 71 | cp PyCAM/*.py $TEMP_FOLDER/PyCAM 72 | cp PyCAM/cam.so $TEMP_FOLDER/PyCAM 73 | cp PyCAM/default.tooltable $TEMP_FOLDER/PyCAM 74 | cp PyCAM/bitmaps/*.png $TEMP_FOLDER/PyCAM/bitmaps 75 | cp PyCAM/bitmaps/depthop/*.png $TEMP_FOLDER/PyCAM/bitmaps/depthop 76 | cp PyCAM/bitmaps/drilling/*.png $TEMP_FOLDER/PyCAM/bitmaps/drilling 77 | cp PyCAM/bitmaps/pattern/*.png $TEMP_FOLDER/PyCAM/bitmaps/pattern 78 | cp PyCAM/bitmaps/pocket/*.png $TEMP_FOLDER/PyCAM/bitmaps/pocket 79 | cp PyCAM/bitmaps/profile/*.png $TEMP_FOLDER/PyCAM/bitmaps/profile 80 | cp PyCAM/bitmaps/stock/*.png $TEMP_FOLDER/PyCAM/bitmaps/stock 81 | cp PyCAM/bitmaps/surface/*.png $TEMP_FOLDER/PyCAM/bitmaps/surface 82 | cp PyCAM/bitmaps/tool/*.png $TEMP_FOLDER/PyCAM/bitmaps/tool 83 | cp PyCAM/icons/*.png $TEMP_FOLDER/PyCAM/icons 84 | cp PyCAM/nc/*.py $TEMP_FOLDER/PyCAM/nc 85 | cp PyCAM/nc/*.xml $TEMP_FOLDER/PyCAM/nc 86 | 87 | # make a run file 88 | touch $TEMP_FOLDER/run.sh 89 | chmod u+x $TEMP_FOLDER/run.sh 90 | echo 'export LD_LIBRARY_PATH="../lib"'>>$TEMP_FOLDER/run.sh 91 | echo 'export PYTHONPATH="../lib"'>>$TEMP_FOLDER/run.sh 92 | echo 'cd PyCAM'>>$TEMP_FOLDER/run.sh 93 | echo 'python3 test.py'>>$TEMP_FOLDER/run.sh 94 | echo 'read -p "press Enter to finish..."'>>$TEMP_FOLDER/run.sh 95 | 96 | cd /tmp 97 | echo 'making zip file...' 98 | zip -r -q /home/dan/Heeks2.zip Heeks2 99 | echo 'finished' 100 | 101 | --------------------------------------------------------------------------------