Extracting points along a line - Python - numpy

Along a known line, I am trying to extract a list of point at set distances from the end of the line. e.g. 30cm and 65cm from the end of the line.
I have been exploring ezdxf but haven't found a simple function to achieve this.
Diagram: Known points in blue, required positions marked in red

Related

Using plotArrays in Dymola to plot the data over different x-axis values

I need to draw a graph like this:
I have used plotArrays two times(1.to get curves on the left, 2.to get curves on the right) to get the curves on in two separate plot-windows.
plotArrays(x_neg,SOC_neg,legend=names,id=1);
plotArrays(x_pos,SOC_pos,legend=names,id=2);
The middle region is empty. If I use single plotArrays function combining these data, the ends will automatically connect with each other which I don't want to do.
How can I plot it in single command?
Thank you
Use multiple calls to the function plotArray with the same id and erase=false.

How to assign a label to go.layout.Shape(type="line"...)?

I produce the following figure.
The figure has a number of add_trace applied to it with go.Scatter as arguments.
A list of 4 go.layout.Shape, type="line", with fixed color attributes, is created and the figure layout is updated with that list: fig.update_layout(..., shapes=...)
The traces have labels assigned to them that we can see to the extreme right.
Is there a way to add labels to assign to the lines as well?
You would like your lines to appear in the legend of the figure (https://plot.ly/python/legend/). However, only traces can appear in the legend, not shapes which are a kind of annotation. What you could do is to create the lines using go.Scatter(..., mode='lines'), and then they would appear in the legend. You just need to give the starting and end points in go.Scatter (see https://plot.ly/python/line-and-scatter/).

CATIA Macro "Any geometry infinite"

I am trying to measure distance between a line and a point using below code.
ptref = Partdocument.Part.CreateReferenceFromObject(pt1) 'creating reference from point
refline = Partdocument.Part.CreateReferenceFromObject(line1) 'creating reference from line
Get measure
TheMeasurable = TheSPAWorkbench.GetMeasurable(refline)
dist1 = TheMeasurable.GetMinimumDistance(ptref)
since line and point are at different plane, I am not getting the required output.
I want to to measure using "Any geometry, infinite option".
Please suggest how I can incorporate that.
That is not supported using the SPAWorkbench/Measurable.
As a workaround, it is not difficult to get the end points of the line and perform the calculation using vector algebra.

CGAL: How to extract facet locations from .off file

I am currently using the Shape Diameter Function on CGAL to extract the diameter of an .off file. The function outputs a segment id for each facet in the mesh, and I would like to find the location of each facet in a 3d space so I can pair each facet with its corresponding segment-id. Is this possible?
Thanks,
Sharan
According to the documentation, the parameter SegmentPropertyMap is exactly what you need.
If you look at this example, it is done in the last 6 lines of code.

Plotting using multiple variables in gnuplot

I have a datafile with multiple columns, the first two indicating the position and the others indicating other properties (such as number of items sent from this point). eg:
1 1 1 57.11
2 1 2 62.40
3 4 1 31.92
What I want to do is plot the points at the positions, but use values from the other columns to vary point type and size (for example). However I can't seem to find a way to reference columns in the plot. I know of the use of "variable", but I cant find a way to use multiple variables.
What I want is something like the following:
plot "mydata" using 1:2 notitle with points pt ($3) ps ($4/10)
so that pt and ps use the value for each point taken from the third and fourth columns respectively.
Is this even possible in gnuplot? Is there some sort of work-around?
You should be able to use the keyword variable to do something like this:
plot 'datafile' using 1:2:3:4 w points ps variable lc variable
Or possibly mapping the value to a palette:
plot 'datafile' using 1:2:3:4 w points ps variable lc palette
The keyword variable and/or palette causes gnuplot to read the properties from the file and they both require an extra column to be read via using. Of course all the usual stuff with using applies -- You can apply transforms to the data, etc:
plot 'datafile' using 1:2:3:($4+32.) w points ps variable lc palette
I don't remember off the top of my head whether the 3rd column will be the pointsize or the color here, and I don't have time right now to play around with it to figure it out. You can do the experimenting and post a comment, or I'll come back to this when I have time and add an update.
Some of the other properties (e.g. pointtype) can't be changed quite to easily using variable. The easiest way to do this is to use filters with the gnuplot ternary operator.
First, write a function that returns a pointtype based on the data from 1 column of the datafile:
my_point_type(x) = x
Here I use a simple identity function, but it could be anything. Now, you can loop over the pointtypes you want (here 1-10) making a plot for each:
plot [for PT=1:10] 'datafile' u 1:((my_point_type($3) == PT) ? $2:NaN) with points pt PT
This assumes that the column with pointtype information is the 3rd column and that the second column holds the position information. This can also be combine with the stuff that I demonstrated above.