Support Forum

[Frage] Create polylines based on point coordinates imported from a .csv file


Hi Everyone,

I'm trying to creatd some polylines which will be used for create tendons based on points coordinates imported from a .csv file in Allplan Visual Scripting. Currently, to create a polyline I need to create a .csv file first in which the points coordinates used for the polyline are stored. The problem is that each time I can only generate one polyline. And I must create similar nodes again and again for every import. If the number of polylines to create is unknown, my current method will not work. It is also inefficient since a lot of sets of nodes would be created.

So I'm thinking to put all the points data in one .csv file. The data in different columns is used for creating different polylines. Then I made a little test first to see if Allplan Visual Scripting provides such a feature to create polylines based on points stored in different columns but in the same list. As shown in the below figure. I read the X, Y, Z coordinates from 2 .csv files, respectively. Then the data is sent to the Point3D node. The data from different .csv files are stored in a 2D list. However, if we use the points to create polyline, we can create only one polyline. The expected 2 polylines are connected end to end.

I wonder if there is a way to achieve what I want to do in Allplan Visual Scripting? Actually I also need to calculate each polyline's initial angle based on the coordinates of the first 2 points and last 2 points in a polyline and then create anchors...So it is also necessary to extract data freely from each column in a points list. It would be better if we can achieve it in Allplan Visual Scripting. The .pyp file and relative .csv files used for the test is enclosed, you can check it if necessary.

Best Regards
Mingjie Jia

Anhänge (3)

Typ: image/jpeg
139-mal heruntergeladen
Größe: 177,69 KiB
Typ: image/jpeg
75-mal heruntergeladen
Größe: 117,86 KiB
Typ: application/x-rar
876-mal heruntergeladen
Größe: 2,42 KiB

Hi Mingjie,

The Node "ReadPoints" may help you to achieve exactly what you want. It can read points coordinates from a csv file and create a list of points. VS also supports the operation on different level of nested lists to a certain extent. (Please check screenshot ReadPoints.png)

"ReadPoints" node contains 5 parameters:

  • FilePath
    File location of the source csv file. There is a small bug here, each time you start the script, you may have to select the source file again.
  • GroupName
    Column header of group id. All points with the same id will be added to the same nested list.
  • XColumnName
    Column header of x-coordinates
  • YColumnName
    Column header of y-coordinates
  • ZColumnName
    Column header of z-coordinates

An example of a valid csv file is also attached. (please check PointsList.csv)
All numbers from a csv file are currently interpreted as Millimeter. But it can be multiplied by a unit length (e.g. 1 inch) to get the correct unit.

Furthermore, there are some additional requirements for a valid csv file:

  • Use UTF-8 (Unidcode) as character encoding, if it has special characters

It seems somehow tricky right now. But I hope it helps.

Best regards
Xinling

Product Owner API, Allplan GmbH

Anhänge (2)

Typ: image/png
317-mal heruntergeladen
Größe: 269,46 KiB
Typ: text/plain
1132-mal heruntergeladen
Größe: 128,00 B

Hi XinLing,

Thanks for your reply. The nested list is new to me. I will try it.
Anyway, thank you.

Best Regards
Mingjie Jia