cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Drawing a vertical line in plot

YA_10963798
14-Alexandrite

Drawing a vertical line in plot

Hi there, 

I need to draw vertical lines along the alignment ( the red lines along the black line) a line each 50 m 

YA_10963798_1-1730625008114.png

How to draw it through this drawing

YA_10963798_2-1730625123609.png

Thanks in advance 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:Werner_E)

OK, here's the file.

I added grid lines so its easier to manually scale the plot for equal scale in x and y-direction.

The picture shows a grid of 500x500, markers every 200 along the length of the path and the markers lengths are 1000.

Werner_E_1-1730648053719.png

 

I adjusted the program to deliver more accurate results (the old version would increase the points until the distance exceeds a multiple of, lets say 200 in our example and so often the value was about 2,5 too large.
The way the adjustment was made is rather bold and crude and  is tailored to this specific set of data only.
Could be sure done better but I ran out of coffee 😉
The direction of the markers also could be done better, not only considering the previous point but also the next one to have a better approximation of the slope and its normal.
Additionally I could not be bothered to apply Lucs routines to place text in the plot.
I provided the link to his functions in a recent reply here, though, in case you are about to give it a try yourself.

 

Prime 9 file attached

View solution in original post

33 REPLIES 33
Werner_E
25-Diamond I
(To:YA_10963798)


@YA_10963798 wrote:

Hi there, 

I need to draw vertical lines along the alignment ( the red lines along the black line) a line each 50 m 

YA_10963798_1-1730625008114.png

 


'vertical' ??

In the sense of parallel to the ordinate axis ("y"-axis)? Similar to grid lines?

Your sketch does not look that way, though!?

And why are the smaller values to the right?

You would have to specify at which abscissa value the first line should be.
Your vector A^<1> is running from 115515.997 to 122069.455. If the units A^<1> are meant to be meter this means about 131 vertical lines.

You could use the vertical markers which Prime offers (I don't know if their number is limited) but you would have to manually set up each one separately. Or you could write a small program to create a data structure which shows as a couple of vertical lines.
You could use one of the grid functions which are posted here from time to time. You would not only have to provide the limits of the x limits for these functions but also the y limits the lines should run from and to.

 

Or does 'vertical' mean perpendicular to the graphed black line? Again your sketch does not look that way - at least not at the left side.

 

Are the 50m 100m etc x-axis values (values of A1^<1>) or something else? If the latter, you would have to state which meter value would correspond to which value in A^<1>.

At the top of the sheet you say "intervals" should be 50, so that may be the number of lines you want to draw.

But in your question you write you want "a line each 50 meter".

Where does

Werner_E_3-1730635757821.png

stem from? Because I also can calculate a different value

Werner_E_1-1730634716206.png

At least that's what I get when I use the Excel data file which you posted in earlier threads.

 

So there are a lot of questions open - at least for me.

As an example here is a plot with 51 vertical lines, making up 50 intervals of 131,069 length.

Absolutely not sure if this is it what you are looking for.

Werner_E_2-1730635681371.png

 

YA_10963798
14-Alexandrite
(To:Werner_E)

Hi Werner, 

Yes, I shoudn't use the word vertical ...the lines should be lying on the alignment line ...and the number of the lines can be calculated by dividing the alignment length (7548m) by 50 m so there will be 151 line should be drawn. and Is it possible for the plot to write down the distance like in the first one 0+00 in the second 50 m , third 100 like my paint 

YA_10963798_0-1730637520807.png

Are they x or y points I think they are both right >> because we are taking A as reference to draw them 

Werner_E
25-Diamond I
(To:YA_10963798)


@YA_10963798 wrote:

Hi Werner, 

Yes, I shoudn't use the word vertical ...the lines should be lying on the alignment line ...and the number of the lines can be calculated by dividing the alignment length (7548m) by 50 m so there will be 151 line should be drawn. and Is it possible for the plot to write down the distance like in the first one 0+00 in the second 50 m , third 100 like my paint 

YA_10963798_0-1730637520807.png

Are they x or y points I think they are both right >> because we are taking A as reference to draw them 


Sorry, still unclear to me 😞

Whats an "alignment line" where the lines should be "lying on"?

I still won't know which direction the lines to be drawn should have. Should they be even straight lines? Doesn't look so from your sketch.

And again my question where the value 7548m would stem from??

 

Or are we talking about something like contour lines / layer lines (not sure about the correct English word for it) as can be seen on a hiking map?? Then my question would be where we should get the information about points of equal height.

 

Concerning your question about writing the numbers in the plot. Prime provides no means for doing so. But @LucMeekes  had once posted a utility function which enabled us to use text in plots by creating the necessary data structure for a plot. Quite elaborate.

@ttokoro  seemed to like that function and now and then he reposted Luc's work.

EDIT: Just happened to find Luc's thread: Solved: Toolbox: Text plotting - PTC Community

Werner_E
25-Diamond I
(To:Werner_E)

Ah!, I was able at least to answer one of my questions myself

Werner_E_0-1730639014769.png

So we are talking about the straightened length of that street or river or whatever it may be, right?

 

And probably you 'just' want a small marker every 50 meter along the way.

Drawing that marker perpendicular to the 'street' would mean some effort, may be perpendicular to the last line segment would suffice? What should be the length of this marker?

And a most important question: Where should the first marker for 0 meter should be placed? Given from your sketches so far it looks like you want it to be somewhere at the right of the plot. Maybe at the last value in A??

EDIT: Just noted that the values in A are in reverse order anyway, so the first entry in A is the rightmost point.

 

YA_10963798
14-Alexandrite
(To:Werner_E)

yes exactly it should be straightend line ... 

Yes small marker will be enough ... its length can be 45 m .... I don't know how that will look like ...but if it doesn't look good a small line will be okay 

YA_10963798_0-1730639713901.png

I think it will be better if we start from the left although I draw it the opposite ..It should start from A 1 

thanks in advance

 

StuartBruff
23-Emerald III
(To:YA_10963798)

I'm still not quite sure I know what a "vertical" line is.  I clearly need a cup of tea to refresh my thinking head.

 

However, is this kind of thing nearer the mark?

 

2024 11 03 C.png

 

BTW, Werner, I was going by Yusra's statement at the top of her worksheet about the intervals being 50 m, so that's why I chose the interval length as opposed to the number of intervals,

 

Stuart

YA_10963798
14-Alexandrite
(To:StuartBruff)

Nice this looks really good >> I will try it right away 

StuartBruff
23-Emerald III
(To:StuartBruff)

Corrected the end point - think ...

 

2024 11 03 D.png

 

Stuart

YA_10963798
14-Alexandrite
(To:StuartBruff)

Did you define nmarkers ? or it is just what you wrote inside the metreage function.. ?

and what does yscl=20% mean ?

 

YA_10963798_0-1730644238093.png

 

StuartBruff
23-Emerald III
(To:YA_10963798)


@YA_10963798 wrote:

Did you define nmarkers ? or it is just what you wrote inside the metreage function.. ?

and what does yscl=20% mean ?

 

YA_10963798_0-1730644238093.png

 


 

Yes, I prior defined nmarkers - see https://community.ptc.com/t5/Mathcad/Drawing-a-vertical-line-in-plot/m-p/981468/highlight/true#M214781

 

However, you don't need it.  Just type in 50 m, 100 m, 200 m, whatever takes your fancy for intervals.

 

yscl<-20 % means a vertical line scaling of 20 % (of ylen).  You could equally well have put 0.2

 

Stuart

Werner_E
25-Diamond I
(To:StuartBruff)

@StuartBruff 

Does your solution consider the straightened length of the curve or rather the distance in x-direction when in comes to the distance of the markers?

YA_10963798
14-Alexandrite
(To:StuartBruff)

I redefined it ... it works .. 

Thank you so much for the reply ....as always a professional reply ....

Werner_E
25-Diamond I
(To:Werner_E)

Here is an intermediate result - a red point every 50 (meter).

That's a lot of points, I guess and will make for a rather unclear display if line segments and numbers are applied as well.

Werner_E_1-1730640538107.png

 

YA_10963798
14-Alexandrite
(To:Werner_E)

I see .. it will look like we are drawing the lines in each point of A... In this case no problem we can go with 200 instead of 50.. 

 

 

Werner_E
25-Diamond I
(To:YA_10963798)


@YA_10963798 wrote:

I see .. it will look like we are drawing the lines in each point of A...

 


Correct. Here the line lengthchosen is 400 (45 would be too small, I think)

Werner_E_0-1730642560926.png

 

Looks better with a marker every 200 (meter) with a length of 1000 (meter):

Werner_E_1-1730643155991.png

 

File still under construction 😉

Werner_E
25-Diamond I
(To:Werner_E)

OK, here's the file.

I added grid lines so its easier to manually scale the plot for equal scale in x and y-direction.

The picture shows a grid of 500x500, markers every 200 along the length of the path and the markers lengths are 1000.

Werner_E_1-1730648053719.png

 

I adjusted the program to deliver more accurate results (the old version would increase the points until the distance exceeds a multiple of, lets say 200 in our example and so often the value was about 2,5 too large.
The way the adjustment was made is rather bold and crude and  is tailored to this specific set of data only.
Could be sure done better but I ran out of coffee 😉
The direction of the markers also could be done better, not only considering the previous point but also the next one to have a better approximation of the slope and its normal.
Additionally I could not be bothered to apply Lucs routines to place text in the plot.
I provided the link to his functions in a recent reply here, though, in case you are about to give it a try yourself.

 

Prime 9 file attached

YA_10963798
14-Alexandrite
(To:Werner_E)

That is really brilliant thank you so much . 

Werner_E
25-Diamond I
(To:YA_10963798)

Had some (much!) coffee, added text:

Werner_E_0-1730659042057.png

Functions used by courtesy of Luc who was genorous enough to share them with us.

You can set the font size, italic, bold and also decide how many labels you want to see.

You could decide to show every label, but you would have to use a quite tiny font size. So I settled for showing just every second value.

Of course you can play around, make the marker shorter (600), draw a marker ever 100 meter but only show the label of every fifth of them:

Werner_E_1-1730659685841.png

 

Prime 9 file attached

StuartBruff
23-Emerald III
(To:Werner_E)

I thought I might try my hand at the number plotting, but I've just popped in to have a look at the state of play, and you've saved me the effort!  😁

 

However, if things get a little cramped width-wise, then it might be nice to rotate the text as well.

 

2024 11 03 F.png

 

2024 11 03 E.png

 

Where ...

 

2024 11 03 G.png

 

I created SIValueOf and repeat before realizing that I didn't need them, but waste not, want not.

 

Stuart

Werner_E
25-Diamond I
(To:StuartBruff)

I have to admit that when it comes to Mathcad or Prime, I am easily put off by large amounts of images alone. Being lazy by nature, the idea of having to type is also extremely daunting. 😉 😈

But I am sure that these are quite nice and useful functions even though I am not sure if they conform to Luc's concept, where you could exchange the very same data type between the various modifiers like Bold(Italic(...)).

Not sure if we could use your Rot the same way like Bold(Rot(Italic(...))).

I guess it would be beneficial to add an angle of rotation (or a direction  vector, again a 2x1 vector) as additional function argument to the function Monospaced(...) and its proportional pendent. Maybe also an alignment argument, a 2x1 vector for horizontal and vertical alignment (left, center, right).

 

 

StuartBruff
23-Emerald III
(To:Werner_E)


@Werner_E wrote:

I have to admit that when it comes to Mathcad or Prime, I am easily put off by large amounts of images alone. Being lazy by nature, the idea of having to type is also extremely daunting. 😉 😈


Your UN Certificate of Contribution to Decreasing Global Warming is winging its way to you ...   😊

 


@Werner_E wrote:

But I am sure that these are quite nice and useful functions even though I am not sure if they conform to Luc's concept, where you could exchange the very same data type between the various modifiers like Bold(Italic(...)).

Not sure if we could use your Rot the same way like Bold(Rot(Italic(...))).

I guess it would be beneficial to add an angle of rotation (or a direction  vector, again a 2x1 vector) as additional function argument to the function Monospaced(...) and its proportional pendent. Maybe also an alignment argument, a 2x1 vector for horizontal and vertical alignment (left, center, right).


To be honest, and with due apologies to Luc, I didn't do much more than glance at the simple examples of Monospaced and Proportional.  Indeed, having now looked at the thread semi-properly, I still don't recall having seen it, let alone commenting on it. 

 

Not only that, I hadn't even begun to address the problem of plotting the meterages before I realised that 150+ lines would make it a tad difficult to see the numbers.  A quick glance at the format of the "strings" showed that it was amenable to a bit of rotation matrixing, cobbled together Rot, and that's as far as I took it. 

 

Stuart

StuartBruff
23-Emerald III
(To:StuartBruff)

I've just had another look at Luc's worksheet (the ORIGIN-independent one).  It might be as you say, just hide the rotation in there somewhere, perhaps even express the functions as matrix multiplications for translation and scaling as well.

 

I moved the scalar s and p handler to Proportional and Monospaced.

 

2024 11 03 H.png

 

2024 11 03 I.png

 

2024 11 03 J.png

 

Stuart 

YA_10963798
14-Alexandrite
(To:Werner_E)

Hi Werner

Can you tell me what do these mean? and are they written manually ? if so how to decide the numbers

YA_10963798_0-1730702850940.png

 

StuartBruff
23-Emerald III
(To:YA_10963798)


@YA_10963798 wrote:

Hi Werner

Can you tell me what do these mean? and are they written manually ? if so how to decide the numbers

YA_10963798_0-1730702850940.png


 

They're the coordinates for the points to link to draw each character.  And, yes, AFAIA, Luc typed them in individually.  Here's one example:

 

2024 11 04 B.png

 

I'm glad it's not just lazy people like me running the show!  😱

 

Stuart

Werner_E
25-Diamond I
(To:YA_10963798)


@YA_10963798 wrote:

Hi Werner

Can you tell me what do these mean? and are they written manually ? if so how to decide the numbers

 


As Stuart already explained what you show are the coordinates of the characters which Luc seemed to have typed in by hand back then.

left column are x-coordinates, right column y-coordinates.

points separated by NaN's are not connected.

The characters in ASCII.1 are exactly the ones shown in the string above, starting with the space, followed by the exclamation mark, etc.

Werner_E_0-1730746618175.png

Her for example the hashtag:

Werner_E_1-1730746678071.png

 

YA_10963798
14-Alexandrite
(To:Werner_E)

Hi Werner, Stuart 

 

I tried to change the same program to draw lines using the meterage input like below: 

YA_10963798_0-1730975441773.pngYA_10963798_1-1730975461803.png

how can I solve that ? 

and what does this mean?

YA_10963798_2-1730975560520.png

 

Regards, 

Yusra

ttokoro
20-Turquoise
(To:YA_10963798)

ttokoro_0-1730976802698.png

Meterage=200    No units.

image.png

YA_10963798
14-Alexandrite
(To:ttokoro)

YA_10963798_0-1730977029264.png

meterage is not 200 // it is an array

 

StuartBruff
23-Emerald III
(To:YA_10963798)


@YA_10963798 wrote:

Hi Werner, Stuart 

and what does this mean?

YA_10963798_2-1730975560520.png


 

Hi, Yusra.

 

The function normal returns a vector giving the two endpoints of the metreage line.

 

v first gets the difference between two points, which is a measure of the slope (gradient) of their connecting line.

 

v/|vT| normalizes the gradient to 1.

 

⌈0 -1⌉

⌊1  0⌋   is a rotation matrix and converts the gradient line into the normal (perpendicular) vector.   HL is merely a scaling factor.

 

https://en.wikipedia.org/wiki/Rotation_matrix

 

Stuart

Announcements

Top Tags