Re: [Therion] Export EE as .3D and ignore "survey does not exist"

2020-03-04 Thread Olly Betts
On Sun, Mar 01, 2020 at 09:34:32PM +, Tarquin Wilton-Jones via Therion 
wrote:
> > 1) Is it possible to export an extended elevation as a 3D file (like
> > survex does)? For the purpose of 'debugging' the extends etc.
> 
> I doubt this is entirely possible. There are some kinds of extend
> options that Therion supports but Survex does not, such as "extend
> vertical". So I don't think you could turn it into a Survex-style 3D if
> you use those options.

An "extended elevation" .3d file is really just a normal .3d file with
a flag set (as of v8 of the .3d format there's an explicit flag, while
for older versions it's done by checking for a title ending
" (extended)").  If this flag is present, aven limits the view to be an
elevation looking North or South.

The Survex extend program folds the centreline to lie in an East-West
vertical plane through the origin, with splays rotated along with the
centre-line they're adjacent to but allowed to stick out of this plane.

There's no explicit representation of the extend operations which were
applied, only of the results, so "extend vertical" shouldn't be a
problem.  I can't think of an extend-like feature which couldn't be
easily fitted into this "2D+" representation.

Cheers,
Olly
___
Therion mailing list
Therion@speleo.sk
https://mailman.speleo.sk/listinfo/therion


Re: [Therion] Need metapost wizard: new text label

2020-03-04 Thread Benedikt Hallinger

Hello again.
I freshly copy-pasted your examples and now it works.
I must have made something wrong like you described (therion 5.4.4 
(2019-05-01)).


Tanks!


Am 2020-03-04 15:08, schrieb Tarquin Wilton-Jones via Therion:

example code there does not work here for some reason (compile error).


Interesting ... I am using it myself and it works here. I wonder if
there is something odd in what the wiki outputs. Or maybe you copy &
pasted the "code metapost" inside an existing "code metapost" block. If
you have time to check, what's your error message?

Or alternatively, do you have a minimal survey where I can see the
failure myself?


0.001


I won't pretend to understand what that is all about. Very weird 
indeed.

___
Therion mailing list
Therion@speleo.sk
https://mailman.speleo.sk/listinfo/therion

___
Therion mailing list
Therion@speleo.sk
https://mailman.speleo.sk/listinfo/therion


Re: [Therion] Need metapost wizard: new text label

2020-03-04 Thread Tarquin Wilton-Jones via Therion
> example code there does not work here for some reason (compile error).

Interesting ... I am using it myself and it works here. I wonder if
there is something odd in what the wiki outputs. Or maybe you copy &
pasted the "code metapost" inside an existing "code metapost" block. If
you have time to check, what's your error message?

Or alternatively, do you have a minimal survey where I can see the
failure myself?

> 0.001

I won't pretend to understand what that is all about. Very weird indeed.
___
Therion mailing list
Therion@speleo.sk
https://mailman.speleo.sk/listinfo/therion


Re: [Therion] Need metapost wizard: new text label

2020-03-04 Thread Benedikt Hallinger

Hello Tarquin,

i tweaked and fiddled around and now have a version that correctly 
scales, rotates and aligns.
Your wiki page hint helped, but i already found it in the past... The 
example code there does not work here for some reason (compile error).


But anyhow, to answer your question regarding the "0.001" rotation 
parameter in the label calling:
if i use "0.0" or "0" or also "0.0001", it puts my label text in the 
center of the generated map with rotation of the scrap-rotation applied. 
I don't know why and found by try-and-error that this value works.



Here is the updated code:, enhanced with a nicer legend output:
---
# Symbol to denote assigned survey.
#   Option "-attr text " shows given text; otherwise current 
survey is shown.
#   Option "-attr bordersmooth " overrides edge smoothness (0 
for sharp edges)

#   Option "-attr bordermargin " overrides margin text/border
#   Option "-attr basescale " overrides basic text sizing 
factor (default text size)

def p_u_mappe(expr pos, theta, sc, al) =
  T:=identity aligned al rotated theta scaled sc shifted pos;
  begingroup;
% Basic config
bordersmooth:=4; % smoothness of box corners  (0=90° 
edges)

bordermargin:=5.0bp; % padding border->text
basescale:=1.0;  % basic scaling of default-sized text
if known(ATTR_bordersmooth): 
bordersmooth:=scantokens(ATTR_bordersmooth); fi;
if known(ATTR_bordermargin): 
bordermargin:=scantokens(ATTR_bordermargin); fi;
if known(ATTR_basescale):
basescale:=scantokens(ATTR_basescale);   fi;


% GET LABEL TEXT:
string txt;
if known(ATTR_text):
txt := ATTR_text;
else:
txt := ATTR__survey;
fi;

% DRAW LABEL:
lab:=thelabel(txt, (0.0,0.0));
pickup PenA;   % border thickness
interim bboxmargin:=bordermargin;  % padding border->text
q:=((bbox lab) smoothed bordersmooth) aligned al scaled (sc * 
basescale) rotated theta shifted pos;

draw q;
lab:=lab aligned al;
lab:=lab scaled (sc * basescale);
lab:=lab rotated theta;
lab:=lab shifted pos;
process_label(pos, 0.001);   % for some weird reason "0.0" does 
not work here and puts the label to map-center at scrap-rotation.


  endgroup;
enddef;
def p_u_mappe_legend =
begingroup;
save ATTR_text;
string ATTR_text;
ATTR_text:="028";
p_u_mappe((.5,.5) inscale, 0, 1.0, (0,0));
endgroup;
enddef;

---





Am 2020-03-01 22:23, schrieb Tarquin Wilton-Jones via Therion:

thelabel(txt, pos);


I notice in the main Therion Metapost, it uses
lab:=thelabel@#(txt, pos);
to make sure that it can respect alignment, which your code cannot.
Don't suppose you worked out how to pass the correct alignment value 
to

it, did you?


I have worked it out, see my thread "Metapost variable macro suffixes".
I will add it to my existing function which takes the point alignment
parameter and turns it into the right suffix in the "thelabel" call or
p_label call, whichever one ends up getting used.

Your code also didn't apply rotation to the ornamentation. You need
something like this:
draw ((bbox lab) smoothed 4) rotatedaround (pos,rotation);

Note that this applies the rotation around the point position, so
alignment and rotation at the same time is weird. This is the same with
regular labels though - Therion bug that Bruce is fond of :) - so at
least this is consistent with Therion itself.

Your code hardcoded rotation to a very specific 0.001 degrees, which 
was

weird. I assume you had intended to use 0 or a variable (my code uses
the rotation parameter of the point symbol).


interim bboxmargin:=6.5bp;    % padding border->text


Just checking, since I don't know the "interim" keyword very well ...
Doesn't it need to be inside a "begingroup/endgroup" pair, in order to
know when to stop applying the "interim" value to the internal
bboxmargin variable?

As far as I can tell, you are modifying the global value of it, so all
subsequent uses of that internal variable will end up with your 
padding.
At least until the next "endgroup" happens somewhere above your code 
in

the stack.


This was correct. You needed to use begingroup+endgroup or use a vardef
instead of a def (with vardef, it automatically applies a
begingroup+endgroup). Therion's Metapost uses both of these approaches
to avoid the problem.
___
Therion mailing list
Therion@speleo.sk
https://mailman.speleo.sk/listinfo/therion

___
Therion mailing list
Therion@speleo.sk
https://mailman.speleo.sk/listinfo/therion