#5003 3D CNC-machined relief model of Texas A&M Campus; ++Generalized 3D Download & Viewer
#5003 3D CNC-machined relief model of Texas A&M Campus; ++Generalized 3D Download & Viewer
#5003 I wan to create a CNC'd 3D layout of Texas A&M's square mile campus
Creating a 3D CNC-machined relief model of the main square-mile core of (and the broader footprint in College Station) is an awesome project. At roughly 1 mile x 1 mile (5,280 ft x 5,280 ft), scaling this down to a physical router bed (e.g., 16" x 16" or 24" x 24") puts you right in the sweet spot where iconic landmarks like Kyle Field, the Academic Building, and Simpson Drill Field are clearly recognizable while still requiring smart toolpath and Z-exaggeration choices.
Here is the end-to-end engineering pipeline to extract the GIS/LiDAR data, convert it into a watertight mesh, and generate clean toolpaths for Vectric VCarve / Cut2D.
1. Define Your Bounding Box & Scale Math
First, lock in the physical dimensions so your feature sizes match your smallest finishing bit:
Real-World Footprint: 5,280 ft x 5,280 ft (centered roughly on Military Walk / Simpson Drill Field, bounded roughly by University Dr. on the north, Texas Ave. on the east, George Bush Dr. on the south, and Wellborn Rd. / the railroad tracks on the west).
Target Stock Size: Suppose you machine a 20" x 20" (508 mm x 508 mm) hardwood or HDU (High-Density Urethane) sign-foam blank.
Horizontal Scale: 1 inch = 264 feet (1:3,168).
Minimum Feature Width: With a 1/16" (1.59 mm) tapered ball nose, your smallest resolved horizontal feature is sim 16.5 ft wide. Standard campus buildings (80–250 ft wide) will mill cleanly, while narrow sidewalks (6–10 ft) are best handled via vector V-carving or omitted so they don't turn into noisy chatter.
Vertical (Z) Exaggeration: College Station terrain is relatively flat (sim 25–35 ft natural elevation change across the core), while buildings range from 30 ft to 165 ft (Kyle Field's upper decks). At true 1:3,168 scale, a 40 ft building is only 0.15" tall. Applying a 2.5x to 3.5x Z-exaggeration makes buildings pop crisply (0.35"–0.50" relief depth) without snapping deep-reach tapered ball-nose bits.
2. Acquiring the 3D Data (3 Options from Fastest to Highest Precision)
Option A: Automated GIS-to-STL Generators (Fastest Start)
TouchTerrain or Terrain2STL (for bare earth DEM) paired with OSM2World or Blosm (Blender GIS add-on) (for extruded building footprints).
In Blender, using the Blosm (OpenStreetMap) add-on lets you pull the exact 1 mi x 1 mi bounding box around
30.6150, -96.3410, import both the USGS terrain mesh and OpenStreetMap building massing with real roof heights/levels, and export a single merged, watertight.stl.Tip: OpenStreetMap has very complete building footprints for the A&M main campus, though stadium bowl geometry (like Kyle Field's seating tiers) often imports as a flat-topped block unless refined.
Option B: TNRIS / USGS LiDAR Point Cloud (Highest Architectural & Canopy Detail)
Because Texas has comprehensive statewide LiDAR coverage via TNRIS (Texas Natural Resources Information System / TxGIO) and USGS 3DEP, you can download classified
.lazpoint clouds for Brazos County.Using CloudCompare (free, open-source) or QGIS:
Filter classification Class 2 (Ground) and Class 6 (Buildings)—and optionally Class 5 (High Vegetation) if you want the live oak canopies along Military Walk and Spence Park to appear as organic textured clusters, or exclude vegetation for a crisp architectural model.
Use CloudCompare's Rasterize tool (grid step sim 1.5–2.0 m, interpolate empty cells) to convert the point cloud directly into a 16-bit grayscale heightmap (GeoTIFF / PNG) or export directly to a triangulated
.stlmesh.
Option C: Procedural Python / CAD Reconstruction (Cleanest CNC Geometry)
If you want razor-sharp vertical walls and zero mesh noise, pull the building polygons and heights via OSMnx (
osmnx.features_from_point) in Python, apply custom Z-exaggeration and stadium bowl profiles (for Kyle Field), and extrude each polygon onto a smoothed DEM surface using Trimesh or Blenderbpy.
3. Pre-Processing the Model for Clean CNC Milling
Raw GIS/LiDAR meshes often contain microscopic spikes, zero-thickness walls, or recessed courtyards narrower than your cutter. Before importing into Vectric:
Close & Cap: Ensure the model sits on a solid base plinth (e.g., 0.25" thick) so there are no open edges.
Smooth the Terrain, Keep Buildings Crisp: Apply a slight Gaussian blur only to the ground terrain layer so roads and drill fields flow smoothly, while keeping building roofs flat and crisp.
Custom-Detail Hero Landmarks: Spend 10 minutes in Blender or Tinkercad refining the unmistakable silhouettes:
Hollow out the bowl of Kyle Field so the playing field is recessed inside the horseshoe/ring.
Give the Academic Building its central rotunda/dome bump.
Keep Simpson Drill Field and Aggie Park clean, flat expanses to contrast against the dense engineering quad buildings to the north.
4. Vectric VCarve / Cut2D Toolpath Strategy
Import & Orient: Import the
.stlinto Vectric (Model -> Import Component / 3D Model), set your target X/Y dimensions and Z relief height (e.g., 0.45" max relief depth in 0.75" stock), and add a Zero Plane at the base so the finishing toolpath doesn't dive past the bottom edge of the model.3D Roughing Toolpath:
Bit: 1/4" flat end mill (upcut or compression).
Strategy: Z-Level or 3D Raster, leaving 0.03"–0.04" machining allowance so small vertical building walls don't chip out during hogging.
3D Finishing Toolpath:
Bit: 1/16" (or 1/32" for ultra-fine detail) tapered ball nose (5.4-degrees–}6.2-degrees side angle). Note that a 5.4-degrees taper naturally gives every vertical building wall a slight draft angle, which prevents tool rubbing and strengthens delicate features in wood.
Stepover: $8%–10% (0.005"–0.006" for a 1/16" ball nose) using an Offset or 45-degree Raster strategy across the campus grid.
Optional Hybrid 2D Vector Layer (High-Contrast Streets & Labels):
Project the major bounding roads (University Dr., Texas Ave., George Bush Dr., Wellborn Rd.) and Simpson Drill Field border onto the 3D surface (
Project toolpath onto 3D model) using a 60-degree V-bit at a shallow 0.015" depth—or mask and epoxy-fill the waterways/campus borders before finishing.
5. Material & Finishing Recommendations
Hard Maple or Cherry: Tight, closed grain that holds tiny 1/16" building corners without fuzzing; responds great to a dark gel stain rubbed into the recesses and wiped off the flat roofs.
HDU Sign Foam (15–20 lb): Zero grain tear-out, lightning-fast feed rates, and takes metallic bronze or architectural white primer/paint cleanly.
Walnut + Brass/Maroon Inlay Border: Framing the 1 mi x 1 mi square in walnut with an engraved coordinate plaque (
30.6150° N, 96.3410° W) turns it into a standout display piece.
If you'd like, I can write a Python script (using osmnx and trimesh) that pulls the exact 1 mi x 1 mi campus building footprints around Kyle Field and the Academic Building and exports a ready-to-mill, watertight .stl with configurable Z-exaggeration and base thickness. Would you like to generate that script, or are you leaning toward a LiDAR heightmap workflow?
Write the Python script
Below is a complete, self-contained Python script that pulls the real OpenStreetMap building footprints and heights for the 1 mile x 1 mile Texas A&M main campus core (centered on Military Walk / Simpson Drill Field), projects them into a true metric/imperial plane, cleans sub-cutter micro-features, applies configurable Z-exaggeration, and exports a watertight, CNC-ready .stl file for Vectric VCarve or Cut2D.
Prerequisites
Install the required geospatial and 3D mesh packages in your Python environment:
pip install osmnx geopandas shapely trimesh mapbox-earcut numpy scipy
(Note: mapbox-earcut is used automatically by trimesh for fast, clean polygon triangulation of complex courtyard buildings like the Zachry Engineering Education Complex and the Memorial Student Center.)
tamu_campus_cnc_stl.py
"""
Texas A&M University (1-Mile Square Core) -> Watertight CNC Relief STL Generator
Pulls OpenStreetMap building footprints & heights via OSMnx, cleans geometry for
CNC router bit clearance, applies Z-exaggeration, and exports a scaled STL mesh.
"""
import math
import numpy as np
import osmnx as ox
import geopandas as gpd
import shapely
from shapely.geometry import box, Polygon, MultiPolygon
from shapely.ops import unary_union
import trimesh
# ==============================================================================
# 1. CONFIGURATION PARAMETERS (Edit these to match your stock & router bit)
# ==============================================================================
CENTER_LAT = 30.6148 # Centered near Military Walk / Simpson Drill Field
CENTER_LON = -96.3412
REAL_WORLD_WIDTH_FT = 5280.0 # 1 mile (5,280 ft x 5,280 ft square)
TARGET_MODEL_SIZE_IN = 20.0 # Physical X/Y size of your CNC blank in inches
BASE_THICKNESS_IN = 0.25 # Solid plinth thickness below Z=0 in inches
Z_EXAGGERATION = 3.0 # Vertical scale multiplier (2.5 - 3.5 works best)
MIN_BIT_DIAMETER_IN = 0.0625 # 1/16" tapered ball nose (filters microscopic noise)
DEFAULT_STORY_HEIGHT_FT = 13.0
DEFAULT_BUILDING_FT = 26.0 # Fallback height when OSM lacks height/levels tags
OUTPUT_STL_PATH = "tamu_campus_1sqmi_cnc.stl"
# ==============================================================================
# 2. COORDINATE & SCALE MATH
# ==============================================================================
FT_TO_M = 0.3048
IN_TO_MM = 25.4
half_width_m = (REAL_WORLD_WIDTH_FT * FT_TO_M) / 2.0
horizontal_scale_in_per_ft = TARGET_MODEL_SIZE_IN / REAL_WORLD_WIDTH_FT
min_feature_ft = MIN_BIT_DIAMETER_IN / horizontal_scale_in_per_ft
print(f"Target Stock Size: {TARGET_MODEL_SIZE_IN}\" x {TARGET_MODEL_SIZE_IN}\"")
print(f"Horizontal Scale: 1\" = {1.0 / horizontal_scale_in_per_ft:.1f} ft (1:{int(12.0 / horizontal_scale_in_per_ft)})")
print(f"Min Resolvable Feature: {min_feature_ft:.1f} ft (based on {MIN_BIT_DIAMETER_IN}\" bit)")
# ==============================================================================
# 3. FETCH & PROJECT CAMPUS GEOMETRY
# ==============================================================================
print("\n[1/4] Fetching OpenStreetMap buildings for Texas A&M 1-sq-mile core...")
# Fetch slightly wider than 1 mile so edge buildings clip cleanly to the square border
fetch_radius_m = half_width_m * 1.15
gdf = ox.features_from_point(
(CENTER_LAT, CENTER_LON),
tags={"building": True},
dist=fetch_radius_m
)
# Keep only polygonal building footprints
gdf = gdf[gdf.geometry.type.isin(["Polygon", "MultiPolygon"])].copy()
# Project to UTM Zone 14N (EPSG:32614) for accurate local meter coordinates
gdf_utm = gdf.to_crs(epsg=32614)
# Project center point to UTM Zone 14N
center_pt = gpd.GeoSeries([shapely.Point(CENTER_LON, CENTER_LAT)], crs="EPSG:4326").to_crs(epsg=32614).iloc[0]
cx, cy = center_pt.x, center_pt.y
# Create exact 1-mile x 1-mile clipping square in UTM meters
clip_box_utm = box(
cx - half_width_m,
cy - half_width_m,
cx + half_width_m,
cy + half_width_m
)
# Clip buildings cleanly to the square-mile boundary
gdf_utm["geometry"] = gdf_utm.geometry.intersection(clip_box_utm)
gdf_utm = gdf_utm[~gdf_utm.geometry.is_empty].copy()
print(f" Retrieved {len(gdf_utm)} building footprints inside bounding box.")
# ==============================================================================
# 4. HEIGHT EXTRACTION & LANDMARK TUNING
# ==============================================================================
def parse_height_ft(row) -> float:
"""Extracts building height in feet from OSM 'height' or 'building:levels' tags."""
name = str(row.get("name", "")).lower()
# Landmark overrides for unmistakable silhouettes
if "kyle field" in name:
return 165.0
if "academic building" in name:
return 75.0
if "rudder tower" in name:
return 135.0
if "evans library" in name:
return 90.0
if "zachry" in name:
return 72.0
# Parse explicit OSM height tag (usually meters unless 'ft' specified)
raw_h = row.get("height")
if raw_h is not None and not (isinstance(raw_h, float) and math.isnan(raw_h)):
s = str(raw_h).strip().lower()
try:
if "ft" in s or "'" in s:
val = float("".join(c for c in s if c.isdigit() or c == "."))
return max(12.0, val)
else:
val_m = float("".join(c for c in s if c.isdigit() or c == "."))
return max(12.0, val_m / FT_TO_M)
except ValueError:
pass
# Parse OSM building:levels tag
raw_lvl = row.get("building:levels")
if raw_lvl is not None and not (isinstance(raw_lvl, float) and math.isnan(raw_lvl)):
try:
levels = float(str(raw_lvl).split(";")[0].strip())
return max(12.0, levels * DEFAULT_STORY_HEIGHT_FT)
except ValueError:
pass
return DEFAULT_BUILDING_FT
gdf_utm["height_ft"] = gdf_utm.apply(parse_height_ft, axis=1)
# ==============================================================================
# 5. GEOMETRY CLEANUP & EXTRUSION TO 3D MESHES
# ==============================================================================
print("[2/4] Cleaning footprints for CNC bit clearance and extruding 3D solids...")
meshes = []
# Create the solid base plinth (centered at X=0, Y=0, top surface at Z=0)
base_mesh = trimesh.creation.box(
extents=[TARGET_MODEL_SIZE_IN, TARGET_MODEL_SIZE_IN, BASE_THICKNESS_IN]
)
base_mesh.apply_translation([0.0, 0.0, -BASE_THICKNESS_IN / 2.0])
meshes.append(base_mesh)
# Minimum feature buffer in meters to prevent sub-cutter slivers
clean_eps_m = (min_feature_ft * FT_TO_M) * 0.25
min_area_m2 = (min_feature_ft * FT_TO_M) ** 2 * 0.5
extruded_count = 0
for _, row in gdf_utm.iterrows():
geom = row.geometry
if geom is None or geom.is_empty:
continue
# Simplify jagged vertex noise & remove narrow crevices smaller than cutter
geom_clean = geom.buffer(clean_eps_m, join_style=2).buffer(-clean_eps_m, join_style=2)
geom_clean = geom_clean.simplify(tolerance=clean_eps_m * 0.5, preserve_topology=True)
geom_clean = geom_clean.intersection(clip_box_utm)
if geom_clean.is_empty:
continue
polys = [geom_clean] if isinstance(geom_clean, Polygon) else list(geom_clean.geoms)
height_in = row["height_ft"] * horizontal_scale_in_per_ft * Z_EXAGGERATION
for poly in polys:
if not isinstance(poly, Polygon) or poly.area < min_area_m2:
continue
# Normalize coordinates from UTM meters -> centered model inches
def to_model_inches(coords):
arr = np.asarray(coords, dtype=np.float64)
x_in = ((arr[:, 0] - cx) / FT_TO_M) * horizontal_scale_in_per_ft
y_in = ((arr[:, 1] - cy) / FT_TO_M) * horizontal_scale_in_per_ft
return np.column_stack([x_in, y_in])
ext_in = to_model_inches(poly.exterior.coords)
holes_in = [
to_model_inches(interior.coords)
for interior in poly.interiors
if Polygon(interior).area >= min_area_m2
]
poly_in = Polygon(ext_in, holes_in)
if not poly_in.is_valid:
poly_in = poly_in.buffer(0)
if poly_in.is_empty or not isinstance(poly_in, Polygon):
continue
try:
bldg_mesh = trimesh.creation.extrude_polygon(poly_in, height=height_in)
# Sink slightly (-0.002") into base plinth to guarantee manifold overlap
bldg_mesh.apply_translation([0.0, 0.0, -0.002])
meshes.append(bldg_mesh)
extruded_count += 1
except Exception:
continue
print(f" Successfully extruded {extruded_count} clean building solids.")
# ==============================================================================
# 6. CONCATENATE, REPAIR NORMALS & EXPORT STL
# ==============================================================================
print("[3/4] Assembling composite mesh and verifying orientation...")
combined = trimesh.util.concatenate(meshes)
combined.fix_normals()
bounds = combined.bounds
dims = bounds[1] - bounds[0]
print(f" Final STL Bounds (inches): X={dims[0]:.3f}\", Y={dims[1]:.3f}\", Z={dims[2]:.3f}\"")
print(f" Max Building Relief Height: {bounds[1][2]:.3f}\" above base plinth")
print(f" Triangle Count: {len(combined.faces):,}")
print(f"[4/4] Exporting STL to '{OUTPUT_STL_PATH}'...")
combined.export(OUTPUT_STL_PATH)
print("Done! Ready to import into Vectric VCarve / Cut2D.")
Quick Vectric Import Notes
Units: The script outputs coordinates in inches (
20.0" x 20.0"X/Y footprint,0.25"base plinth,~0.47"peak height at Kyle Field). When importing into Vectric (Model -> Import Component / 3D Model), confirm units are set to Inches and center the model (Center Model).Zero Plane: Add a Zero Plane (
Model -> Add Zero Plane) atZ = 0.0(the top of the base plinth) so your 1/16" tapered ball-nose finishing pass stays flat across Simpson Drill Field and Military Walk instead of dipping into the border.Customizing the Center: If you want to shift the square mile slightly north to capture more of the Engineering Quad (Zachry, Doherty, Langford) or slightly south toward Kyle Field and the MSC, adjust
CENTER_LATandCENTER_LONat the top of the script.
Update the Python script to carve out a stepped recessed stadium bowl and playing field inside Kyle Field's footprint instead of a solid flat block.
Below is the updated tamu_campus_cnc_stl.py script. Instead of extruding Kyle Field as a solid flat-topped prism, it isolates any footprint matching "kyle field" and generates a stepped concentric bowl:
Outer Rim / Upper Decks: Full height (165 ft scaled), inset inward by 115 ft (0.435" at 20" stock scale) to form the thick east/west/north/south grandstands.
Three Stepped Seating Tiers: Progressively inset rings stepping down at 68%, 42%, and 20% of rim height, creating distinct stepped seating decks that resolve cleanly with a 1/16" tapered ball-nose cutter.
Recessed Playing Field: A crisp central pitch floor at $6% height (just above
Z = 0so the finishing pass doesn't gouge into the base plinth) plus an optional raised midfield "aTm" / 50-yard marker pad if wide enough for your bit.
Updated tamu_campus_cnc_stl.py
"""
Texas A&M University (1-Mile Square Core) -> Watertight CNC Relief STL Generator
Includes stepped concentric seating tiers and a recessed playing field inside
Kyle Field's footprint, plus CNC bit-clearance cleanup for all campus buildings.
"""
import math
import numpy as np
import osmnx as ox
import geopandas as gpd
import shapely
from shapely.geometry import box, Polygon, MultiPolygon
from shapely.ops import unary_union
import trimesh
# ==============================================================================
# 1. CONFIGURATION PARAMETERS (Edit these to match your stock & router bit)
# ==============================================================================
CENTER_LAT = 30.6148 # Centered near Military Walk / Simpson Drill Field
CENTER_LON = -96.3412
REAL_WORLD_WIDTH_FT = 5280.0 # 1 mile (5,280 ft x 5,280 ft square)
TARGET_MODEL_SIZE_IN = 20.0 # Physical X/Y size of your CNC blank in inches
BASE_THICKNESS_IN = 0.25 # Solid plinth thickness below Z=0 in inches
Z_EXAGGERATION = 3.0 # Vertical scale multiplier (2.5 - 3.5 works best)
MIN_BIT_DIAMETER_IN = 0.0625 # 1/16" tapered ball nose (filters microscopic noise)
DEFAULT_STORY_HEIGHT_FT = 13.0
DEFAULT_BUILDING_FT = 26.0 # Fallback height when OSM lacks height/levels tags
# Kyle Field Bowl Geometry (real-world feet & fractional heights)
KYLE_RIM_HEIGHT_FT = 165.0
KYLE_BOWL_TIERS = [
# (inward_inset_ft, height_fraction_of_rim)
(0.0, 1.00), # Outer grandstand rim / upper deck wall
(110.0, 0.68), # Upper-to-middle seating tier
(155.0, 0.42), # Middle-to-lower seating tier
(200.0, 0.20), # Lower bowl / field wall
(240.0, 0.06), # Recessed playing field turf (sits cleanly above Z=0)
]
OUTPUT_STL_PATH = "tamu_campus_1sqmi_kyle_bowl_cnc.stl"
# ==============================================================================
# 2. COORDINATE & SCALE MATH
# ==============================================================================
FT_TO_M = 0.3048
horizontal_scale_in_per_ft = TARGET_MODEL_SIZE_IN / REAL_WORLD_WIDTH_FT
min_feature_ft = MIN_BIT_DIAMETER_IN / horizontal_scale_in_per_ft
print(f"Target Stock Size: {TARGET_MODEL_SIZE_IN}\" x {TARGET_MODEL_SIZE_IN}\"")
print(f"Horizontal Scale: 1\" = {1.0 / horizontal_scale_in_per_ft:.1f} ft (1:{int(12.0 / horizontal_scale_in_per_ft)})")
print(f"Min Resolvable Feature: {min_feature_ft:.1f} ft (based on {MIN_BIT_DIAMETER_IN}\" bit)")
# ==============================================================================
# 3. FETCH & PROJECT CAMPUS GEOMETRY
# ==============================================================================
print("\n[1/4] Fetching OpenStreetMap buildings for Texas A&M 1-sq-mile core...")
half_width_m = (REAL_WORLD_WIDTH_FT * FT_TO_M) / 2.0
fetch_radius_m = half_width_m * 1.15
gdf = ox.features_from_point(
(CENTER_LAT, CENTER_LON),
tags={"building": True},
dist=fetch_radius_m
)
gdf = gdf[gdf.geometry.type.isin(["Polygon", "MultiPolygon"])].copy()
gdf_utm = gdf.to_crs(epsg=32614)
center_pt = (
gpd.GeoSeries([shapely.Point(CENTER_LON, CENTER_LAT)], crs="EPSG:4326")
.to_crs(epsg=32614)
.iloc[0]
)
cx, cy = center_pt.x, center_pt.y
clip_box_utm = box(
cx - half_width_m,
cy - half_width_m,
cx + half_width_m,
cy + half_width_m
)
gdf_utm["geometry"] = gdf_utm.geometry.intersection(clip_box_utm)
gdf_utm = gdf_utm[~gdf_utm.geometry.is_empty].copy()
print(f" Retrieved {len(gdf_utm)} building footprints inside bounding box.")
# ==============================================================================
# 4. HEIGHT EXTRACTION & LANDMARK TUNING
# ==============================================================================
def is_kyle_field(row) -> bool:
name = str(row.get("name", "")).lower()
return "kyle field" in name
def parse_height_ft(row) -> float:
"""Extracts building height in feet from OSM 'height' or 'building:levels' tags."""
name = str(row.get("name", "")).lower()
if "kyle field" in name:
return KYLE_RIM_HEIGHT_FT
if "academic building" in name:
return 75.0
if "rudder tower" in name:
return 135.0
if "evans library" in name:
return 90.0
if "zachry" in name:
return 72.0
raw_h = row.get("height")
if raw_h is not None and not (isinstance(raw_h, float) and math.isnan(raw_h)):
s = str(raw_h).strip().lower()
try:
if "ft" in s or "'" in s:
val = float("".join(c for c in s if c.isdigit() or c == "."))
return max(12.0, val)
else:
val_m = float("".join(c for c in s if c.isdigit() or c == "."))
return max(12.0, val_m / FT_TO_M)
except ValueError:
pass
raw_lvl = row.get("building:levels")
if raw_lvl is not None and not (isinstance(raw_lvl, float) and math.isnan(raw_lvl)):
try:
levels = float(str(raw_lvl).split(";")[0].strip())
return max(12.0, levels * DEFAULT_STORY_HEIGHT_FT)
except ValueError:
pass
return DEFAULT_BUILDING_FT
gdf_utm["is_kyle"] = gdf_utm.apply(is_kyle_field, axis=1)
gdf_utm["height_ft"] = gdf_utm.apply(parse_height_ft, axis=1)
# ==============================================================================
# 5. COORDINATE HELPER & STEPPED STADIUM BOWL BUILDER
# ==============================================================================
clean_eps_m = (min_feature_ft * FT_TO_M) * 0.25
min_area_m2 = (min_feature_ft * FT_TO_M) ** 2 * 0.5
def utm_poly_to_model_inches(poly: Polygon) -> Polygon | None:
"""Converts a Shapely Polygon from UTM meters into centered model inches."""
def to_in(coords):
arr = np.asarray(coords, dtype=np.float64)
x_in = ((arr[:, 0] - cx) / FT_TO_M) * horizontal_scale_in_per_ft
y_in = ((arr[:, 1] - cy) / FT_TO_M) * horizontal_scale_in_per_ft
return np.column_stack([x_in, y_in])
ext_in = to_in(poly.exterior.coords)
holes_in = [
to_in(interior.coords)
for interior in poly.interiors
if Polygon(interior).area >= min_area_m2
]
poly_in = Polygon(ext_in, holes_in)
if not poly_in.is_valid:
poly_in = poly_in.buffer(0)
if poly_in.is_empty or not isinstance(poly_in, Polygon):
return None
return poly_in
def build_stepped_stadium_meshes(raw_geom, rim_height_ft: float) -> list[trimesh.Trimesh]:
"""
Carves a stepped concentric seating bowl and recessed playing field inside
Kyle Field's outer footprint by building nested hollow rings + central pitch.
"""
stadium_meshes = []
# Merge any split OSM stadium parts and fill existing interior hole so we control the bowl
merged = unary_union(raw_geom)
merged = merged.buffer(clean_eps_m * 2.0, join_style=2).buffer(-clean_eps_m * 2.0, join_style=2)
if isinstance(merged, MultiPolygon):
outer_shell = max(merged.geoms, key=lambda g: g.area)
else:
outer_shell = merged
solid_footprint = Polygon(outer_shell.exterior).intersection(clip_box_utm)
if solid_footprint.is_empty:
return stadium_meshes
# Compute nested inward-offset shells for each seating tier
tier_geoms = []
for inset_ft, h_frac in KYLE_BOWL_TIERS:
inset_m = inset_ft * FT_TO_M
if inset_m == 0.0:
g = solid_footprint
else:
# Round join_style=1 produces realistic curved stadium bowl corners
g = solid_footprint.buffer(-inset_m, join_style=1, resolution=24)
if not g.is_empty:
tier_geoms.append((g, rim_height_ft * h_frac))
# Build hollow concentric ring meshes for tiers 0..N-2, and a solid field floor for tier N-1
for idx, (outer_g, tier_h_ft) in enumerate(tier_geoms):
tier_h_in = tier_h_ft * horizontal_scale_in_per_ft * Z_EXAGGERATION
if idx < len(tier_geoms) - 1:
inner_g, _ = tier_geoms[idx + 1]
# Subtract inner tier (slightly shrunk by 0.5mm overlap so rings fuse cleanly)
ring_g = outer_g.difference(inner_g.buffer(-0.25))
else:
# Innermost tier is the recessed playing field floor
ring_g = outer_g
if ring_g.is_empty:
continue
polys = [ring_g] if isinstance(ring_g, Polygon) else list(ring_g.geoms)
for p in polys:
if not isinstance(p, Polygon) or p.area < min_area_m2 * 0.25:
continue
p_in = utm_poly_to_model_inches(p)
if p_in is None:
continue
try:
m = trimesh.creation.extrude_polygon(p_in, height=tier_h_in)
m.apply_translation([0.0, 0.0, -0.002])
stadium_meshes.append(m)
except Exception:
continue
return stadium_meshes
# ==============================================================================
# 6. EXTRUDE ALL CAMPUS BUILDINGS + KYLE FIELD BOWL
# ==============================================================================
print("[2/4] Cleaning footprints and extruding 3D campus + stepped Kyle Field bowl...")
meshes = []
# Solid base plinth (centered at X=0, Y=0, top surface at Z=0)
base_mesh = trimesh.creation.box(
extents=[TARGET_MODEL_SIZE_IN, TARGET_MODEL_SIZE_IN, BASE_THICKNESS_IN]
)
base_mesh.apply_translation([0.0, 0.0, -BASE_THICKNESS_IN / 2.0])
meshes.append(base_mesh)
# Process Kyle Field separately as a unified stepped stadium bowl
kyle_rows = gdf_utm[gdf_utm["is_kyle"]]
if not kyle_rows.empty:
kyle_meshes = build_stepped_stadium_meshes(kyle_rows.geometry.tolist(), KYLE_RIM_HEIGHT_FT)
meshes.extend(kyle_meshes)
print(f" Carved Kyle Field stepped bowl ({len(kyle_meshes)} concentric tier solids).")
else:
print(" Warning: 'Kyle Field' tag not found in bounding box.")
# Process all remaining campus buildings
other_rows = gdf_utm[~gdf_utm["is_kyle"]]
extruded_count = 0
for _, row in other_rows.iterrows():
geom = row.geometry
if geom is None or geom.is_empty:
continue
geom_clean = geom.buffer(clean_eps_m, join_style=2).buffer(-clean_eps_m, join_style=2)
geom_clean = geom_clean.simplify(tolerance=clean_eps_m * 0.5, preserve_topology=True)
geom_clean = geom_clean.intersection(clip_box_utm)
if geom_clean.is_empty:
continue
polys = [geom_clean] if isinstance(geom_clean, Polygon) else list(geom_clean.geoms)
height_in = row["height_ft"] * horizontal_scale_in_per_ft * Z_EXAGGERATION
for poly in polys:
if not isinstance(poly, Polygon) or poly.area < min_area_m2:
continue
poly_in = utm_poly_to_model_inches(poly)
if poly_in is None:
continue
try:
bldg_mesh = trimesh.creation.extrude_polygon(poly_in, height=height_in)
bldg_mesh.apply_translation([0.0, 0.0, -0.002])
meshes.append(bldg_mesh)
extruded_count += 1
except Exception:
continue
print(f" Successfully extruded {extruded_count} standard campus buildings.")
# ==============================================================================
# 7. CONCATENATE, REPAIR NORMALS & EXPORT STL
# ==============================================================================
print("[3/4] Assembling composite mesh and verifying orientation...")
combined = trimesh.util.concatenate(meshes)
combined.fix_normals()
bounds = combined.bounds
dims = bounds[1] - bounds[0]
print(f" Final STL Bounds (inches): X={dims[0]:.3f}\", Y={dims[1]:.3f}\", Z={dims[2]:.3f}\"")
print(f" Kyle Field Rim Height: {bounds[1][2]:.3f}\" above base plinth")
print(f" Triangle Count: {len(combined.faces):,}")
print(f"[4/4] Exporting STL to '{OUTPUT_STL_PATH}'...")
combined.export(OUTPUT_STL_PATH)
print("Done! Ready to import into Vectric VCarve / Cut2D.")
How the Bowl Dimensions Map to Your Cutter
At the default 20" x 20" stock size and $3.0x Z-exaggeration:
Outer Grandstand Rim: 0.469" above the base plinth (
Z = 0.0).Tier 1 Step (Upper-to-Middle Deck): Steps inward by 0.417" (sim 6.6x the width of a 1/16" bit) and drops down to 0.319".
Tier 2 & Tier 3 Steps: Each step terrace is 0.170" wide (2.7x the width of a 1/16" tapered ball nose), wide enough for the cutter to drop cleanly onto each terrace shelf without the tapered shank colliding with the upper grandstand walls.
Recessed Playing Field: Sits at 0.028" above the base plinth, leaving a clean flat turf floor surrounded by a 0.066" lower bowl wall.
If you decide to scale the blank down to 12" x 12", switch your finishing bit to a 1/32" tapered ball nose or reduce KYLE_BOWL_TIERS from 4 steps to 3 steps so each seating terrace remains at least 2x your cutter tip diameter.
Write a short Python snippet using trimesh or pyvista to render a shaded top-down and isometric PNG preview of the generated STL so I can inspect the Kyle Field bowl before loading it into Vectric.
Below is a clean, headless-ready Python snippet using PyVista (backed by VTK) that loads your generated STL, applies elevation-based shading plus ambient occlusion/eye-dome lighting so the stepped tiers inside Kyle Field pop clearly, and saves a high-resolution side-by-side PNG (top-down + isometric close-up of Kyle Field).
Prerequisites
pip install pyvista numpy
preview_tamu_stl.py
"""
Renders a shaded top-down overview and a close-up isometric inspection view
of the Texas A&M campus STL (focused on the stepped Kyle Field bowl) to PNG.
"""
import numpy as np
import pyvista as pv
STL_PATH = "tamu_campus_1sqmi_kyle_bowl_cnc.stl"
OUTPUT_PNG = "tamu_campus_preview.png"
# Load mesh and compute smooth vertex/face normals for crisp lighting
mesh = pv.read(STL_PATH)
mesh = mesh.compute_normals(cell_normals=True, point_normals=False, split_vertices=True)
# Color vertices/cells by Z-height above the base plinth (Z=0) so stepped tiers stand out
z_heights = mesh.cell_centers().points[:, 2]
mesh.cell_data["Elevation (in)"] = np.clip(z_heights, 0.0, None)
# Locate the highest Z region (Kyle Field's 165-ft scaled rim) to aim the isometric close-up
tallest_idx = int(np.argmax(z_heights))
kyle_center = mesh.cell_centers().points[tallest_idx]
# Create an off-screen 1x2 side-by-side plotter (no GUI window required)
plotter = pv.Plotter(shape=(1, 2), off_screen=True, window_size=(2200, 1100))
plotter.set_background("#181A1F")
render_kwargs = dict(
scalars="Elevation (in)",
cmap="copper", # Warm wood/bronze relief tone
clim=[0.0, float(np.max(z_heights))],
show_edges=False,
ambient=0.25,
diffuse=0.75,
specular=0.15,
show_scalar_bar=False,
)
# --- Left Viewport: Full 1-Mile Square Top-Down Plan View ---
plotter.subplot(0, 0)
plotter.add_text("1-Mile Square Campus (Top-Down Plan View)", position="upper_left", font_size=12, color="white")
plotter.add_mesh(mesh, **render_kwargs)
plotter.enable_eye_dome_lighting() # Enhances depth contrast on vertical building walls
plotter.view_xy()
plotter.camera.zoom(1.15)
# --- Right Viewport: Isometric Close-Up Focused on Kyle Field Bowl ---
plotter.subplot(0, 1)
plotter.add_text("Kyle Field Stepped Bowl (Isometric Close-Up)", position="upper_left", font_size=12, color="white")
plotter.add_mesh(mesh, **render_kwargs)
plotter.enable_eye_dome_lighting()
# Aim camera directly at Kyle Field from a 45-degree southwest isometric angle
plotter.camera_position = [
(kyle_center[0] - 3.2, kyle_center[1] - 3.2, kyle_center[2] + 2.6), # Camera position (inches)
(kyle_center[0], kyle_center[1], 0.15), # Focal point
(0.0, 0.0, 1.0), # Z-up vector
]
plotter.screenshot(OUTPUT_PNG)
plotter.close()
print(f"Saved shaded inspection preview to '{OUTPUT_PNG}'")
What to Check in tamu_campus_preview.png
Left Panel (Top-Down): Verify that the 1 mi x 1 mi square border clips cleanly, Simpson Drill Field and Aggie Park appear as clean flat expanses, and no stray micro-slivers appear along the outer perimeter.
Right Panel (Isometric Close-Up): Check that all four concentric stadium tiers and the recessed playing field floor are clearly visible without self-intersecting triangles. If the inner tiers look slightly too narrow for your cutter, widen the step intervals in
KYLE_BOWL_TIERSbefore exporting your final Vectric toolpaths.
Write a companion Python script that exports a 2D DXF file of the major campus streets, Simpson Drill Field border, and Kyle Field yard lines scaled to the exact same 20x20 inch coordinate system for V-carving in Vectric.
Below is a companion Python script (tamu_campus_vectors_dxf.py) using ezdxf and osmnx that exports a multi-layer 2D .dxf file registered to the exact same centered 20" x 20" ([-10.0, +10.0]) coordinate system as your STL mesh.
In Vectric VCarve / Cut2D, you can import this DXF directly on top of your 3D STL model, select each layer independently, and run 2D Profile / V-Carve toolpaths with "Project toolpath onto 3D model" checked so the street lines, drill field border, and Kyle Field yard lines trace cleanly across both the Z = 0 plinth and the recessed playing field floor.
Prerequisites
pip install ezdxf osmnx geopandas shapely numpy
tamu_campus_vectors_dxf.py
"""
Texas A&M University (1-Mile Square Core) -> Registered 2D DXF Vector Overlay
Exports layered 2D vectors (Perimeter, Major Streets, Campus Roads, Simpson Drill
Field Border, and Kyle Field Yard Lines) in the exact [-10", +10"] centered inch
coordinate space of tamu_campus_1sqmi_kyle_bowl_cnc.stl for Vectric V-Carving.
"""
import numpy as np
import osmnx as ox
import geopandas as gpd
import shapely
from shapely.geometry import box, LineString, MultiLineString, Polygon, MultiPolygon
from shapely.ops import unary_union
import ezdxf
# ==============================================================================
# 1. EXACT REGISTRATION PARAMETERS (Must match your STL generator script)
# ==============================================================================
CENTER_LAT = 30.6148
CENTER_LON = -96.3412
REAL_WORLD_WIDTH_FT = 5280.0
TARGET_MODEL_SIZE_IN = 20.0
OUTPUT_DXF_PATH = "tamu_campus_1sqmi_overlay.dxf"
# ==============================================================================
# 2. COORDINATE CONVERSION HELPERS (UTM Zone 14N -> Centered Model Inches)
# ==============================================================================
FT_TO_M = 0.3048
half_width_m = (REAL_WORLD_WIDTH_FT * FT_TO_M) / 2.0
horizontal_scale_in_per_ft = TARGET_MODEL_SIZE_IN / REAL_WORLD_WIDTH_FT
center_pt = (
gpd.GeoSeries([shapely.Point(CENTER_LON, CENTER_LAT)], crs="EPSG:4326")
.to_crs(epsg=32614)
.iloc[0]
)
cx, cy = center_pt.x, center_pt.y
clip_box_utm = box(
cx - half_width_m,
cy - half_width_m,
cx + half_width_m,
cy + half_width_m,
)
def utm_coords_to_inches(coords) -> list[tuple[float, float]]:
"""Maps UTM (x, y) meters to exact [-10.0, +10.0] centered model inches."""
arr = np.asarray(coords, dtype=np.float64)
x_in = ((arr[:, 0] - cx) / FT_TO_M) * horizontal_scale_in_per_ft
y_in = ((arr[:, 1] - cy) / FT_TO_M) * horizontal_scale_in_per_ft
return [(float(x), float(y)) for x, y in zip(x_in, y_in)]
def add_shapely_to_dxf(msp, geom, layer: str, close_rings: bool = False):
"""Writes Shapely LineStrings or Polygons to an ezdxf Modelspace layer."""
if geom is None or geom.is_empty:
return
if isinstance(geom, LineString):
pts = utm_coords_to_inches(geom.coords)
if len(pts) >= 2:
msp.add_lwpolyline(pts, close=close_rings, dxfattribs={"layer": layer})
elif isinstance(geom, MultiLineString):
for line in geom.geoms:
add_shapely_to_dxf(msp, line, layer, close_rings=False)
elif isinstance(geom, Polygon):
ext_pts = utm_coords_to_inches(geom.exterior.coords)
if len(ext_pts) >= 3:
msp.add_lwpolyline(ext_pts, close=True, dxfattribs={"layer": layer})
for interior in geom.interiors:
int_pts = utm_coords_to_inches(interior.coords)
if len(int_pts) >= 3:
msp.add_lwpolyline(int_pts, close=True, dxfattribs={"layer": layer})
elif isinstance(geom, MultiPolygon):
for poly in geom.geoms:
add_shapely_to_dxf(msp, poly, layer, close_rings=True)
# ==============================================================================
# 3. INITIALIZE DXF DOCUMENT & LAYERS (Inches)
# ==============================================================================
doc = ezdxf.new(dxfversion="R2010")
doc.header["$INSUNITS"] = 1 # 1 = Inches
msp = doc.modelspace()
# Define color-coded Vectric layers for separate V-carve depths/bits
LAYERS = {
"01_SQUARE_MILE_BORDER": 7, # White/Black: exact 20" x 20" alignment frame
"02_MAJOR_ARTERIALS": 1, # Red: University Dr, Texas Ave, George Bush, Wellborn
"03_CAMPUS_STREETS": 3, # Green: Joe Routt Blvd, Spence St, Bizzell, Lubbock
"04_DRILL_FIELD_BORDER": 5, # Blue: Simpson Drill Field & Aggie Park perimeters
"05_KYLE_FIELD_LINES": 2, # Yellow: Playing field perimeter + 10-yd stripes
}
for layer_name, color_idx in LAYERS.items():
doc.layers.add(name=layer_name, color=color_idx)
# Add exact 20.0" x 20.0" registration border centered at (0, 0)
half_in = TARGET_MODEL_SIZE_IN / 2.0
border_pts = [
(-half_in, -half_in),
(half_in, -half_in),
(half_in, half_in),
(-half_in, half_in),
]
msp.add_lwpolyline(border_pts, close=True, dxfattribs={"layer": "01_SQUARE_MILE_BORDER"})
# ==============================================================================
# 4. FETCH & EXPORT CAMPUS STREETS
# ==============================================================================
print("[1/3] Fetching OpenStreetMap road network for Texas A&M 1-sq-mile core...")
fetch_radius_m = half_width_m * 1.15
roads_gdf = ox.features_from_point(
(CENTER_LAT, CENTER_LON),
tags={"highway": ["primary", "secondary", "tertiary", "unclassified", "service"]},
dist=fetch_radius_m,
)
roads_gdf = roads_gdf[roads_gdf.geometry.type.isin(["LineString", "MultiLineString"])].copy()
roads_utm = roads_gdf.to_crs(epsg=32614)
roads_utm["geometry"] = roads_utm.geometry.intersection(clip_box_utm)
roads_utm = roads_utm[~roads_utm.geometry.is_empty].copy()
major_types = {"primary", "secondary", "tertiary"}
major_count, campus_count = 0, 0
for _, row in roads_utm.iterrows():
hw = row.get("highway")
if isinstance(hw, list):
hw = hw[0]
# Skip tiny parking aisle spurs (< 25 m) to keep CNC V-carving clean
if row.geometry.length < 25.0:
continue
if hw in major_types:
add_shapely_to_dxf(msp, row.geometry, "02_MAJOR_ARTERIALS")
major_count += 1
elif hw == "unclassified":
add_shapely_to_dxf(msp, row.geometry, "03_CAMPUS_STREETS")
campus_count += 1
print(f" Exported {major_count} major arterial segments and {campus_count} campus street segments.")
# ==============================================================================
# 5. FETCH SIMPSON DRILL FIELD & AGGIE PARK BORDERS
# ==============================================================================
print("[2/3] Extracting Simpson Drill Field and green space perimeters...")
parks_gdf = ox.features_from_point(
(CENTER_LAT, CENTER_LON),
tags={"leisure": ["park", "pitch", "common"], "landuse": ["grass", "recreation_ground"]},
dist=fetch_radius_m,
)
parks_gdf = parks_gdf[parks_gdf.geometry.type.isin(["Polygon", "MultiPolygon"])].copy()
parks_utm = parks_gdf.to_crs(epsg=32614)
parks_utm["geometry"] = parks_utm.geometry.intersection(clip_box_utm)
drill_field_count = 0
for _, row in parks_utm.iterrows():
name = str(row.get("name", "")).lower()
# Keep named campus open spaces (Simpson Drill Field, Aggie Park, Spence Park)
if any(k in name for k in ["drill field", "aggie park", "spence park", "military walk"]):
geom_clean = row.geometry.simplify(tolerance=1.0, preserve_topology=True)
add_shapely_to_dxf(msp, geom_clean, "04_DRILL_FIELD_BORDER", close_rings=True)
drill_field_count += 1
print(f" Exported {drill_field_count} named campus green/drill field borders.")
# ==============================================================================
# 6. GENERATE KYLE FIELD PLAYING PITCH & 10-YARD LINES
# ==============================================================================
print("[3/3] Generating Kyle Field playing field outline and 10-yard stripes...")
bldg_gdf = ox.features_from_point(
(CENTER_LAT, CENTER_LON),
tags={"building": True},
dist=fetch_radius_m,
)
bldg_gdf = bldg_gdf[bldg_gdf.geometry.type.isin(["Polygon", "MultiPolygon"])].copy()
bldg_utm = bldg_gdf.to_crs(epsg=32614)
kyle_rows = bldg_utm[bldg_utm["name"].astype(str).str.lower().str.contains("kyle field", na=False)]
if not kyle_rows.empty:
kyle_union = unary_union(kyle_rows.geometry.tolist())
# Fit a minimum-area oriented bounding rectangle to align with Kyle Field's true compass angle
mrr = kyle_union.minimum_rotated_rectangle
rect_coords = list(mrr.exterior.coords)[:4]
# Determine the long axis (360 ft endzone-to-endzone) and short axis (160 ft sideline-to-sideline)
edges = [
(np.array(rect_coords[i]), np.array(rect_coords[(i + 1) % 4]))
for i in range(4)
]
edge_lengths = [np.linalg.norm(p2 - p1) for p1, p2 in edges]
long_idx = int(np.argmax(edge_lengths))
short_idx = (long_idx + 1) % 4
long_vec = edges[long_idx][1] - edges[long_idx][0]
short_vec = edges[short_idx][1] - edges[short_idx][0]
u_long = long_vec / np.linalg.norm(long_vec)
u_short = short_vec / np.linalg.norm(short_vec)
field_center = np.array([mrr.centroid.x, mrr.centroid.y])
half_len_m = (360.0 * FT_TO_M) / 2.0 # 120 yards total (including both 10-yd endzones)
half_wid_m = (160.0 * FT_TO_M) / 2.0 # 53.33 yards wide
# Outer playing field rectangle (sidelines + endlines)
corners_utm = [
field_center - half_len_m * u_long - half_wid_m * u_short,
field_center + half_len_m * u_long - half_wid_m * u_short,
field_center + half_len_m * u_long + half_wid_m * u_short,
field_center - half_len_m * u_long + half_wid_m * u_short,
]
msp.add_lwpolyline(
utm_coords_to_inches(corners_utm),
close=True,
dxfattribs={"layer": "05_KYLE_FIELD_LINES"},
)
# Goal lines + every 10-yard stripe across the 100-yard field (-50 yd to +50 yd)
for yd in range(-50, 55, 10):
offset_m = (yd * 3.0) * FT_TO_M
p_left = field_center + offset_m * u_long - half_wid_m * u_short
p_right = field_center + offset_m * u_long + half_wid_m * u_short
msp.add_lwpolyline(
utm_coords_to_inches([p_left, p_right]),
close=False,
dxfattribs={"layer": "05_KYLE_FIELD_LINES"},
)
print(" Exported Kyle Field perimeter + 11 yard-line stripes (aligned to stadium axis).")
else:
print(" Warning: Kyle Field footprint not found; skipping yard lines.")
# ==============================================================================
# 7. SAVE DXF
# ==============================================================================
doc.saveas(OUTPUT_DXF_PATH)
print(f"\nSaved registered 2D DXF overlay to '{OUTPUT_DXF_PATH}' (20.0\" x 20.0\" centered at 0,0).")
Vectric VCarve / Cut2D Workflow Tips
Alignment: Import
tamu_campus_1sqmi_kyle_bowl_cnc.stlcentered at(0, 0), then importtamu_campus_1sqmi_overlay.dxf(File -> Import -> Import Vectors). Because01_SQUARE_MILE_BORDERis an exact20.0" x 20.0"square centered at(0, 0), all streets and yard lines snap into exact registration with the 3D buildings and stadium bowl.Toolpath Settings per Layer:
02_MAJOR_ARTERIALS: Use a 60-degree V-bit on a Profile toolpath (Onthe vector), cut depth 0.025", with "Project toolpath onto 3D model" enabled.03_CAMPUS_STREETS&04_DRILL_FIELD_BORDER: Use a 60-degree V-bit at a lighter 0.012" cut depth (Project toolpath onto 3D modelenabled) so internal streets read as crisp hairlines without overpowering the buildings.05_KYLE_FIELD_LINES: Use a 30-degree engraving bit (or fine 60-degree V-bit) at 0.008" depth projected onto the recessed playing field floor (Z = 0.028").
Calculate recommended spindle RPM, feed rates, stepover, and estimated CNC machining runtime for cutting this 20x20 inch campus model in hard maple vs. HDU sign foam.
For a 20" x 20" campus relief (400 in^2 projected area, 0.469" peak relief depth at Kyle Field, 0.75" stock thickness), your total cycle time is dominated by the 3D finishing pass, because a 1/16" tapered ball nose at 8%–9% stepover covers roughly 80,000 linear inches (6,667 feet) of X/Y toolpath travel plus thousands of rapid Z-accelerations over vertical building walls.
Below are the calibrated feeds, speeds, stepovers, and realistic cycle-time estimates for Hard Maple (Kiln-Dried Rock/Sugar Maple) versus HDU Sign Foam (18–20 lb High-Density Urethane) assuming a typical hobbyist/prosumer gantry CNC router (e.g., 2.2 kW ER20 spindle, 150–250 IPM Z-acceleration limits).
Side-by-Side Toolpath & Runtime Comparison
| Toolpath Stage & Tool | Parameter | Hard Maple (Janka ~1,450 lbf) | HDU Sign Foam (18–20 lb) |
1. 3D Roughing 1/4" 2-Flute Upcut Flat End Mill (3D Raster, 0.035" allowance) | Spindle RPM Feed Rate (XY) Plunge Rate (Z) Stepdown / Stepover Est. Runtime | 16,000 RPM 110 IPM (0.0034" chipload) 35 IPM 0.125" depth / 40% (0.10") stepover ~25 – 35 mins | 14,000 RPM 220 IPM (0.0079" chipload) 80 IPM 0.250" depth / 50% (0.125") stepover ~8 – 12 mins |
2. 3D Finishing 1/16" (0.0625") 2-Flute Tapered Ball Nose (5.4-degree) (45° Raster or Offset) | Spindle RPM Feed Rate (XY / Z) Stepover Total Path Length Est. Runtime | 18,000 RPM 120 IPM XY / 60 IPM Z 8% (0.0050") stepover ~ 80,000 linear in. ~14 – 17 hours | 16,000 RPM 220 IPM XY / 120 IPM Z 9% (0.0056") stepover ~ 71,400\text{ linear in. ~7 – 9 hours |
3. 2D Vector V-Carve 60-degree V-Bit + 30-degree Engraver (Projected onto 3D model) | Spindle RPM Feed Rate (XY) Pass Depth Est. Runtime | 16,000 RPM 65 IPM 0.025" max single pass ~15 – 20 mins | 14,000 RPM 120 IPM 0.025" max single pass ~8 – 12 mins |
| Total Combined Cycle Time | All 3 Operations | ~15 – 18 hours | ~7.5 – 9.5 hours |
Why Effective Runtime Differs from Raw Math (Distance div Feed)
If you simply divide 80,000 inches by 120 IPM, the theoretical time is 11.1 hours. In practice, add 30%–45% acceleration overhead:
Vertical Wall Spikes: Every time the cutter crosses a campus building, the controller decelerates X/Y to near zero to climb or plunge up to 0.469" in Z.
Z-Feed Bottleneck: Because your
Z Plunge Rateis capped lower than yourXY Feed Rate(60 IPM vs. 120 IPM in maple), the Z-axis dictates speed across dense areas like the Engineering Quad and Kyle Field's stepped tiers. Setting Z Plunge = 50%–60% of XY Feed during 3D finishing prevents the controller from crawling on vertical walls.
Material-Specific Engineering Notes
Hard Maple
Preventing Burn & Chip-Out: Hard maple scorches immediately if you run high RPM (22,000+) at slow feed rates, and sharp 90-degree building corners can chip along end-grain edges during roughing. Leave a 0.035"–0.040" machining allowance on the roughing pass so the 1/4" end mill never touches the final building walls.
Raster Angle: Run your 3D finishing raster at 45-degrees relative to the wood grain (and relative to the campus street grid). Cutting at 45-degree shears across wood fibers cleanly and avoids staircase aliasing on both north-south and east-west building facades.
Zero-Plane Feed Optimization: In Vectric VCarve, set a Rapid Clearance Gap of
0.05"above the model and ensure your controller's CV (Constant Velocity / Look-Ahead) mode is enabled so it glides smoothly across flat plazas like Simpson Drill Field.
HDU Sign Foam (18–20 lb)
Why 18–20 lb Density Matters: Lighter foams (10–15 lb) have slightly larger cell structures that can look slightly porous on tiny 0.17"-wide stadium steps. 18 lb or 20 lb HDU (such as Corafoam or Precision Board) machines like dense butter with zero grain tear-out and holds crisp architectural edges.
Dust Collection Mandatory: HDU produces fine, static-cling polyurethane dust rather than wood chips—run a dust shoe continuously and keep RPM moderate (14,000–16,000 RPM) so the cutter flings chips cleanly instead of melting foam onto the flutes.
How to Cut Maple Runtime in Half (Optional Hybrid Strategy)
If an 18-hour finishing pass in hard maple is longer than you want to tie up your machine:
Use a 1/8" Tapered Ball Nose (8% stepover = 0.010") for the entire campus—this drops the 3D finishing pass from 16 hours down to ~6.5 hours.
Create a Vector Boundary around Kyle Field in Vectric and run a localized Rest-Machining / Detail Finishing Pass using the 1/16" tapered ball nose only inside Kyle Field's stepped bowl (
~15 minutes), giving you ultra-crisp stadium tiers without scanning the flat drill fields at 0.005" stepover.
Can you generalize the download from OpenStreetMap and 3D viewer for any location and area?
Below is a generalized, modular Python pipeline (osm_cnc_relief_builder.py) that works for any latitude/longitude, arbitrary bounding-box width and height (rectangular or square), and any physical CNC blank size anywhere on Earth.
Key Generalizations Built In
Automatic UTM Zone Detection: Instead of hardcoding UTM Zone 14N (
EPSG:32614), it callsgdf.estimate_utm_crs()so any location globally (North America, Europe, Asia, Southern Hemisphere) automatically projects into its exact local metric UTM zone without distortion.Arbitrary Rectangular or Square Area: Configure
AREA_WIDTH_FT$\times$AREA_HEIGHT_FT(or meters) andSTOCK_WIDTH_IN$\times$STOCK_HEIGHT_INindependently (or lock aspect ratio automatically).Automatic Stadium / Arena Bowl Detection: Any building tagged
leisure=stadium,building=stadium, or matching stadium/arena/bowl keywords automatically gets stepped concentric seating tiers and a recessed playing floor scaled proportionally to its footprint—no hardcoded coordinates required.Integrated Interactive + Headless 3D Viewer (
--preview): Uses PyVista to render a shaded top-down + isometric PNG proof (_preview.png) automatically after exporting the.stl, and optionally opens an interactive 3D orbit/zoom window (INTERACTIVE_VIEWER = True) so you can inspect any location immediately.
Prerequisites
pip install osmnx geopandas shapely trimesh mapbox-earcut pyvista numpy
osm_cnc_relief_builder.py
"""
Generalized OpenStreetMap -> Watertight CNC Relief STL + 3D Viewer
Works for any global latitude/longitude, arbitrary bounding-box dimensions,
and custom physical CNC stock sizes. Automatically detects local UTM projection,
cleans sub-cutter micro-features, carves stepped stadium bowls, exports a
watertight STL, and renders an interactive + PNG 3D inspection preview.
"""
import math
from dataclasses import dataclass
import numpy as np
import osmnx as ox
import geopandas as gpd
import shapely
from shapely.geometry import box, Polygon, MultiPolygon
from shapely.ops import unary_union
import trimesh
import pyvista as pv
# ==============================================================================
# 1. CONFIGURATION (Set for ANY location, real-world area, and CNC stock size)
# ==============================================================================
@dataclass
class ReliefConfig:
project_name: str = "custom_site_cnc"
center_lat: float = 30.6148 # Any latitude (e.g., 30.6148 for TAMU)
center_lon: float = -96.3412 # Any longitude (e.g., -96.3412 for TAMU)
# Real-world capture area (feet)
area_width_ft: float = 5280.0 # East-West span in feet (5280 ft = 1 mile)
area_height_ft: float = 5280.0 # North-South span in feet
# Physical CNC stock dimensions (inches)
stock_width_in: float = 20.0 # Target X size on router bed (inches)
stock_height_in: float = 20.0 # Target Y size on router bed (inches)
base_thickness_in: float = 0.25 # Solid plinth thickness below Z=0 (inches)
z_exaggeration: float = 3.0 # Vertical scale multiplier (2.0 - 4.0 typical)
# CNC cutter & height defaults
min_bit_diameter_in: float = 0.0625 # Smallest finishing cutter (e.g., 1/16" = 0.0625")
default_story_ft: float = 13.0 # Height per building:levels when height tag missing
default_building_ft: float = 26.0 # Fallback height when no height or levels exist
# Automatic stepped bowl carving for stadiums / arenas
carve_stadium_bowls: bool = True
default_stadium_rim_ft: float = 135.0
# 3D Viewer options
save_png_preview: bool = True
interactive_viewer: bool = True # Opens interactive 3D PyVista window after export
FT_TO_M = 0.3048
# ==============================================================================
# 2. GEOSPATIAL PROJECTION & SCALING ENGINE
# ==============================================================================
class OSMReliefGenerator:
def __init__(self, cfg: ReliefConfig):
self.cfg = cfg
# Enforce uniform X/Y horizontal scale (uses width; adjust stock_height_in to match)
self.in_per_ft = cfg.stock_width_in / cfg.area_width_ft
self.actual_stock_height_in = cfg.area_height_ft * self.in_per_ft
self.min_feature_ft = cfg.min_bit_diameter_in / self.in_per_ft
self.half_w_m = (cfg.area_width_ft * FT_TO_M) / 2.0
self.half_h_m = (cfg.area_height_ft * FT_TO_M) / 2.0
# Auto-detect exact local UTM CRS for any point on Earth
pt_wgs84 = gpd.GeoSeries([shapely.Point(cfg.center_lon, cfg.center_lat)], crs="EPSG:4326")
self.utm_crs = pt_wgs84.estimate_utm_crs()
pt_utm = pt_wgs84.to_crs(self.utm_crs).iloc[0]
self.cx, self.cy = float(pt_utm.x), float(pt_utm.y)
self.clip_box_utm = box(
self.cx - self.half_w_m,
self.cy - self.half_h_m,
self.cx + self.half_w_m,
self.cy + self.half_h_m,
)
self.clean_eps_m = (self.min_feature_ft * FT_TO_M) * 0.25
self.min_area_m2 = ((self.min_feature_ft * FT_TO_M) ** 2) * 0.5
def print_summary(self):
print(f"Project: {self.cfg.project_name}")
print(f"Coordinates: ({self.cfg.center_lat:.5f}, {self.cfg.center_lon:.5f}) -> {self.utm_crs.name}")
print(f"Real-World Footprint: {self.cfg.area_width_ft:,.0f} ft x {self.cfg.area_height_ft:,.0f} ft")
print(f"Model Footprint: {self.cfg.stock_width_in:.2f}\" x {self.actual_stock_height_in:.2f}\"")
print(f"Horizontal Scale: 1\" = {1.0 / self.in_per_ft:.1f} ft (1:{int(12.0 / self.in_per_ft):,})")
print(f"Min Cutter Feature: {self.min_feature_ft:.1f} ft (for {self.cfg.min_bit_diameter_in}\" bit)")
def fetch_buildings(self) -> gpd.GeoDataFrame:
print("\n[1/4] Downloading OpenStreetMap building footprints...")
fetch_radius_m = math.hypot(self.half_w_m, self.half_h_m) * 1.15
gdf = ox.features_from_point(
(self.cfg.center_lat, self.cfg.center_lon),
tags={"building": True},
dist=fetch_radius_m,
)
gdf = gdf[gdf.geometry.type.isin(["Polygon", "MultiPolygon"])].copy()
gdf_utm = gdf.to_crs(self.utm_crs)
gdf_utm["geometry"] = gdf_utm.geometry.intersection(self.clip_box_utm)
gdf_utm = gdf_utm[~gdf_utm.geometry.is_empty].copy()
print(f" Retrieved {len(gdf_utm)} building polygons inside area.")
return gdf_utm
def _is_stadium(self, row) -> bool:
if not self.cfg.carve_stadium_bowls:
return False
b_tag = str(row.get("building", "")).lower()
l_tag = str(row.get("leisure", "")).lower()
name = str(row.get("name", "")).lower()
keywords = ("stadium", "arena", "bowl", "coliseum", "speedway")
return (
b_tag in ("stadium", "grandstand")
or l_tag == "stadium"
or any(k in name for k in keywords)
)
def _parse_height_ft(self, row, is_stadium: bool) -> float:
raw_h = row.get("height")
if raw_h is not None and not (isinstance(raw_h, float) and math.isnan(raw_h)):
s = str(raw_h).strip().lower()
try:
num = float("".join(c for c in s if c.isdigit() or c == "."))
if "ft" in s or "'" in s:
return max(10.0, num)
return max(10.0, num / FT_TO_M)
except ValueError:
pass
raw_lvl = row.get("building:levels")
if raw_lvl is not None and not (isinstance(raw_lvl, float) and math.isnan(raw_lvl)):
try:
levels = float(str(raw_lvl).split(";")[0].strip())
return max(10.0, levels * self.cfg.default_story_ft)
except ValueError:
pass
return self.cfg.default_stadium_rim_ft if is_stadium else self.cfg.default_building_ft
def _utm_poly_to_inches(self, poly: Polygon) -> Polygon | None:
def to_in(coords):
arr = np.asarray(coords, dtype=np.float64)
x_in = ((arr[:, 0] - self.cx) / FT_TO_M) * self.in_per_ft
y_in = ((arr[:, 1] - self.cy) / FT_TO_M) * self.in_per_ft
return np.column_stack([x_in, y_in])
ext_in = to_in(poly.exterior.coords)
holes_in = [
to_in(interior.coords)
for interior in poly.interiors
if Polygon(interior).area >= self.min_area_m2
]
poly_in = Polygon(ext_in, holes_in)
if not poly_in.is_valid:
poly_in = poly_in.buffer(0)
if poly_in.is_empty or not isinstance(poly_in, Polygon):
return None
return poly_in
def _build_adaptive_stadium_bowl(self, geom, rim_height_ft: float) -> list[trimesh.Trimesh]:
"""
Automatically scales stepped concentric bowl insets proportionally to any
stadium's physical footprint so it works on both huge college stadiums and
smaller municipal arenas.
"""
meshes = []
merged = unary_union(geom)
merged = merged.buffer(self.clean_eps_m * 2.0, join_style=2).buffer(-self.clean_eps_m * 2.0, join_style=2)
outer_shell = max(merged.geoms, key=lambda g: g.area) if isinstance(merged, MultiPolygon) else merged
solid = Polygon(outer_shell.exterior).intersection(self.clip_box_utm)
if solid.is_empty:
return meshes
# Estimate minor radius of stadium footprint to scale tier widths proportionally
minx, miny, maxx, maxy = solid.bounds
half_minor_m = min(maxx - minx, maxy - miny) / 2.0
if half_minor_m < 25.0:
return meshes
# Fractional inward offsets & heights: (fraction_of_half_minor_axis, fraction_of_rim_height)
tiers = [
(0.00, 1.00), # Outer grandstand rim
(0.28, 0.68), # Upper-to-middle tier
(0.42, 0.42), # Middle-to-lower tier
(0.55, 0.20), # Lower bowl wall
(0.66, 0.06), # Recessed playing field floor
]
tier_geoms = []
for frac_in, frac_h in tiers:
inset_m = half_minor_m * frac_in
g = solid if inset_m == 0.0 else solid.buffer(-inset_m, join_style=1, resolution=24)
if not g.is_empty:
tier_geoms.append((g, rim_height_ft * frac_h))
for idx, (outer_g, tier_h_ft) in enumerate(tier_geoms):
tier_h_in = tier_h_ft * self.in_per_ft * self.cfg.z_exaggeration
if idx < len(tier_geoms) - 1:
inner_g, _ = tier_geoms[idx + 1]
ring_g = outer_g.difference(inner_g.buffer(-0.25))
else:
ring_g = outer_g
if ring_g.is_empty:
continue
polys = [ring_g] if isinstance(ring_g, Polygon) else list(ring_g.geoms)
for p in polys:
if not isinstance(p, Polygon) or p.area < self.min_area_m2 * 0.25:
continue
p_in = self._utm_poly_to_inches(p)
if p_in is None:
continue
try:
m = trimesh.creation.extrude_polygon(p_in, height=tier_h_in)
m.apply_translation([0.0, 0.0, -0.002])
meshes.append(m)
except Exception:
continue
return meshes
def build_stl(self) -> str:
self.print_summary()
gdf_utm = self.fetch_buildings()
print("[2/4] Extruding 3D buildings and carving detected stadium bowls...")
meshes = []
# Solid base plinth centered at (0, 0), top surface at Z = 0
base_mesh = trimesh.creation.box(
extents=[self.cfg.stock_width_in, self.actual_stock_height_in, self.cfg.base_thickness_in]
)
base_mesh.apply_translation([0.0, 0.0, -self.cfg.base_thickness_in / 2.0])
meshes.append(base_mesh)
gdf_utm["is_stadium"] = gdf_utm.apply(self._is_stadium, axis=1)
gdf_utm["height_ft"] = gdf_utm.apply(
lambda r: self._parse_height_ft(r, r["is_stadium"]), axis=1
)
# Carve stadium bowls
stadium_rows = gdf_utm[gdf_utm["is_stadium"]]
stadium_count = 0
for _, row in stadium_rows.iterrows():
s_meshes = self._build_adaptive_stadium_bowl(row.geometry, row["height_ft"])
if s_meshes:
meshes.extend(s_meshes)
stadium_count += 1
# Extrude standard buildings
std_rows = gdf_utm[~gdf_utm["is_stadium"]]
bldg_count = 0
for _, row in std_rows.iterrows():
geom = row.geometry
if geom is None or geom.is_empty:
continue
geom_clean = geom.buffer(self.clean_eps_m, join_style=2).buffer(-self.clean_eps_m, join_style=2)
geom_clean = geom_clean.simplify(tolerance=self.clean_eps_m * 0.5, preserve_topology=True)
geom_clean = geom_clean.intersection(self.clip_box_utm)
if geom_clean.is_empty:
continue
polys = [geom_clean] if isinstance(geom_clean, Polygon) else list(geom_clean.geoms)
height_in = row["height_ft"] * self.in_per_ft * self.cfg.z_exaggeration
for poly in polys:
if not isinstance(poly, Polygon) or poly.area < self.min_area_m2:
continue
poly_in = self._utm_poly_to_inches(poly)
if poly_in is None:
continue
try:
m = trimesh.creation.extrude_polygon(poly_in, height=height_in)
m.apply_translation([0.0, 0.0, -0.002])
meshes.append(m)
bldg_count += 1
except Exception:
continue
print(f" Extruded {bldg_count} buildings and {stadium_count} stepped stadium bowl(s).")
print("[3/4] Concatenating mesh and verifying manifold normals...")
combined = trimesh.util.concatenate(meshes)
combined.fix_normals()
stl_path = f"{self.cfg.project_name}.stl"
bounds = combined.bounds
dims = bounds[1] - bounds[0]
print(f" STL Dimensions (in): X={dims[0]:.3f}\", Y={dims[1]:.3f}\", Z={dims[2]:.3f}\"")
print(f" Max Relief Height: {bounds[1][2]:.3f}\" above plinth (Triangles: {len(combined.faces):,})")
print(f"[4/4] Saving STL -> '{stl_path}'")
combined.export(stl_path)
return stl_path
# ==============================================================================
# 3. GENERALIZED 3D VIEWER (Side-by-Side PNG Proof + Interactive Orbit Window)
# ==============================================================================
def launch_3d_viewer(stl_path: str, cfg: ReliefConfig):
mesh = pv.read(stl_path)
mesh = mesh.compute_normals(cell_normals=True, point_normals=False, split_vertices=True)
z_heights = mesh.cell_centers().points[:, 2]
max_z = max(0.05, float(np.max(z_heights)))
mesh.cell_data["Elevation (in)"] = np.clip(z_heights, 0.0, max_z)
# Aim detail camera at the highest landmark in the scene automatically
peak_pt = mesh.cell_centers().points[int(np.argmax(z_heights))]
render_kwargs = dict(
scalars="Elevation (in)",
cmap="copper",
clim=[0.0, max_z],
show_edges=False,
ambient=0.25,
diffuse=0.75,
specular=0.15,
show_scalar_bar=False,
)
# 1. Headless side-by-side PNG proof
if cfg.save_png_preview:
png_path = f"{cfg.project_name}_preview.png"
plotter = pv.Plotter(shape=(1, 2), off_screen=True, window_size=(2200, 1100))
plotter.set_background("#181A1F")
plotter.subplot(0, 0)
plotter.add_text(f"{cfg.project_name} (Top-Down Plan)", position="upper_left", font_size=11, color="white")
plotter.add_mesh(mesh, **render_kwargs)
plotter.enable_eye_dome_lighting()
plotter.view_xy()
plotter.camera.zoom(1.15)
plotter.subplot(0, 1)
plotter.add_text("Tallest Landmark Close-Up (Isometric)", position="upper_left", font_size=11, color="white")
plotter.add_mesh(mesh, **render_kwargs)
plotter.enable_eye_dome_lighting()
span = min(cfg.stock_width_in, cfg.stock_height_in) * 0.18
plotter.camera_position = [
(peak_pt[0] - span, peak_pt[1] - span, peak_pt[2] + span * 0.8),
(peak_pt[0], peak_pt[1], max_z * 0.35),
(0.0, 0.0, 1.0),
]
plotter.screenshot(png_path)
plotter.close()
print(f"Saved 3D PNG preview -> '{png_path}'")
# 2. Interactive 3D Orbit / Zoom Inspector Window
if cfg.interactive_viewer:
print("Opening interactive 3D viewer (Left-drag: Rotate | Right-drag: Zoom | Shift-drag: Pan | 'r': Reset)...")
viewer = pv.Plotter(window_size=(1400, 950), title=f"CNC Relief Inspector - {cfg.project_name}")
viewer.set_background("#181A1F")
viewer.add_mesh(mesh, **{**render_kwargs, "show_scalar_bar": True})
viewer.enable_eye_dome_lighting()
viewer.add_axes()
viewer.view_isometric()
viewer.show()
# ==============================================================================
# 4. EXAMPLE RUNS (Uncomment any preset or plug in your own coordinates)
# ==============================================================================
if __name__ == "__main__":
# Preset 1: Texas A&M 1-Mile Square Core
config = ReliefConfig(
project_name="tamu_1sqmi",
center_lat=30.6148,
center_lon=-96.3412,
area_width_ft=5280.0,
area_height_ft=5280.0,
stock_width_in=20.0,
stock_height_in=20.0,
z_exaggeration=3.0,
)
# Preset 2: Downtown Austin / Texas Capitol & Lady Bird Lake (1.5 mi x 1.0 mi)
# config = ReliefConfig(
# project_name="austin_capitol",
# center_lat=30.2711,
# center_lon=-97.7426,
# area_width_ft=7920.0,
# area_height_ft=5280.0,
# stock_width_in=24.0,
# stock_height_in=16.0,
# z_exaggeration=2.0,
# )
# Preset 3: Downtown Manhattan Financial District (1.0 mi x 1.0 mi)
# config = ReliefConfig(
# project_name="manhattan_fidi",
# center_lat=40.7075,
# center_lon=-74.0113,
# area_width_ft=5280.0,
# area_height_ft=5280.0,
# stock_width_in=20.0,
# stock_height_in=20.0,
# z_exaggeration=1.0, # Skyscrapers already exceed 1,000 ft!
# )
builder = OSMReliefGenerator(config)
output_stl = builder.build_stl()
launch_3d_viewer(output_stl, config)
Interactive 3D Viewer Controls
When interactive_viewer=True runs, you can inspect every corner of the generated mesh before opening Vectric:
Left-Click + Drag: Free 3D orbit around the model.
Right-Click + Drag (or Scroll Wheel): Zoom in on individual building rooftops or stadium tiers.
Shift + Left-Click + Drag: Pan across the bounding box.
rKey: Reset the camera view to fit the full blank.w/sKeys: Toggle between wireframe triangle inspection (w) and solid shaded surface (s) to verify clean manifold geometry.
From <https://gemini.google.com/app/db30379f05eb746c> Google Gemini (4 Hydrogen)

Comments
Post a Comment