Saturday, 14 November 2026

Can Claude recreate the Glow enclosure in PhysCAD?

PhysCAD already has an MCP connector that can be enabled so that you can use an agent to drive CAD designs. I've just used Claude Code to create the Glow enclosure in Fusion. Can I get Claude Code to repeat the task using PhysCAD?

It's simple enough - in PhysCAD, go into Preferences > AI (MCP) >  turn on MCP Server:

Then add the following to the desktop config json file to enable Claude. Note, you have to have note.js installed:


And in Claude, set "Always allow..." use of tools in physcad, unless you want to be driven crazy by endless requests for permissions:


Then off you go. I gave it the HA_Glow_Enclosure.py file from the last session (with Fusion) and let it loose. After a bit of fucking about, getting Claude and PhysCAD up and running together (I've only used PhysCAD for a few minutes to date), we were cooking.

I downloaded the 3D CAD models for the ESP32-C3 Super Mini, the photo detector circuit and the 3 colour LED and was able to drink tea and eat a snack while it got busy.


The ESP32 model was missing its pins, so I got it to add them. Also, got the LED a nice blue colour and the enclosure a black finish, to match the PETG filament I'm using.

The STP file was missing its vital colour appearances, so I got those added.


Lid on:


The ESP PCB model was black, like the actual example I have, so it was almost lost against the black enclosure. I got that changed to blue so it's a bit more visible. And the LED is visible here, although it's not possible to create an actual light source there from what I can tell.

This is with the lid at something like 20% opacity:


It seems PhysCAD can't do proper ray trace rendering (yet) and doesn't respect opacity, so any render will come out black and totally opaque. But this view with translucent cover isn't bad:


Looks almost identical to the Fusion output but let's print one out and see for ourselves....


Well that's pretty convincing. The PhysCAD parts are the middle ones and the Fusion parts are the outer ones. I had to mark the PhysCAD ones so I could tell them apart. Interesting!

Getting Claude Code to make a Glow enclosure in Fusion

I need to make up one of these Home Assistant "Glow" interfaces. 

These damned "smart" electricity meters aren't massively smart, so I'm not about to get one of them fitted. I'm currently with Outfox for both gas and electricity and will be until the current contract expires in several months time. On the other hand, Octopus Energy seem to have a good reputation when it comes to integrating with Home Assistant, as they expose their API. But for the time being, I'm not about to have one of Outfox's contractors rip out the existing meter(s) and fit a semi-smart meter if I'm going to have Octopus a few months later, doubtless of a different and possibly incompatible brand. 

Most modern "dumb" meters have a little LED that blinks once every time a unit of energy is used. In this instance, it's one blink for every Wh (Watt hour) ie 1000 blinks per kWh. It's the left hand of those 2 sensors in the middle of the circular depression. I believe the other is a receiver that can be used by the utility company for doing stuff like reflashing the meter.

So this "Glow" interface simply registers each blink with a photo diode and uses an ESP32 to send the data back to your Home Assistant over the network using its built-in wifi. It's a sort of "stop-gap DIY smart meter".

There's a printable case linked on the website but it's for the full sizes ESP32, not the "Super Mini" (thumbnail sized) ones that are actually linked in the article or indeed the ones I have to hand. Here's the one I printed a few weeks ago when I ordered the parts from Aliexpress:

There are also some crude enclosures shown in Grabcad etc but they aren't what I want. For one thing, I'd like to integrate them into one assembly, not have 2 small housings flailing around for no reason.

The connection diagram for the various elements gives you an idea what's involved.

So, it seems there's nothing I can simply download and print out. We've been here before, I think. But... what better than to get my new mate Claude Code to flash something up? I started out with Google AI before opting to go the whole hog and get Claude Code to directly drive Fusion.

The MD file ended up looking like this, once I'd clarified the requirements:

# Task: Generate an Autodesk Fusion 360 Python Add-In / Script for an All-in-One Home Assistant Glow Enclosure

Write a complete, self-contained Autodesk Fusion 360 Python script (`adsk.core`, `adsk.fusion`) that parametrically generates a two-part 3D-printable enclosure (**Base** and **Snap-Fit Lid**) for an **ESP32-C3 Super Mini** + **LM393 Photodiode Sensor Module** + **5mm RGB Status LED**, designed to mount flat onto a UK **Ampy 5235A** single-phase electricity meter.

## 1. Coordinate System & Orientation
- **Units:** Millimeters (`mm`)
- **XY Plane (`Z = 0`):** Bottom exterior face of the Base (the flat surface that sticks to the electricity meter).
- **+Z Direction:** Outward away from the meter face (towards the lid).
- **+X Direction:** Right across the meter face.
- **+Y Direction:** Upward towards the top of the meter (`-Y` is downward towards the meter tails/cables).
## 2. User Parameters (Create as Fusion 360 `UserParameters` for easy tweaking)
Define all critical dimensions as Fusion 360 User Parameters at the start of the script:
- `wall_thick = 2.0` mm (Outer perimeter and floor/lid thickness)
- `inner_w = 42.0` mm (Total internal X width)
- `inner_h = 52.0` mm (Total internal Y height)
- `inner_d = 23.0` mm (Internal Z depth from floor top to lid bottom — must clear pre-soldered headers + female DuPont jumper plugs)
- `corner_r = 3.0` mm (Outer fillet radius on vertical edges)
- `tol = 0.25` mm (3D printing snap-fit/sliding clearance tolerance)
### Component & Cutout Parameters:
- **Photodiode Aperture (Bottom Floor, `Z = 0` to `wall_thick`):**
  - `pd_hole_dia = 5.6` mm (Snug fit for a 5mm photodiode dome)
  - `pd_x_offset = 10.0` mm (Measured from the inner left wall; aligns with the meter's right-hand pulse LED while keeping the outer left wall clear of the meter's LCD bezel)
  - `pd_y_offset = 26.0` mm (Centered vertically on the inner Y axis)
  - `pd_collar_h = 3.0` mm (Internal cylindrical shroud rising from the floor around `pd_hole_dia`, outer diameter `pd_hole_dia + 2.4` mm, to block stray light)
- **Internal Light Baffle (Separates Left Sensor Bay from Right ESP32 Bay):**
  - `baffle_x = 18.0` mm (Measured from inner left wall)
  - `baffle_thick = 1.5` mm
  - `baffle_h = 20.0` mm (Rises from floor `Z = wall_thick` to `Z = wall_thick + 20.0`, leaving 3 mm at the top for 3-wire routing between bays)
- **ESP32-C3 Super Mini Bay (Right side, `X > baffle_x`):**
  - `esp_w = 18.2` mm
  - `esp_l = 22.8` mm
  - `esp_standoff_h = 2.5` mm (Raised cradle/rails on the floor so underside solder joints sit flat)
- **USB-C Cutout (Bottom Perimeter Wall, `-Y` face, aligned with Right Bay):**
  - `usbc_w = 9.6` mm
  - `usbc_h = 4.0` mm
  - `usbc_x_center = 30.0` mm (Centered in the right ESP32 bay, measured from inner left wall)
  - `usbc_z_bottom = wall_thick + esp_standoff_h + 1.2` mm (Aligned with the USB-C receptacle sitting on top of the 1.6mm PCB)
- **Status LED Cutout (Top Lid):**
  - `led_hole_dia = 5.2` mm (Press-fit/glue hole for 5mm RGB status LED)
  - `led_x_offset = 30.0` mm (Centered over the right bay so it is isolated behind the light baffle)
  - `led_y_offset = 38.0` mm (Upper section of the right bay, clear of the ESP32 PCB footprint)

## 3. Detailed Geometry Construction Requirements

### Component 1: `Base_Body`
1. **Main Shell:** Create a rounded-rectangle outer profile `(inner_w + 2*wall_thick)` × `(inner_h + 2*wall_thick)` with corner radius `corner_r`, extruded from `Z = 0` to `Z = wall_thick + inner_d`.
2. **Interior Cavity:** Cut an inner rounded-rectangle pocket `(inner_w)` × `(inner_h)` from `Z = wall_thick` through the top (`Z = wall_thick + inner_d`).
3. **Photodiode Hole & Light Collar:**
   - Extrude-cut a vertical cylinder of `pd_hole_dia` through the bottom floor (`Z = 0` to `wall_thick`) at `(pd_x_offset, pd_y_offset)`.
   - Extrude-join a hollow light-blocking collar around that exact hole from `Z = wall_thick` to `Z = wall_thick + pd_collar_h`.
4. **Internal Light Baffle:**
   - Extrude-join a rectangular partition wall of thickness `baffle_thick` spanning the full internal Y height (`inner_h`) at `X = baffle_x`, rising from `Z = wall_thick` to `Z = wall_thick + baffle_h`.
5. **ESP32-C3 Super Mini Positioning Rails:**
   - Add two low-profile positioning ribs (`1.5 mm` wide × `esp_standoff_h` tall × `esp_l` long) along the `-Y` bottom edge of the right bay (`Y = 0` to `esp_l` from the inner `-Y` wall), spaced `esp_w` apart and centered on `usbc_x_center`, to cradle the Super Mini PCB squarely against the USB-C cutout.
6. **USB-C Port Opening:**
   - Extrude-cut a rounded slot (`usbc_w` × `usbc_h`, corner radius `1.5 mm`) through the `-Y` exterior wall centered at `usbc_x_center` and `usbc_z_bottom + usbc_h/2`.
7. **Lid Retention Groove:**
   - Add a small internal snap-fit bead or detent lip (`0.6 mm` protrusion) `1.5 mm` below the top rim along the inner `-X` and `+X` walls.

### Component 2: `Lid_Body` (Generated side-by-side at `X = inner_w + 15 mm` for easy STL export)

1. **Top Cap:** Extrude the same outer rounded-rectangle profile `(inner_w + 2*wall_thick)` × `(inner_h + 2*wall_thick)` from `Z = 0` to `Z = wall_thick`.
2. **Friction/Snap Lip:** Extrude a perimeter skirt (`1.5 mm` wall thickness, `3.5 mm` tall) on the underside of the lid inset by `tol` (`0.25 mm`) from the inner wall dimensions so it slides snugly into `Base_Body`, with matching detent notches for the base's snap bead.
3. **RGB Status LED Hole:** Extrude-cut a `led_hole_dia` hole completely through the lid at `(led_x_offset, led_y_offset)`.

## 4. Script Best Practices

- Wrap all operations cleanly inside `run(context)` with proper `ui.messageBox` error handling.
- Create separate Fusion 360 `Component` occurrences (`Base_Component` and `Lid_Component`) so each body can be exported directly to `.stl` or `.3mf` without manual splitting.
- Name every timeline feature clearly (e.g., `Base_Outer_Shell`, `Photodiode_Aperture`, `Light_Baffle`, `USBC_Cutout`, `Lid_Cap`, `LED_Aperture`).

Phew, that was a bit of a mouthful. Imagine being stuck down the pub with this guy...

That generated a .py script that needed further work:

A few problems:

  • The ESP32 has pin headers underneath the PCBA. i can't remove them, so the board needs to be lifted up so that the underside of the board is at least 9mm from the base. a feature across the cavity would constrain the ESP32 so it can't move upwards, noting that i need to be able to route the 7 wires from the ESP32 to the LED and the sensor board.
  • There needs to be some means of fixing the PCBA so that it doesn't slide backwards when the USB connector is inserted.
  • There should be a narrow slot for the wires to the opto diode to pass across to the other cavity.
  • I've imported the ESP32 and the light sensor board. The sensor LED hole needs to be on the base, close to the top wall of the enclosure, not at the mid point of the base. It also needs some form of fixing. Note that there's a hole in the board near to the 3 pins.
Up until this point, Claude was driving Fusion by getting me to run a Python script. But that's not the modern way. Instead, I told him/it to use the MCP bridge to run Fusion directly without requiring me to play along.

And finally, we got to this point:

What I built

It is the updated design from my last message, with dimensions corrected from your imported models rather than my guesses:

ItemWasNowMeasured from
ESP32 board thickness1.6 mm1.0 mmESP32 model
ESP32 pocket length22.8 mm23.1 mmBoard is exactly 22.8 mm long
USB-C slot height4.0 mm4.8 mmShell is 4.1 mm tall and sits sunk into the board
Photodiode axis to mounting hole22.5 mm28.0 mmHole is 24.5 mm from the diode end of the board, plus 3.5 mm for the lead bend
Sensor boss height7 mm5 mmDiode height above the board

The USB connector’s nose sticks out 1.4 mm past the board edge, so it sits inside the wall slot and also holds the front of the board down.

Fit check

I moved your two imported models into their seated positions: the ESP32 on its rails against the USB wall, and the sensor board with its hole over the boss. When I went to do this the sensor model was facing the other way round (diode towards the USB wall); I turned it so the diode is at the top wall, as you described. If you had flipped it on purpose, tell me and I’ll rework the layout.

  • ESP32: no interference with the base, or with the lid in its closed position. The lid fingers stop 2.0 mm above the top of the board.
  • Sensor board: clear, apart from the diode’s flange touching the collar by 1 mm. That is only because the model’s diode is straight; bent down into the hole it seats on the collar.
  • Lid on base: no overlap.

Still to confirm on the real parts

  • Pin stub height: set esp_hold_gap to the height of the header stubs above the ESP32 board plus about 0.3 mm. The model has no headers, so 2.0 mm is my assumption.
  • Diode lead length: the 3.5 mm bend allowance in sens_hole_dist depends on how long the leads are on your module.
  • Meter fit: the box now hangs 48 mm below the pulse LED, onto the terminal cover.
And here it is. I could have got here more directly but this looks OK:

Here's the ESP32 sitting in a cavity that confines its movement. It's held down by 2 fingers that extend down from the cover (when fitted):



And the light sensor is fastened down with a small self tapper.


Note that the photo sensor in the detector I've ordered seems to be an LDR rather than a photo diode. It has a different shape and position, like this:
The lid has clips to hold it in place. There's a small slot between the 2 cavities for the wiring to pass through.


Let's make the thing and see how it looks.


I haven't used the printer for about a month and now it isn't working so well:


There's minimal fusion between some of the layers and horrible blotches in the surfaces. Despite having 100% fill, let's say the thing "has no structural integrity". Ooof. 


This seems to be due to not keeping your filaments dry, from what I have previously gathered. I've not encountered it before but here we are. Let's try the other reel of (grey) PETG that's loaded on the machine, even though there's no obvious reason it should be any better. 


Ooof (again). That was just as bad - it's simply a different colour. Ah well.

2 actions:
  • Unleash a new reel of PETG from its dehumidified packaging and use that. Third time lucky?
  • Put the 3 open reels of PETG and PLA on the workshop radiator. I should perhaps make a rack for the filaments so they are above the hot radiator by default. I may be wrong and will check up on it but AFAIK, most of the filament driers are simply heated cabinates.

I've printed out the enclosure and lid. There are a couple of problems to fix:
    • The fingers that extend down from the lid to hold the ESP32 down break off when you remove the support raft. They need to be sturdier. Currently they are only 4mm long and are very fragile where they meet the lid. They can be wider at the top, tapering down to where they contact the ESP32.
    • The latch that hods the lid down is too small. The tongue and groove need to be larger so they print better and the tongue has more to click into.
    • The external wall thickness is only 2mm and could usefully be increased to 4mm to give more rigidity.
Make those improvements and I will print it again.

All three changes are made and the new base and lid are rebuilt in your “Housing” document, ready to export. Both built with no timeline errors, and with the lid in its closed position nothing interferes with the base, the ESP32 or the sensor board. I haven’t saved the document.

Hold-down fingers

Each finger is now a tapered wedge instead of a thin post. It is still 2.5 mm wide where it meets the pin stubs, but widens to 8.5 mm where it joins the lid, and it is 8 mm long instead of 4 mm. The taper runs toward the middle of the bay, so the fingers stay clear of the baffle and the side wall.

Latch

Thickening the walls to 4 mm made them too stiff for a larger bead to snap past, so I changed how the latch works, not only its size.

    • Tongues: the lid now has two flexible tongues, each 20 mm long, 14 mm deep and 1.6 mm thick, one on each side wall.
    • Ridge and groove: each tongue carries a 1.0 mm ridge that clicks into a V-groove cut in the base wall. The old bead was 0.6 mm.
    • Removal: the ridge has a long ramp on the way in and a 45° face on the way out, so the lid clicks shut but can still be pulled off.

If the click is too stiff or too loose when printed, latch_t (tongue thickness) and latch_bump (ridge height) are the two parameters to adjust.

Walls

The perimeter walls are 4 mm, so the box is now 50 × 60 mm outside. I left the floor and lid at 2 mm, since they are separate parameters now (floor_thick, lid_thick) and a thicker floor would move the photodiode further from the meter. Say if you want those at 4 mm too.

Changes that follow from the thicker wall

    • USB plug recess: with a 4 mm wall the plug body would hit the outside before the plug seated. There is now a 13.5 × 8 mm recess around the slot on the outside, so the socket face sits flush with the bottom of the recess. Check your cable’s plug body fits that opening.
    • Corner radius: raised from 3 to 5 mm so the inside corners keep a small radius.
    • Meter fit: the box is 4 mm wider and taller than the one you printed.

Printing the lid

Print the lid with its flat outer face on the bed and the fingers and tongues pointing up. Everything on it tapers or stands vertical in that orientation, so it should need no supports or raft, which is what broke the fingers last time.

That looks better. Let's print this:

And now let's get on with wiring up the various parts:

The LED requires 4 wires to the ESP32. And although the ESP32-C3 Super Mini board is different (with more pins etc), the GPIO numbering assignments are the same:
    • Photodiode DO (Digital Out) > Pin 10 (third from bottom on the right side)
    • Photodiode VCC > Pin 3.3 (third from top on the left side)
    • Photodiode GND > Pin G (second from top on the left side)
    • Status LED Red > Pin 0 (bottom-left corner)
    • Status LED Green > Pin 1 (second from bottom on the left side)
    • Status LED Blue > Pin 3 (fourth from bottom on the left side)
    • Status LED Ground > Pin G (shared with the photodiode ground)


Note the Aliexpress "datasheet" says "Compatible with both common cathode and anode types. The kit includes both Common Cathode and Common Anode configurations, providing flexibility for various circuit designs and microcontroller setups.". 

So I should get a meter out and check if there are indeed 2 flavours - and ideally select the right one! As luck would have it, the first one out of the bag is a common cathode, as shown in the Glow schematic.

Obvs the Chinesium diagram for the LED pinout is less use than the proverbial chocolate teapot / fireguard - WTF does this mean?

Ah well. Moving on....

The LEDs have different forward voltages (Vf), so should have different series resistors. As opposed to none at all, as suggested by the schematic. We can do better than that:

ColourTypical Vf at 20 mA (V)Voltage left for resistor (V)Resistor (Ω)Approx. current (mA)
Red2.01.32705
Green3.20.11002 to 4
Blue3.10.2683 to 5

The “voltage left” column is at the datasheet’s 20 mA forward voltage. The green and blue currents are estimates that assume the forward voltage falls to about 2.8 to 2.9 V at these lower currents.

Next - wire up the LED and ESP32 - but the photo detector won't be here until late tomorrow....

Monday, 9 November 2026

Revopoint POP3 laser scanner? Life waster!

In one of those "toy" moments a few (actually three) years ago, I splashed out on one of those laser scanner things when I was messing with making up inlet manifolds for the Honda engine. I was perhaps a bit ambitious (= naïve) when I tried to scan the whole side of the engine, as it was very messy and had loads of wires, pipes, casting ribs etc, not overlooking the myriad components (alternator, ignition coil, tacho connection, coolant hose connections etc. 

However, even when I managed to successfully scan features, there came the obvious question - "what now?" And indeed what now. You end up with a massive point cloud that isn't much use in any self respecting CAD environment. It's worse than a STP / IGS file, as it is not only an unparametric and almost uneditable shell, it's not even composed of proper surfaces. 

There's an interesting tool "scanruler" that aims to convert messy scanned bodies into parameterised models. That might offer a way out of this conundrum. But first, I'd need to acquire a credible body to begin with.

So the scanner has been sitting in its box ever since, going down as one of those silly purchases you don't really like to talk about. Yes, I've had a few of those. But being a Scottish-blooded Yorkshireman ("tighter than a duck's arse"), I've lost a few hours of sleep over this unwise purchase. But perhaps there's a glimmer of life in the thing before it snuffs it forever, after all?

So, let's dig it out and install the latest Revo Scan software (Revoscan6). Can I actually get it to produce something useful, possibly a scan of the TIG torch button???

Struggled like hell to get the camera to register the test object. Finally, after applying loads of targets and spraying the thing with "scanning spray", I sort of got it to acquire some kind of images:


It's sort of recognisable.


Other side up.


You need to stitch the points into a surface, although it won't magically generate points that weren't there.



You can get it to combine several different scans of the same object - but it's really not very clever.

This wasn't going well. Let's try to scan the actual cover. If I'm going to fuck about for ages and possibly even end up with something workable, it may as well be something I might want to work with.



Again, it needed loads of spray and missed quite a few areas. After much buggering about, filling holes etc, I got something sort of approaching vaguely sensible looking scans of both the top and bottom. This was still pretty painful and it's only part way there.



The funny(?) part came when trying to merge them:


FFS. Try again, this time with the cover held in Blutak so that it could possibly scan the whole part in one go. I'm losing the will to carry on at this point.







Bugger this. I'm not going to lose any more of my life carrying on like this. I'll revert to the original plan ie model the part in Fusion.

What an absolutely fucking ridiculous waste of time and money that was. The stupid thing is now back in its box, where it will probably stay until the end of time.

As for scanruler, without a suitable body to work from, I've no means of trying it out. Ho hum.

Thursday, 5 November 2026

TIG button - creating the cover piece in Fusion

So now I need to design a replacement for the original cover that houses the pot and button. The only control input on mine will be via a finger-operated pressure button bearing down on the PSR underneath.

I suppose I could dive straight in and just make the replacement cover but that wouldn't be my style. Why do that when I can spend several possibly pointless hours creating the handle as well? Anyway, rightly or wrongly, that's what I'm about to do.

Here's a collection of planes where I will create a series of cross sections.

Like this:

Then loft them together to create a reasonably organic body:


Then use the shell command to hollow it out, leaving a 2mm wall thickness:


Ooof, it's looking very much like a sex toy where the bell end has got caught in something and got cut short. That will teach it.


Now define the cutaway portion that houses the controls:


And the platform thingy that supports the controller and separates it from the torch cable / hose.


It's getting there...


Create a patch over the opening, to form the outside of the replacement assembly:


Thicken it to 2mm:


Add a tab at the rear:


And a latch at the front:


Let's make one and see how close we are to a fit. I expect this will take some buggering about:


Fresh off the printer:


Doesn't look too bad as a first attempt

But does it come anywhere near fitting? It sort of fits near the front and actually latches in place, so the latch looks like a decent attempt:

But with the latch latched, the rear tongue is then too far back. On the upside, it engages correctly without the latch engaged at the front.

So - it's too long, by about 2mm and too wide by about 1.5mm, possibly more. Even a blind fool can see that - but in my defence, it's not easy to use the ruler tool to measure between points on a curved surface or edge. So I will bugger about with the defining sketches and aim to get it to mate with the handle. It seems like a half reasonable start at least.

I will pick this up again tomorrow and finesse the various cross section sketches to better match the original handle. If I don't fuck up the various interdependencies etc, the cover should mutate towards the intended shape, ideally fitting the torch handle. Time will tell....

Can Claude recreate the Glow enclosure in PhysCAD?

PhysCAD already has an MCP connector that can be enabled so that you can use an agent to drive CAD designs. I've just used Claude Code t...