Sketch From Image logo

Sketch From Image

Community
ghbalf
sketch-from-image

Extract 2D geometry from an attached image and create a FreeCAD sketch from it.

Overview

Publisherghbalf
Repositoryfreecad-ai
Skill namesketch-from-image
Stars
557
Forks
89
Bundled files
Instructions only
LicenseLGPL-2.1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by ghbalf on GitHub. Read the source before you install it.

Installation

Install the Sketch From Image AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/ghbalf/freecad-ai/tree/master/skills/sketch-from-image
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ghbalf/freecad-ai.git /tmp/freecad-ai
mkdir -p .claude/skills
cp -r /tmp/freecad-ai/skills/sketch-from-image .claude/skills/sketch-from-image
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Sketch From Image in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Sketch From Image on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Sketch From Image is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Sketch from Image

Convert an image (drawing, sketch, reference photo, technical drawing) into a FreeCAD sketch by identifying its geometric shapes and creating a sketch with equivalent geometry.

When to use

  • User has attached an image and says "create a sketch from this", "trace this shape", "make a sketch of this", or similar.
  • User wants a starting point for CAD work from a visual reference.

Required user inputs (ask if missing)

  1. Bounding size in mm — the real-world size the sketch should occupy. Ask as: "What size (in mm) should this sketch be? Provide either the overall width or height." Example: "width 40mm" or "height 25mm".
  2. Plane — default XY if not specified. Accept XY, XZ, YZ.
  3. Body name — if the user wants the sketch on an existing body. Default: no body (standalone sketch).

Do NOT guess the size. Without a real dimension, the sketch is useless for CAD.

Extraction procedure

Look at the attached image (or the textual description if no image is present) and identify the 2D shapes. For each shape, record:

  • Shape type: rect, circle, polygon, or line
  • Position and size, scaled so that the overall bounding box matches the user-provided dimension (width OR height; preserve aspect ratio)

Scaling rule

  1. Measure the image's apparent bounding box in pixels (or relative units).
  2. Compute scale = user_dimension_mm / measured_dimension_pixels.
  3. Multiply every coordinate and radius by scale.
  4. Flip Y-axis if the source uses Y-down (SVG, screen pixels, most image formats). FreeCAD sketches use Y-up. Negate all Y coordinates after scaling.
  5. Translate so the sketch is centered around origin (or anchored at 0,0 — state which).

Shape JSON schema (internal — use this shape before calling the tool)

json
{
  "shapes": [
    {"type": "rect",    "x": 0, "y": 0, "width": 40, "height": 25},
    {"type": "circle",  "cx": 20, "cy": 12.5, "r": 3},
    {"type": "polygon", "points": [[0,0], [10,0], [5,8]]},
    {"type": "line",    "x1": 0, "y1": 0, "x2": 10, "y2": 10}
  ],
  "dimensions": [],
  "notes": "brief description of what was recognized"
}

The dimensions array is reserved for future use (auto-constraint from measured values in technical drawings). Leave it [] for now.

Output

After deriving the JSON, call create_sketch with the shapes. Do NOT add constraints — rectangles and circles are auto-constrained. Example:

create_sketch(
  plane="XY",
  geometries=[
    {"type": "rectangle", "x": 0, "y": 0, "width": 40, "height": 25},
    {"type": "circle", "cx": 20, "cy": 12.5, "radius": 3}
  ]
)

For line shapes, emit them as polygons with two points, since create_sketch groups connected line segments into a polygon.

After creating the sketch

Briefly report:

  • Shapes created (count per type)
  • Final bounding size
  • Any shapes you couldn't confidently identify — list them so the user can clarify or re-attach a clearer image.

Do NOT pad, pocket, or otherwise extrude the sketch unless the user explicitly asks — this skill only produces the 2D profile.

Iterating on the sketch

If the user wants to adjust the sketch after initial creation, use edit_sketch.

For resizing, moving, or replacing geometry (most common), use clear_all=true and provide the complete updated geometry:

edit_sketch(sketch_name="MySketch", clear_all=true, add_geometries=[
    {"type": "rectangle", "x": 0, "y": 0, "width": 50, "height": 30},
    {"type": "circle", "cx": 6, "cy": 6, "radius": 3}
])

This clears all old geometry and constraints, then adds fresh geometry — no over-constraint issues. The sketch object, plane attachment, and body membership are preserved.

For adding new geometry to existing (e.g. "add a second hole"): edit_sketch(sketch_name, add_geometries=[...])

For changing dimensions (e.g. "make it 50mm wide"): use clear_all=true with updated geometry coordinates — dimensions are auto-constrained from the geometry. Do NOT manually add DistanceX/DistanceY/Radius constraints.

Limitations (mention if relevant)

  • Curves and splines are approximated as polygons; for complex curves the user should trace manually or use a dedicated tracing tool.
  • Dimension lines and annotations in the image are ignored in v1 (will be supported in a future version via the dimensions array).
  • Hidden lines, section lines, and construction lines are treated as regular geometry. If the image uses drafting conventions, warn the user.

Frequently asked questions

What does the Sketch From Image AI skill do?

Extract 2D geometry from an attached image and create a FreeCAD sketch from it.

Why use Sketch From Image on TypingMind?

Because you install it once and use it with any model. Sketch From Image is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Sketch From Image in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/ghbalf/freecad-ai/tree/master/skills/sketch-from-image. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Sketch From Image?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Sketch From Image?

As many as you like. As long as a model supports skills, you can use Sketch From Image with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Sketch From Image AI skill free?

Yes. It is published on GitHub by ghbalf under the LGPL-2.1 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇