0
0
CNC Programmingscripting~30 mins

Importing geometry for machining in CNC Programming - Mini Project: Build & Apply

Choose your learning style9 modes available
Importing geometry for machining
📖 Scenario: You are preparing a CNC machine program to cut a simple part. The part's shape is defined by a list of 2D points representing its outline. You want to import this geometry data into your CNC program and process it step-by-step.
🎯 Goal: Build a CNC program script that imports the geometry points, sets a tolerance value, processes the points to filter those within the tolerance, and finally outputs the filtered points for machining.
📋 What You'll Learn
Create a list called geometry_points with exact 2D points: (0,0), (10,0), (10,10), (0,10), (5,5)
Create a variable called tolerance and set it to 5
Use a list comprehension called filtered_points to include only points where both x and y are less than or equal to tolerance
Print the filtered_points list
💡 Why This Matters
🌍 Real World
CNC programmers often import geometry data points to define tool paths for machining parts. Filtering points helps focus on relevant areas within machine limits.
💼 Career
Understanding how to import and process geometry data is essential for CNC programmers and manufacturing engineers to automate machining tasks efficiently.
Progress0 / 4 steps
1
Create the geometry points list
Create a list called geometry_points with these exact 2D points as tuples: (0, 0), (10, 0), (10, 10), (0, 10), and (5, 5).
CNC Programming
Need a hint?

Use square brackets [] to create a list and parentheses () for each point tuple.

2
Set the tolerance value
Create a variable called tolerance and set it to the number 5.
CNC Programming
Need a hint?

Just assign the number 5 to the variable named tolerance.

3
Filter points within tolerance
Use a list comprehension to create a new list called filtered_points that includes only points from geometry_points where both x and y coordinates are less than or equal to tolerance. Use for x, y in geometry_points in your comprehension.
CNC Programming
Need a hint?

Use a list comprehension with for x, y in geometry_points and an if condition to filter points.

4
Print the filtered points
Write a print statement to display the filtered_points list.
CNC Programming
Need a hint?

Use print(filtered_points) to show the filtered points.