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++.

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;

 initsymbol("l_u_wall");
endcode
endlayout


Remember in th2 you need:
Type u:wall
Options: -clip off -attr color "(0, 0.5, 0)"
Or
-clip off -attr color green


Regards,
Alastair Gott.

[email protected],
M: 07931779380.

________________________________
From: Therion <[email protected]> on behalf of alastair gott 
<[email protected]>
Sent: 01 March 2026 16:14
To: Therion Mailing List <[email protected]>
Subject: Re: [Therion] Colored Lines Based On Attributes

HI Everyone,

I have tried again but now at full cave level it doesn't work, it does however 
work at small scales such as individual th2/thconfig. So the scaling up to full 
cave survey is causing the issue, probably as well as some of the code. Can 
anyone assist.

The below code for thconfig currently is:

layout local
code metapost
def l_u_wall (expr P)=
T:=identity;
        if known(ATTR_color):
            pickup PenA;
            draw P withpen PenA withcolor scantokens(ATTR_color);
      fi;   
enddef;

 initsymbol("l_u_wall");
endcode
endlayout
####

I have been pointed to chapter 27 of this link by the config window, I will 
need to do some looking into this. 
Tex.org.uk/systems/knuth/dist/mf/mfbook.tex<https://tex.org.uk/systems/knuth/dist/mf/mfbook.tex>

##error message##
>> ___________pickup
! Isolated expression.
<to be read again>
                   pencircle
PenA->pencircle
               .scaled(u/10)
l_u_wall->...wn(ATTR_color):___________pickup.PenA
                                                  ;____________draw(EXPR0)wi...
l.10992 ))
          ;
I couldn't find an `=' or `:=' after the
expression that is shown above this error message,
so I guess I'll just ignore it and carry on.

! Extra tokens will be flushed.
<to be read again>
                   pencircle
PenA->pencircle
               .scaled(u/10)
l_u_wall->...wn(ATTR_color):___________pickup.PenA
                                                  ;____________draw(EXPR0)wi...
l.10992 ))
          ;
I've just read as much of that statement as I could fathom,
so a semicolon should have been next. It's very puzzling...
but I'll try to get myself back together, by ignoring
everything up to the next `;'. Please insert a semicolon
now in front of anything that you don't want me to delete.
(See Chapter 27 of The METAFONTbook for an example.)

>> ____________draw
! Isolated expression.
<to be read again>
                   (path)
l_u_wall->...__pickup.PenA;____________draw(EXPR0)
                                                  withpen.PenA.withcolor.sca...
l.10992 ))
          ;
I couldn't find an `=' or `:=' after the
expression that is shown above this error message,
so I guess I'll just ignore it and carry on.

! Extra tokens will be flushed.
<to be read again>
                   (path)
l_u_wall->...__pickup.PenA;____________draw(EXPR0)
                                                  withpen.PenA.withcolor.sca...
l.10992 ))
          ;
I've just read as much of that statement as I could fathom,
so a semicolon should have been next. It's very puzzling...
but I'll try to get myself back together, by ignoring
everything up to the next `;'. Please insert a semicolon
now in front of anything that you don't want me to delete.
(See Chapter 27 of The METAFONTbook for an example.)

>> _____fi
! Isolated expression.
<to be read again>
                   ;
l.10992 ))
          ;
I couldn't find an `=' or `:=' after the
expression that is shown above this error message,
so I guess I'll just ignore it and carry on.

[31] [32] (./mptextmp.mp) [33] )
(end occurred when if on line 10992 was incomplete)



Regards,
Alastair Gott.

[email protected],
M: 07931779380.
________________________________
From: Therion <[email protected]> on behalf of alastair gott 
<[email protected]>
Sent: 01 March 2026 13:26
To: Therion Mailing List <[email protected]>
Subject: [Therion] Colored Lines Based On Attributes

HI Everyone,

Follow up on this thread from 17 years ago. 
https://mailman.speleo.sk/pipermail/therion/2009-September/002633.html

We have tweaked the code, with Andrews help. To make it work

In th2/Lines:
Type u:wall
Options: -clip off -attr color "(0, 0.5, 0)"
Or
-clip off -attr color green

In thconfig:
layout local
code metapost
def l_u_wall (expr P)=
T:=identity;
        if known(ATTR_color):
            pickup PenA;
            draw P withpen PenA withcolor scantokens(ATTR_color);
      fi;   
Enddef;

 initsymbol("l_u_wall");
endcode

endlayout

_______________________________________________
Therion mailing list
[email protected]
https://mailman.speleo.sk/listinfo/therion

Reply via email to