[Therion] Colorizing sections of centerline

Tarquin Wilton-Jones tarquin.wilton-jones at ntlworld.com
Sun Nov 15 18:44:54 CET 2020


> is there a way to change the color of different sections of the centerline?

Sort-of.

https://therion.speleo.sk/wiki/metapost#centreline_that_is_only_visible_when_not_in_a_scrap

So what you need is a way to detect your different centrelines. If they
are fake centrelines ("line survey") in scraps, you can actually set
"-attr somename somevalue" and then look for the corresponding
ATTR_somename in your metapost. Like this:
https://therion.speleo.sk/wiki/metapost#p-hangers_that_face_the_right_way_and_other_anchor_designs

But automatically generated centrelines have fewer options, since there
are fewer variables to look for. I use this in one place to colour the
splays and centreline differently:

  code metapost
    def l_survey_cave (expr P) =
      T:=identity;
      pickup PenC;
      if ATTR__shotflag_splay:
        thdraw P withcolor (1,0.5,0.5);
      else:
        thdraw P;
      fi;
    enddef;
  endcode

You could look for ATTR__scrap instead, if scraps were involved...
Or current_scrap := "scrap at section";

I don't think it creates a variable like that for automatically
generated scraps so that you can identify the survey though.

Use the -d option to get the data.mp and look through the stuff at the
end to see if there is a useful variable you can look for.

I suspect that you won't find a useful variable.
But let's assume you created a single scrap in each survey, with nothing
in it, just a single survey station so it has a location. You create a
map that includes that scrap, and then includes the survey itself (to
render the centreline) - you may need to experiment to see which order
Therion will render them. Now when you render that survey, I suspect
that the current_scrap variable and ATTR__scrap variable will get
created. You can use metapost to look for it, and change the colour.

Not a complete idea, and definitely not as easy as you might have hoped,
but it should be possible to make it work.

Maybe someone else can get creative with this idea...

Tarquin


More information about the Therion mailing list