[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6CX0T6F8D8WZMH06BEYRFVK":3,"skill-same:01M6CX0T6F8D8WZMH06BEYRFVK":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":28,"linkOnly":29,"markdownContent":30,"markdownBody":31,"frontMatter":32,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":38,"repositoryHtmlUrl":39,"repositoryHomepageUrl":6,"ownerHtmlUrl":40,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":41,"install":42,"resources":55},"01M6CX0T6F8D8WZMH06BEYRFVK","cad-cam",null,"CAD\u002FCAM fundamentals including geometric modeling, manufacturing automation, toolpath generation, CNC programming, and 3D printing","ffsshhttiikk\u002Fopencode-agents-skills","ffsshhttiikk","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F226346827?v=4","01M6CWD9RR3Y7VRQX3MXYC8FYH","01M6CWD9WVPYAZW0J82G1VKGHY",3,"MIT","https:\u002F\u002Fgithub.com\u002Fffsshhttiikk\u002Fopencode-agents-skills\u002Fblob\u002Fmain\u002Fengineering\u002Fcad-cam\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27],"cad","cam","cad cam","automation","engineering","3D","programming","opencode","3d printing","generation","2026-11-10 10:12:30",false,"---\nname: cad-cam\ndescription: CAD\u002FCAM fundamentals including geometric modeling, manufacturing automation, toolpath generation, CNC programming, and 3D printing\nlicense: MIT\ncompatibility: opencode\nmetadata:\n  audience: engineers\n  category: engineering\n---\n\n## What I do\n- Create 3D geometric models using CAD software\n- Generate CNC toolpaths for manufacturing\n- Program CNC machines using G-code and CAM software\n- Design for additive manufacturing (3D printing)\n- Perform toolpath simulation and verification\n- Optimize machining parameters for efficiency\n- Convert CAD models to manufacturing formats\n- Verify tool collision and machine limits\n\n## When to use me\nWhen creating 3D models, generating CNC toolpaths, programming CNC machines, or designing parts for additive manufacturing.\n\n## Core Concepts\n- Solid modeling (CSG, B-rep)\n- Surface modeling and NURBS\n- Feature-based modeling\n- Toolpath strategies (contour, pocketing, drilling)\n- CNC programming (G-code, M-code)\n- Feed and speed calculations\n- Tool geometry and compensation\n- Additive manufacturing processes (FDM, SLA, SLS)\n- Build orientation and support generation\n- Post-processing for different machine controllers\n\n## Code Examples\n\n### G-Code Generation\n```python\nfrom dataclasses import dataclass\nfrom typing import List, Tuple\nimport math\n\n@dataclass\nclass GCodeCommand:\n    code: str\n    x: float = None\n    y: float = None\n    z: float = None\n    f: float = None\n    s: float = None\n\ndef rapid_move(x: float, y: float, z: float) -> str:\n    \"\"\"Generate G0 rapid move command.\"\"\"\n    return f\"G0 X{x:.4f} Y{y:.4f} Z{z:.4f}\"\n\ndef linear_move(x: float, y: float, z: float, f: float) -> str:\n    \"\"\"Generate G1 linear move command.\"\"\"\n    return f\"G1 X{x:.4f} Y{y:.4f} Z{z:.4f} F{f:.1f}\"\n\ndef circular_move(\n    i: float, j: float, x: float, y: float,\n    direction: str = \"clockwise\",\n    f: float = 100\n) -> str:\n    \"\"\"Generate G2\u002FG3 circular move.\"\"\"\n    g_code = \"G2\" if direction == \"clockwise\" else \"G3\"\n    return f\"{g_code} X{x:.4f} Y{y:.4f} I{i:.4f} J{j:.4f} F{f:.1f}\"\n\ndef drill_cycle(\n    x: float, y: float,\n    z_start: float,\n    z_depth: float,\n    z_retract: float,\n    f_plunge: float,\n    f_rapid: float\n) -> List[str]:\n    \"\"\"Generate G81 drilling cycle.\"\"\"\n    return [\n        rapid_move(x, y, z_start),\n        f\"G81 R{z_retract} Z{z_depth} F{f_plunge}\",\n        f\"G80\",\n        rapid_move(x, y, z_retract)\n    ]\n\ndef canned_cycle(\n    cycle: str,\n    x: float, y: float,\n    r: float, z: float,\n    q: float = None,\n    f: float = 100\n) -> str:\n    \"\"\"Generate canned cycle command.\"\"\"\n    if q:\n        return f\"{cycle} R{r} Z{z} Q{q} F{f}\"\n    return f\"{cycle} R{r} Z{z} F{f}\"\n\n# Example: Simple part program\ngcode = [\n    \"G90 G21 G40\",  # Absolute, mm, cancel compensation\n    \"G54\",  # Work coordinate system 1\n    \"M6 T1\",  # Tool change to tool 1\n    \"M3 S3000\",  # Spindle on clockwise 3000 RPM\n    rapid_move(0, 0, 5),\n    linear_move(10, 0, -2, 100),\n    linear_move(10, 10, -2, 100),\n    linear_move(0, 10, -2, 100),\n    linear_move(0, 0, -2, 100),\n    \"M5\",  # Spindle off\n    \"M30\"  # Program end\n]\nfor line in gcode[:5]:\n    print(line)\n```\n\n### Toolpath Generation\n```python\nfrom typing import List, Tuple\nimport numpy as np\n\ndef offset_polygon(\n    vertices: List[Tuple[float, float]],\n    offset: float,\n    corner_style: str = \"round\"\n) -> List[Tuple[float, float]]:\n    \"\"\"Generate offset contour for tool radius compensation.\"\"\"\n    offset_vertices = []\n    n = len(vertices)\n    \n    for i in range(n):\n        p1 = vertices[i]\n        p2 = vertices[(i + 1) % n]\n        p0 = vertices[(i - 1) % n]\n        \n        v1 = np.array(p2) - np.array(p1)\n        v0 = np.array(p1) - np.array(p0)\n        \n        angle1 = math.atan2(v1[1], v1[0])\n        angle0 = math.atan2(v0[1], v0[0])\n        \n        if corner_style == \"round\":\n            radius = offset\n            center = np.array(p1) + np.array([\n                radius * math.cos((angle0 + angle1) \u002F 2),\n                radius * math.sin((angle0 + angle1) \u002F 2)\n            ])\n            # Generate arc points\n            for t in np.linspace(0, 1, 9):\n                angle = angle0 + (angle1 - angle0) * t\n                offset_vertices.append((\n                    center[0] + radius * math.cos(angle + math.pi\u002F2),\n                    center[1] + radius * math.sin(angle + math.pi\u002F2)\n                ))\n        else:\n            # Miter join\n            bisector = (angle0 + angle1) \u002F 2\n            offset_vertices.append((\n                p1[0] + offset * math.cos(bisector + math.pi\u002F2),\n                p1[1] + offset * math.sin(bisector + math.pi\u002F2)\n            ))\n    \n    return offset_vertices\n\ndef raster_toolpath(\n    bbox: Tuple[float, float, float, float],\n    stepover: float,\n    direction: str = \"x\"\n) -> List[Tuple[float, float]]:\n    \"\"\"Generate raster (zigzag) toolpath.\"\"\"\n    xmin, xmax, ymin, ymax = bbox\n    path = []\n    \n    if direction == \"x\":\n        for y in np.arange(ymin, ymax, stepover):\n            if (y - ymin) \u002F stepover % 2 == 0:\n                path.extend([(xmin, y), (xmax, y)])\n            else:\n                path.extend([(xmax, y), (xmin, y)])\n    else:\n        for x in np.arange(xmin, xmax, stepover):\n            if (x - xmin) \u002F stepover % 2 == 0:\n                path.extend([(x, ymin), (x, ymax)])\n            else:\n                path.extend([(x, ymax), (x, ymin)])\n    \n    return path\n\ndef spiral_toolpath(\n    center: Tuple[float, float],\n    start_radius: float,\n    end_radius: float,\n    angle_per_step: float = 0.1,\n    z_feed: float = 0.01\n) -> List[Tuple[float, float, float]]:\n    \"\"\"Generate spiral toolpath for drilling\u002Fmilling.\"\"\"\n    path = []\n    r = start_radius\n    theta = 0\n    \n    while r \u003C= end_radius:\n        x = center[0] + r * math.cos(theta)\n        y = center[1] + r * math.sin(theta)\n        z = -r \u002F end_radius * 5  # Example z-depth\n        path.append((x, y, z))\n        r += 0.05\n        theta += angle_per_step\n    \n    return path\n\ndef trochoidal_milling(\n    center: Tuple[float, float],\n    radius: float,\n    slot_width: float,\n    stepdown: float,\n    total_depth: float\n) -> List[Tuple[float, float, float]]:\n    \"\"\"Generate trochoidal milling toolpath.\"\"\"\n    path = []\n    current_depth = 0\n    \n    while current_depth \u003C total_depth:\n        current_depth += stepdown\n        if current_depth > total_depth:\n            current_depth = total_depth\n        \n        angle = 0\n        while angle \u003C 2 * math.pi:\n            x = center[0] + (radius + slot_width\u002F2 * math.cos(angle)) * math.cos(angle\u002F2)\n            y = center[1] + (radius + slot_width\u002F2 * math.cos(angle)) * math.sin(angle\u002F2)\n            z = -current_depth\n            path.append((x, y, z))\n            angle += 0.2\n    \n    return path\n\n# Example: Raster toolpath\nbbox = (0, 100, 0, 50)\npath = raster_toolpath(bbox, 10, \"x\")\nprint(f\"Generated {len(path)} path points\")\n```\n\n### Feeds and Speeds\n```python\n@dataclass\nclass ToolParameters:\n    diameter: float  # mm\n    num_flutes: int\n    material: str\n    hardness: float  # HRC\n\n@dataclass\nclass MaterialProperties:\n    name: str\n    hardness: float  # HB or HRC\n    tensile_strength: float  # MPa\n    machinability_rating: float\n\ndef calculate_spindle_speed(\n    cutting_speed: float,\n    tool_diameter: float\n) -> float:\n    \"\"\"Calculate spindle RPM.\"\"\"\n    return (1000 * cutting_speed) \u002F (math.pi * tool_diameter)\n\ndef calculate_feed_rate(\n    spindle_speed: float,\n    feed_per_tooth: float,\n    num_flutes: int\n) -> float:\n    \"\"\"Calculate feed rate mm\u002Fmin.\"\"\"\n    return spindle_speed * feed_per_tooth * num_flutes\n\ndef calculate_material_removal_rate(\n    width: float,\n    depth: float,\n    feed_rate: float\n) -> float:\n    \"\"\"Calculate MRR mm³\u002Fmin.\"\"\"\n    return width * depth * feed_rate\n\ndef calculate_power_requirement(\n    mrr: float,\n    specific_energy: float\n) -> float:\n    \"\"\"Calculate cutting power kW.\"\"\"\n    return mrr * specific_energy \u002F 60000\n\ndef estimate_feeds_speeds(\n    material: str,\n    tool_diameter: float,\n    num_flutes: int,\n    operation: str\n) -> dict:\n    \"\"\"Estimate feeds and speeds based on material and operation.\"\"\"\n    material_data = {\n        \"aluminum\": {\"vc\": 200, \"fz\": 0.08, \"se\": 600},\n        \"steel\": {\"vc\": 100, \"fz\": 0.04, \"se\": 1500},\n        \"stainless\": {\"vc\": 70, \"fz\": 0.03, \"se\": 1800},\n        \"titanium\": {\"vc\": 50, \"fz\": 0.02, \"se\": 2500}\n    }\n    \n    modifiers = {\n        \"roughing\": {\"vc_mult\": 1.2, \"fz_mult\": 1.2},\n        \"finishing\": {\"vc_mult\": 1.5, \"fz_mult\": 0.5},\n        \"slotting\": {\"vc_mult\": 0.6, \"fz_mult\": 0.8}\n    }\n    \n    m = material_data.get(material, material_data[\"steel\"])\n    op_mod = modifiers.get(operation, {\"vc_mult\": 1.0, \"fz_mult\": 1.0})\n    \n    vc = m[\"vc\"] * op_mod[\"vc_mult\"]\n    fz = m[\"fz\"] * op_mod[\"fz_mult\"]\n    \n    n = calculate_spindle_speed(vc)\n    vf, tool_diameter = calculate_feed_rate(n, fz, num_flutes)\n    \n    return {\n        \"spindle_speed_rpm\": n,\n        \"feed_rate_mm_min\": vf,\n        \"chip_load_mm_tooth\": fz\n    }\n\n# Example: Feeds and speeds\nsettings = estimate_feeds_speeds(\"aluminum\", 10, 4, \"roughing\")\nprint(f\"Spindle speed: {settings['spindle_speed_rpm']:.0f} RPM\")\nprint(f\"Feed rate: {settings['feed_rate_mm_min']:.1f} mm\u002Fmin\")\n```\n\n### Additive Manufacturing\n```python\n@dataclass\nclass AMBuildSettings:\n    layer_height: float  # mm\n    infill_percentage: float\n    infill_pattern: str\n    build_temperature: float  # C\n    bed_temperature: float  # C\n    print_speed: float  # mm\u002Fs\n    support_type: str\n\ndef estimate_build_time(\n    num_layers: int,\n    layer_area: float,\n    print_speed: float,\n    travel_speed: float = 150,\n    layer_change_time: float = 5\n) -> float:\n    \"\"\"Estimate total build time in hours.\"\"\"\n    print_time = (num_layers * layer_area) \u002F print_speed \u002F 60\n    travel_factor = 0.3\n    layer_time = num_layers * layer_change_time \u002F 60\n    return (print_time * (1 + travel_factor) + layer_time) \u002F 60\n\ndef calculate_material_usage(\n    volume_mm3: float,\n    infill_percentage: float = 20,\n    support_percentage: float = 10\n) -> float:\n    \"\"\"Calculate required material in grams.\"\"\"\n    density = 1.24  # PLA g\u002Fcm³\n    volume_cm3 = volume_mm3 \u002F 1000\n    total_volume = volume_cm3 * (1 + infill_percentage\u002F100) * (1 + support_percentage\u002F100)\n    return total_volume * density\n\ndef optimize_build_orientation(\n    surface_area: float,\n    build_volume: Tuple[float, float, float],\n    min_surface_roughness: bool = True,\n    max_strength: bool = False\n) -> Tuple[float, float, float]:\n    \"\"\"Optimize part orientation for 3D printing.\"\"\"\n    x, y, z = build_volume\n    \n    if min_surface_roughness:\n        return (x, y, 0.1)  # Largest flat surface down\n    elif max_strength:\n        return (0.1, y, z)  # Layer lines perpendicular to load\n    return (x, y, z)\n\ndef generate_support_structure(\n    overhang_angle_threshold: float = 45,\n    support_density: float = 0.2\n) -> List[dict]:\n    \"\"\"Generate support structure parameters.\"\"\"\n    return [{\n        \"angle_threshold\": overhang_angle_threshold,\n        \"density\": support_density,\n        \"style\": \"tree\" if support_density \u003C 0.15 else \"grid\"\n    }]\n\n# Example: Build estimation\nbuild = AMBuildSettings(\n    layer_height=0.2,\n    infill_percentage=20,\n    infill_pattern=\"grid\",\n    print_speed=60\n)\ntime = estimate_build_time(100, 50*50, 60)\nmaterial = calculate_material_usage(100*100*100, 20, 10)\nprint(f\"Estimated build time: {time:.1f} hours\")\nprint(f\"Material required: {material:.1f} g\")\n```\n\n### CAM Post-Processing\n```python\n@dataclass\nclass PostProcessorConfig:\n    machine_type: str\n    control_system: str\n    output_format: str\n    arc_output: str\n    tool_change_mcode: str\n    coolant_mcodes: Tuple[str, str]\n\ndef generate_post_processor(\n    config: PostProcessorConfig\n) -> dict:\n    \"\"\"Generate post-processor configuration.\"\"\"\n    return {\n        \"header\": [\n            f\"O1234 ({config.machine_type} program)\",\n            \"G90 G21 G40\",\n            f\"G54 (Work coordinate: {config.control_system})\"\n        ],\n        \"tool_change\": f\"M6 T#{{TOOL_NUMBER}} ({config.tool_change_mcode})\",\n        \"coolant_on\": config.coolant_mcodes[0],\n        \"coolant_off\": config.coolant_mcodes[1],\n        \"arc_format\": config.arc_output,\n        \"footer\": [\"M5\", \"M30\"]\n    }\n\ndef interpolate_gcode(\n    input_points: List[Tuple[float, float, float]],\n    tolerance: float = 0.01\n) -> List[Tuple[float, float, float]]:\n    \"\"\"Interpolate toolpath with tolerance.\"\"\"\n    output = [input_points[0]]\n    \n    for i in range(1, len(input_points)):\n        p1 = input_points[i-1]\n        p2 = input_points[i]\n        dist = math.sqrt(\n            (p2[0]-p1[0])**2 + \n            (p2[1]-p1[1])**2 + \n            (p2[2]-p1[2])**2\n        )\n        num_points = max(2, int(dist \u002F tolerance))\n        \n        for j in range(1, num_points):\n            t = j \u002F num_points\n            output.append((\n                p1[0] + (p2[0]-p1[0]) * t,\n                p1[1] + (p2[1]-p1[1]) * t,\n                p1[2] + (p2[2]-p1[2]) * t\n            ))\n    \n    return output\n\ndef verify_toolpath(\n    toolpath: List[Tuple[float, float, float]],\n    machine_limits: dict\n) -> List[str]:\n    \"\"\"Verify toolpath against machine limits.\"\"\"\n    warnings = []\n    \n    for i, (x, y, z) in enumerate(toolpath):\n        if x \u003C machine_limits[\"x_min\"] or x > machine_limits[\"x_max\"]:\n            warnings.append(f\"Point {i}: X={x:.3f} out of range\")\n        if y \u003C machine_limits[\"y_min\"] or y > machine_limits[\"y_max\"]:\n            warnings.append(f\"Point {i}: Y={y:.3f} out of range\")\n        if z \u003C machine_limits[\"z_min\"] or z > machine_limits[\"z_max\"]:\n            warnings.append(f\"Point {i}: Z={z:.3f} out of range\")\n    \n    return warnings\n\n# Example: Post-processor\nconfig = PostProcessorConfig(\n    machine_type=\"Haas VF-2\",\n    control_system=\"Fanuc\",\n    output_format=\"XYZ\",\n    arc_output=\"IJ\",\n    tool_change_mcode=\"M6\",\n    coolant_on=\"M8\",\n    coolant_off=\"M9\"\n)\npost = generate_post_processor(config)\nprint(\"Header:\", post[\"header\"][1])\nprint(\"Footer:\", post[\"footer\"][1])\n```\n\n## Best Practices\n- Always verify toolpaths before cutting using simulation\n- Use proper work coordinate systems and origin points\n- Consider tool deflection and vibration in feed\u002Fspeed calculations\n- Use appropriate stock allowances for finish passes\n- Verify machine limits and tool lengths before running programs\n- Optimize toolpaths for reduced cycle time\n- Use proper fixturing to minimize vibration\n- Consider tolerances and shrink factors in CAD models\n- Document CAM settings and post-processor configuration\n- Test programs with air cuts before production runs\n","## What I do\n- Create 3D geometric models using CAD software\n- Generate CNC toolpaths for manufacturing\n- Program CNC machines using G-code and CAM software\n- Design for additive manufacturing (3D printing)\n- Perform toolpath simulation and verification\n- Optimize machining parameters for efficiency\n- Convert CAD models to manufacturing formats\n- Verify tool collision and machine limits\n\n## When to use me\nWhen creating 3D models, generating CNC toolpaths, programming CNC machines, or designing parts for additive manufacturing.\n\n## Core Concepts\n- Solid modeling (CSG, B-rep)\n- Surface modeling and NURBS\n- Feature-based modeling\n- Toolpath strategies (contour, pocketing, drilling)\n- CNC programming (G-code, M-code)\n- Feed and speed calculations\n- Tool geometry and compensation\n- Additive manufacturing processes (FDM, SLA, SLS)\n- Build orientation and support generation\n- Post-processing for different machine controllers\n\n## Code Examples\n\n### G-Code Generation\n```python\nfrom dataclasses import dataclass\nfrom typing import List, Tuple\nimport math\n\n@dataclass\nclass GCodeCommand:\n    code: str\n    x: float = None\n    y: float = None\n    z: float = None\n    f: float = None\n    s: float = None\n\ndef rapid_move(x: float, y: float, z: float) -> str:\n    \"\"\"Generate G0 rapid move command.\"\"\"\n    return f\"G0 X{x:.4f} Y{y:.4f} Z{z:.4f}\"\n\ndef linear_move(x: float, y: float, z: float, f: float) -> str:\n    \"\"\"Generate G1 linear move command.\"\"\"\n    return f\"G1 X{x:.4f} Y{y:.4f} Z{z:.4f} F{f:.1f}\"\n\ndef circular_move(\n    i: float, j: float, x: float, y: float,\n    direction: str = \"clockwise\",\n    f: float = 100\n) -> str:\n    \"\"\"Generate G2\u002FG3 circular move.\"\"\"\n    g_code = \"G2\" if direction == \"clockwise\" else \"G3\"\n    return f\"{g_code} X{x:.4f} Y{y:.4f} I{i:.4f} J{j:.4f} F{f:.1f}\"\n\ndef drill_cycle(\n    x: float, y: float,\n    z_start: float,\n    z_depth: float,\n    z_retract: float,\n    f_plunge: float,\n    f_rapid: float\n) -> List[str]:\n    \"\"\"Generate G81 drilling cycle.\"\"\"\n    return [\n        rapid_move(x, y, z_start),\n        f\"G81 R{z_retract} Z{z_depth} F{f_plunge}\",\n        f\"G80\",\n        rapid_move(x, y, z_retract)\n    ]\n\ndef canned_cycle(\n    cycle: str,\n    x: float, y: float,\n    r: float, z: float,\n    q: float = None,\n    f: float = 100\n) -> str:\n    \"\"\"Generate canned cycle command.\"\"\"\n    if q:\n        return f\"{cycle} R{r} Z{z} Q{q} F{f}\"\n    return f\"{cycle} R{r} Z{z} F{f}\"\n\n# Example: Simple part program\ngcode = [\n    \"G90 G21 G40\",  # Absolute, mm, cancel compensation\n    \"G54\",  # Work coordinate system 1\n    \"M6 T1\",  # Tool change to tool 1\n    \"M3 S3000\",  # Spindle on clockwise 3000 RPM\n    rapid_move(0, 0, 5),\n    linear_move(10, 0, -2, 100),\n    linear_move(10, 10, -2, 100),\n    linear_move(0, 10, -2, 100),\n    linear_move(0, 0, -2, 100),\n    \"M5\",  # Spindle off\n    \"M30\"  # Program end\n]\nfor line in gcode[:5]:\n    print(line)\n```\n\n### Toolpath Generation\n```python\nfrom typing import List, Tuple\nimport numpy as np\n\ndef offset_polygon(\n    vertices: List[Tuple[float, float]],\n    offset: float,\n    corner_style: str = \"round\"\n) -> List[Tuple[float, float]]:\n    \"\"\"Generate offset contour for tool radius compensation.\"\"\"\n    offset_vertices = []\n    n = len(vertices)\n    \n    for i in range(n):\n        p1 = vertices[i]\n        p2 = vertices[(i + 1) % n]\n        p0 = vertices[(i - 1) % n]\n        \n        v1 = np.array(p2) - np.array(p1)\n        v0 = np.array(p1) - np.array(p0)\n        \n        angle1 = math.atan2(v1[1], v1[0])\n        angle0 = math.atan2(v0[1], v0[0])\n        \n        if corner_style == \"round\":\n            radius = offset\n            center = np.array(p1) + np.array([\n                radius * math.cos((angle0 + angle1) \u002F 2),\n                radius * math.sin((angle0 + angle1) \u002F 2)\n            ])\n            # Generate arc points\n            for t in np.linspace(0, 1, 9):\n                angle = angle0 + (angle1 - angle0) * t\n                offset_vertices.append((\n                    center[0] + radius * math.cos(angle + math.pi\u002F2),\n                    center[1] + radius * math.sin(angle + math.pi\u002F2)\n                ))\n        else:\n            # Miter join\n            bisector = (angle0 + angle1) \u002F 2\n            offset_vertices.append((\n                p1[0] + offset * math.cos(bisector + math.pi\u002F2),\n                p1[1] + offset * math.sin(bisector + math.pi\u002F2)\n            ))\n    \n    return offset_vertices\n\ndef raster_toolpath(\n    bbox: Tuple[float, float, float, float],\n    stepover: float,\n    direction: str = \"x\"\n) -> List[Tuple[float, float]]:\n    \"\"\"Generate raster (zigzag) toolpath.\"\"\"\n    xmin, xmax, ymin, ymax = bbox\n    path = []\n    \n    if direction == \"x\":\n        for y in np.arange(ymin, ymax, stepover):\n            if (y - ymin) \u002F stepover % 2 == 0:\n                path.extend([(xmin, y), (xmax, y)])\n            else:\n                path.extend([(xmax, y), (xmin, y)])\n    else:\n        for x in np.arange(xmin, xmax, stepover):\n            if (x - xmin) \u002F stepover % 2 == 0:\n                path.extend([(x, ymin), (x, ymax)])\n            else:\n                path.extend([(x, ymax), (x, ymin)])\n    \n    return path\n\ndef spiral_toolpath(\n    center: Tuple[float, float],\n    start_radius: float,\n    end_radius: float,\n    angle_per_step: float = 0.1,\n    z_feed: float = 0.01\n) -> List[Tuple[float, float, float]]:\n    \"\"\"Generate spiral toolpath for drilling\u002Fmilling.\"\"\"\n    path = []\n    r = start_radius\n    theta = 0\n    \n    while r \u003C= end_radius:\n        x = center[0] + r * math.cos(theta)\n        y = center[1] + r * math.sin(theta)\n        z = -r \u002F end_radius * 5  # Example z-depth\n        path.append((x, y, z))\n        r += 0.05\n        theta += angle_per_step\n    \n    return path\n\ndef trochoidal_milling(\n    center: Tuple[float, float],\n    radius: float,\n    slot_width: float,\n    stepdown: float,\n    total_depth: float\n) -> List[Tuple[float, float, float]]:\n    \"\"\"Generate trochoidal milling toolpath.\"\"\"\n    path = []\n    current_depth = 0\n    \n    while current_depth \u003C total_depth:\n        current_depth += stepdown\n        if current_depth > total_depth:\n            current_depth = total_depth\n        \n        angle = 0\n        while angle \u003C 2 * math.pi:\n            x = center[0] + (radius + slot_width\u002F2 * math.cos(angle)) * math.cos(angle\u002F2)\n            y = center[1] + (radius + slot_width\u002F2 * math.cos(angle)) * math.sin(angle\u002F2)\n            z = -current_depth\n            path.append((x, y, z))\n            angle += 0.2\n    \n    return path\n\n# Example: Raster toolpath\nbbox = (0, 100, 0, 50)\npath = raster_toolpath(bbox, 10, \"x\")\nprint(f\"Generated {len(path)} path points\")\n```\n\n### Feeds and Speeds\n```python\n@dataclass\nclass ToolParameters:\n    diameter: float  # mm\n    num_flutes: int\n    material: str\n    hardness: float  # HRC\n\n@dataclass\nclass MaterialProperties:\n    name: str\n    hardness: float  # HB or HRC\n    tensile_strength: float  # MPa\n    machinability_rating: float\n\ndef calculate_spindle_speed(\n    cutting_speed: float,\n    tool_diameter: float\n) -> float:\n    \"\"\"Calculate spindle RPM.\"\"\"\n    return (1000 * cutting_speed) \u002F (math.pi * tool_diameter)\n\ndef calculate_feed_rate(\n    spindle_speed: float,\n    feed_per_tooth: float,\n    num_flutes: int\n) -> float:\n    \"\"\"Calculate feed rate mm\u002Fmin.\"\"\"\n    return spindle_speed * feed_per_tooth * num_flutes\n\ndef calculate_material_removal_rate(\n    width: float,\n    depth: float,\n    feed_rate: float\n) -> float:\n    \"\"\"Calculate MRR mm³\u002Fmin.\"\"\"\n    return width * depth * feed_rate\n\ndef calculate_power_requirement(\n    mrr: float,\n    specific_energy: float\n) -> float:\n    \"\"\"Calculate cutting power kW.\"\"\"\n    return mrr * specific_energy \u002F 60000\n\ndef estimate_feeds_speeds(\n    material: str,\n    tool_diameter: float,\n    num_flutes: int,\n    operation: str\n) -> dict:\n    \"\"\"Estimate feeds and speeds based on material and operation.\"\"\"\n    material_data = {\n        \"aluminum\": {\"vc\": 200, \"fz\": 0.08, \"se\": 600},\n        \"steel\": {\"vc\": 100, \"fz\": 0.04, \"se\": 1500},\n        \"stainless\": {\"vc\": 70, \"fz\": 0.03, \"se\": 1800},\n        \"titanium\": {\"vc\": 50, \"fz\": 0.02, \"se\": 2500}\n    }\n    \n    modifiers = {\n        \"roughing\": {\"vc_mult\": 1.2, \"fz_mult\": 1.2},\n        \"finishing\": {\"vc_mult\": 1.5, \"fz_mult\": 0.5},\n        \"slotting\": {\"vc_mult\": 0.6, \"fz_mult\": 0.8}\n    }\n    \n    m = material_data.get(material, material_data[\"steel\"])\n    op_mod = modifiers.get(operation, {\"vc_mult\": 1.0, \"fz_mult\": 1.0})\n    \n    vc = m[\"vc\"] * op_mod[\"vc_mult\"]\n    fz = m[\"fz\"] * op_mod[\"fz_mult\"]\n    \n    n = calculate_spindle_speed(vc)\n    vf, tool_diameter = calculate_feed_rate(n, fz, num_flutes)\n    \n    return {\n        \"spindle_speed_rpm\": n,\n        \"feed_rate_mm_min\": vf,\n        \"chip_load_mm_tooth\": fz\n    }\n\n# Example: Feeds and speeds\nsettings = estimate_feeds_speeds(\"aluminum\", 10, 4, \"roughing\")\nprint(f\"Spindle speed: {settings['spindle_speed_rpm']:.0f} RPM\")\nprint(f\"Feed rate: {settings['feed_rate_mm_min']:.1f} mm\u002Fmin\")\n```\n\n### Additive Manufacturing\n```python\n@dataclass\nclass AMBuildSettings:\n    layer_height: float  # mm\n    infill_percentage: float\n    infill_pattern: str\n    build_temperature: float  # C\n    bed_temperature: float  # C\n    print_speed: float  # mm\u002Fs\n    support_type: str\n\ndef estimate_build_time(\n    num_layers: int,\n    layer_area: float,\n    print_speed: float,\n    travel_speed: float = 150,\n    layer_change_time: float = 5\n) -> float:\n    \"\"\"Estimate total build time in hours.\"\"\"\n    print_time = (num_layers * layer_area) \u002F print_speed \u002F 60\n    travel_factor = 0.3\n    layer_time = num_layers * layer_change_time \u002F 60\n    return (print_time * (1 + travel_factor) + layer_time) \u002F 60\n\ndef calculate_material_usage(\n    volume_mm3: float,\n    infill_percentage: float = 20,\n    support_percentage: float = 10\n) -> float:\n    \"\"\"Calculate required material in grams.\"\"\"\n    density = 1.24  # PLA g\u002Fcm³\n    volume_cm3 = volume_mm3 \u002F 1000\n    total_volume = volume_cm3 * (1 + infill_percentage\u002F100) * (1 + support_percentage\u002F100)\n    return total_volume * density\n\ndef optimize_build_orientation(\n    surface_area: float,\n    build_volume: Tuple[float, float, float],\n    min_surface_roughness: bool = True,\n    max_strength: bool = False\n) -> Tuple[float, float, float]:\n    \"\"\"Optimize part orientation for 3D printing.\"\"\"\n    x, y, z = build_volume\n    \n    if min_surface_roughness:\n        return (x, y, 0.1)  # Largest flat surface down\n    elif max_strength:\n        return (0.1, y, z)  # Layer lines perpendicular to load\n    return (x, y, z)\n\ndef generate_support_structure(\n    overhang_angle_threshold: float = 45,\n    support_density: float = 0.2\n) -> List[dict]:\n    \"\"\"Generate support structure parameters.\"\"\"\n    return [{\n        \"angle_threshold\": overhang_angle_threshold,\n        \"density\": support_density,\n        \"style\": \"tree\" if support_density \u003C 0.15 else \"grid\"\n    }]\n\n# Example: Build estimation\nbuild = AMBuildSettings(\n    layer_height=0.2,\n    infill_percentage=20,\n    infill_pattern=\"grid\",\n    print_speed=60\n)\ntime = estimate_build_time(100, 50*50, 60)\nmaterial = calculate_material_usage(100*100*100, 20, 10)\nprint(f\"Estimated build time: {time:.1f} hours\")\nprint(f\"Material required: {material:.1f} g\")\n```\n\n### CAM Post-Processing\n```python\n@dataclass\nclass PostProcessorConfig:\n    machine_type: str\n    control_system: str\n    output_format: str\n    arc_output: str\n    tool_change_mcode: str\n    coolant_mcodes: Tuple[str, str]\n\ndef generate_post_processor(\n    config: PostProcessorConfig\n) -> dict:\n    \"\"\"Generate post-processor configuration.\"\"\"\n    return {\n        \"header\": [\n            f\"O1234 ({config.machine_type} program)\",\n            \"G90 G21 G40\",\n            f\"G54 (Work coordinate: {config.control_system})\"\n        ],\n        \"tool_change\": f\"M6 T#{{TOOL_NUMBER}} ({config.tool_change_mcode})\",\n        \"coolant_on\": config.coolant_mcodes[0],\n        \"coolant_off\": config.coolant_mcodes[1],\n        \"arc_format\": config.arc_output,\n        \"footer\": [\"M5\", \"M30\"]\n    }\n\ndef interpolate_gcode(\n    input_points: List[Tuple[float, float, float]],\n    tolerance: float = 0.01\n) -> List[Tuple[float, float, float]]:\n    \"\"\"Interpolate toolpath with tolerance.\"\"\"\n    output = [input_points[0]]\n    \n    for i in range(1, len(input_points)):\n        p1 = input_points[i-1]\n        p2 = input_points[i]\n        dist = math.sqrt(\n            (p2[0]-p1[0])**2 + \n            (p2[1]-p1[1])**2 + \n            (p2[2]-p1[2])**2\n        )\n        num_points = max(2, int(dist \u002F tolerance))\n        \n        for j in range(1, num_points):\n            t = j \u002F num_points\n            output.append((\n                p1[0] + (p2[0]-p1[0]) * t,\n                p1[1] + (p2[1]-p1[1]) * t,\n                p1[2] + (p2[2]-p1[2]) * t\n            ))\n    \n    return output\n\ndef verify_toolpath(\n    toolpath: List[Tuple[float, float, float]],\n    machine_limits: dict\n) -> List[str]:\n    \"\"\"Verify toolpath against machine limits.\"\"\"\n    warnings = []\n    \n    for i, (x, y, z) in enumerate(toolpath):\n        if x \u003C machine_limits[\"x_min\"] or x > machine_limits[\"x_max\"]:\n            warnings.append(f\"Point {i}: X={x:.3f} out of range\")\n        if y \u003C machine_limits[\"y_min\"] or y > machine_limits[\"y_max\"]:\n            warnings.append(f\"Point {i}: Y={y:.3f} out of range\")\n        if z \u003C machine_limits[\"z_min\"] or z > machine_limits[\"z_max\"]:\n            warnings.append(f\"Point {i}: Z={z:.3f} out of range\")\n    \n    return warnings\n\n# Example: Post-processor\nconfig = PostProcessorConfig(\n    machine_type=\"Haas VF-2\",\n    control_system=\"Fanuc\",\n    output_format=\"XYZ\",\n    arc_output=\"IJ\",\n    tool_change_mcode=\"M6\",\n    coolant_on=\"M8\",\n    coolant_off=\"M9\"\n)\npost = generate_post_processor(config)\nprint(\"Header:\", post[\"header\"][1])\nprint(\"Footer:\", post[\"footer\"][1])\n```\n\n## Best Practices\n- Always verify toolpaths before cutting using simulation\n- Use proper work coordinate systems and origin points\n- Consider tool deflection and vibration in feed\u002Fspeed calculations\n- Use appropriate stock allowances for finish passes\n- Verify machine limits and tool lengths before running programs\n- Optimize toolpaths for reduced cycle time\n- Use proper fixturing to minimize vibration\n- Consider tolerances and shrink factors in CAD models\n- Document CAM settings and post-processor configuration\n- Test programs with air cuts before production runs\n",{"name":5,"license":14,"metadata":33,"description":7,"compatibility":25},{"audience":34,"category":22},"engineers","main","5f7a3e453c98261f93d19a6a7de44ad8f7b72d41","engineering\u002Fcad-cam",2,"https:\u002F\u002Fgithub.com\u002Fffsshhttiikk\u002Fopencode-agents-skills","https:\u002F\u002Fgithub.com\u002Fffsshhttiikk","2026-03-01 06:55:40",{"source":8,"skillName":5,"commands":43,"prompt":53,"zipAvailable":54},[44,47,50],{"tool":45,"command":46},"npx","npx skills add ffsshhttiikk\u002Fopencode-agents-skills --skill cad-cam",{"tool":48,"command":49},"bunx","bunx skills add ffsshhttiikk\u002Fopencode-agents-skills --skill cad-cam",{"tool":51,"command":52},"pnpm","pnpm dlx skills add ffsshhttiikk\u002Fopencode-agents-skills --skill cad-cam","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fffsshhttiikk\u002Fopencode-agents-skills\u002Fblob\u002Fmain\u002Fengineering\u002Fcad-cam\u002FSKILL.md",true,[],[57,68,78,87,97,106],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":28},"01M6CXT9TXDF79BWJTMQAPB49G","xamarin","Xamarin cross-platform development","https:\u002F\u002Fgithub.com\u002Fffsshhttiikk\u002Fopencode-agents-skills\u002Fblob\u002Fmain\u002Fxamarin\u002FSKILL.md",[],[59,64,65,66,25,67],"platform","cross-platform","mobile","development",{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":28},"01M6CXT8AD04MFYDA32VW3FKAG","wrangling","Data wrangling fundamentals","https:\u002F\u002Fgithub.com\u002Fffsshhttiikk\u002Fopencode-agents-skills\u002Fblob\u002Fmain\u002Fwrangling\u002FSKILL.md",[],[70,75,25,76,77],"data wrangling","science","data",{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":28},"01M6CXT717GCN7SRRNPBDP4508","windows","Windows operating system administration and scripting","https:\u002F\u002Fgithub.com\u002Fffsshhttiikk\u002Fopencode-agents-skills\u002Fblob\u002Fmain\u002Fwindows\u002FSKILL.md",[],[80,85,25,86],"system","scripting",{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":28},"01M6CXT54K794NMEM3XAPZZDKT","wide-column","Wide-column data model","https:\u002F\u002Fgithub.com\u002Fffsshhttiikk\u002Fopencode-agents-skills\u002Fblob\u002Fmain\u002Fwide-column\u002FSKILL.md",[],[94,95,25,96,77],"wide column","databases","model",{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":28},"01M6CXT28FMT2P4V9GZE67WA8E","wide-column-stores","Wide-column database stores","https:\u002F\u002Fgithub.com\u002Fffsshhttiikk\u002Fopencode-agents-skills\u002Fblob\u002Fmain\u002Fwide-column-stores\u002FSKILL.md",[],[104,95,25,105],"wide column stores","database",{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":28},"01M6CXT0D0M0Q4T2N7C2RX7DSN","websockets","WebSocket implementation and best practices","https:\u002F\u002Fgithub.com\u002Fffsshhttiikk\u002Fopencode-agents-skills\u002Fblob\u002Fmain\u002Fwebsockets\u002FSKILL.md",[],[108,113,114,115,25,116,117],"websocket","real-time","time","best practices","implementation"]