Example Toolpath Code
Jump to navigation
Jump to search
These are Code Examples for toolpaths.
Creat_Pocketing_Toolpath
function CreatePocketingToolpath(name, start_depth, cut_depth, tool_dia, tool_stepdown, tool_stepover_percent, tool_in_mm) --[[ ------------ CreatePocketingToolpath ------------ || ===================================================== | Create a Pocketing toolpath within the program for the currently selected vectors | Parameters: | name, -- Name for toolpath | start_depth -- Start depth for toolpath below surface of material | cut_depth -- cut depth for pocket toolpath | tool_dia -- diameter of end mill to use | tool_stepdown -- stepdown for tool | tool_stepover_percent -- percentage stepover for tool | tool_in_mm -- true if tool size and stepdown are in mm || =====================================================]] -- Return Values: -- true if toolpath created OK else false -- Create tool we will use to machine vectors local tool = Tool("Lua End Mill",Tool.END_MILL -- BALL_NOSE, END_MILL, VBIT) tool.InMM = tool_in_mm tool.ToolDia = tool_dia tool.Stepdown = tool_stepdown tool.Stepover = tool_dia * (tool_stepover_percent / 100) tool.RateUnits = Tool.MM_SEC -- MM_SEC, MM_MIN, METRES_MIN, INCHES_SEC,... tool.FeedRate = 30 tool.PlungeRate = 10 tool.SpindleSpeed = 20000 tool.ToolNumber = 1 tool.VBitAngle = 90.0 -- used for vbit only tool.ClearStepover = tool_dia * (tool_stepover_percent / 100) -- used for vbit only -- Create object used to set home position and safez gap above material surface local pos_data = ToolpathPosData() pos_data:SetHomePosition(0, 0, 5.0) pos_data.SafeZGap = 5.0 -- Create object used to pass pocketing options local pocket_data = PocketParameterData() -- start depth for toolpath pocket_data.StartDepth = start_depth -- cut depth for toolpath this is depth below start depth pocket_data.CutDepth = cut_depth -- direction of cut for offet clearance - ProfileParameterData.CLIMB_DIRECTION or -- ProfileParameterData.CONVENTIONAL_DIRECTION - NOTE: enum from ProfileParameterData pocket_data.CutDirection = ProfileParameterData.CLIMB_DIRECTION -- Allowance to leave on when machining pocket_data.Allowance = 0.0 -- if true use raster clearance strategy , else use offset area clearance pocket_data.DoRasterClearance = true -- angle for raster if using raster clearance pocket_data.RasterAngle = 0 -- type of profile pass to perform PocketParameterData.PROFILE_NONE , -- PocketParameterData.PROFILE_FIRST orPocketParameterData.PROFILE_LAST pocket_data.ProfilePassType = PocketParameterData.PROFILE_LAST -- if true we ramp into pockets (always zig-zag) pocket_data.DoRamping = false -- if ramping, distance to ramp over pocket_data.RampDistance = 10.0 -- if true in Aspire, project toolpath onto composite model pocket_data.ProjectToolpath = false -- Create object which can be used to automatically select geometry local geometry_selector = GeometrySelector() -- if this is true we create 2d toolpaths previews in 2d view, if false we dont local create_2d_previews = true -- if this is true we will display errors and warning to the user local display_warnings = true -- if we are doing two tool pocketing define tool to use for area clearance local area_clear_tool = nill -- we just create a tool twice as large for testing here area_clear_tool = Tool("Lua Clearance End Mill",Tool.END_MILL) -- BALL_NOSE, END_MILL, VBIT area_clear_tool.InMM = tool_in_mm area_clear_tool.ToolDia = tool_dia * 2 area_clear_tool.Stepdown = tool_stepdown * 2 area_clear_tool.Stepover = tool_dia * 2 *(tool_stepover_percent / 100) area_clear_tool.RateUnits = Tool.MM_SEC -- MM_SEC, MM_MIN, METRES_MIN, INCHES_SEC.. area_clear_tool.FeedRate = 30 area_clear_tool.PlungeRate = 10 area_clear_tool.SpindleSpeed = 20000 area_clear_tool.ToolNumber = 1 area_clear_tool.VBitAngle = 90.0 -- used for vbit only area_clear_tool.ClearStepover = tool_dia*2*(tool_stepover_percent/100) -- used for vbit -- Create our toolpath local toolpath_manager = ToolpathManager() local toolpath_id = toolpath_manager:CreatePocketingToolpath(name, tool, area_clear_tool, pocket_data, pos_data, geometry_selector, create_2d_previews, display_warnings) if toolpath_id == nill then DisplayMessageBox("Error creating toolpath") return false end -- if end return true end -- function end
References
Please Note: The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 2.05, published September 12, 2018. by Vectric Ltd. Most current document from Vertric can be downloaded at Vertric Developer Information