[Therion] Solution Re: Colored Lines Based On Attributes

Andrew Atkinson andrew at wotcc.org.uk
Sun Mar 1 22:27:48 CET 2026



On 01/03/2026 21:14, alastair gott wrote:
> HI Everyone,
> 
> I have asked Claude AI for some assistance in debugging the code, this 
> is my first time using AI in anger. I was pointed in the direction of 
> Claude AI by the creator of the new "Disco" cave surveying device this 
> weekend.
> 
> We passed a few roadblocks and Claude tried to use pencircle, but in the 
> end after generating some more bits of code, we decided on the below.
> 
> It suggests rather than copy and pasting to type out the code manually 
> and also it seems to love Notepad++ and doesn't really know kate 
> texteditor or somehow prefers Notepad++.

Why would you type rather than use copy and paste

> 
> The below code does work for one line in one th2 file when generated 
> alongside the rest of the cave. Whether this will generate correctly I 
> cannot be sure when I convert all line walls to l_u_wall.
> 
> 
> layout local
> code metapost
> def l_u_wall (expr P)=
> T:=identity;
> if path P:
> if known(ATTR_color):
> draw P withpen PenA withcolor scantokens(ATTR_color);
> else:
> draw P withpen PenA;
> fi;
> fi;
> enddef;

When I read your earlier mail I realised we hadn't put a alternative to 
the if, which it appears the above has tried to do badly. No idea why it 
has added an if path P: that seems a bit strange, I don't think it is 
needed, but I've not tested

Andrew


More information about the Therion mailing list