[Therion] Colorizing sections of centerline

Tarquin Wilton-Jones tarquin.wilton-jones at ntlworld.com
Sun Nov 15 19:02:57 CET 2020


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

Just to point out that this works.

survey whatever
	scrap emptyscrap
		point 0 0 station -name 1 at somesurvey
	endscrap
	map emptymap -projection plan
		emptyscrap
	endmap
	map outermap -projection plan
		emptymap
		somesurvey
	endmap
	survey somesurvey
		centreline
... data goes here ...

Render the "outermap". Now the MetaPost output contains this:
current_scrap := "emptyscrap at whatever";
ATTR__scrap := "emptyscrap";
And then a whole load of centreline stuff.

  code metapost
    def l_survey_cave (expr P) =
      T:=identity;
      pickup PenC;
      if known current_scrap:
        if current_scrap = "emptyscrap at whatever":
          thdraw P withcolor (1,0.5,0.5);
        else:
          thdraw P;
        fi;
      else:
        thdraw P;
      fi;
    enddef;
  endcode

You would need to add maps like that to each major survey section that
you want to colour, as well as the first section that you do not want to
colour, because it will keep applying that colour until it encounters
another scrap.

Not how you want to leave it when you are done, but useful for
debugging, perhaps.


More information about the Therion mailing list