Hello @mslootweg
I hope you are well.
The Dynamo workflow I am trying to upload to VIKTOR depends on an input closed polyline/polygon to determine the site boundary. Is it possible to link VIKTOR’s polyline future as an input to Dynamo?
Thanks.
Hello @mslootweg
I hope you are well.
The Dynamo workflow I am trying to upload to VIKTOR depends on an input closed polyline/polygon to determine the site boundary. Is it possible to link VIKTOR’s polyline future as an input to Dynamo?
Thanks.
Hi Bayo, could you provide me with an example Dynamo graph of what you would like to achieve from the input? You only have to provide a graph with the input as example, to keep it simple.
Hello Marcel
Thanks for the response, and find the Dynamo file attached.
The group on top shows the ideal workflow. I essentially want the VIKTOR polyline to come into Dynamo as a polycurve.
The group below shows the intended result. A Dynamo surface is created from the polycurve. Please let me know if you have other questions.
Polycurve.dyn (31.5 KB)
Thanks Bayo,
Looking at your case, the easiest way I can see you can achieve this is by creating a string input node, and then sending the polygon from VIKTOR to Dynamo as a JSON string. The JSON string can then be converted with a node within Dynamo to a list of points, and the list of points can then be converted to a PolyCurve.
To summarise:
GeoPolygonField
input (which gives you a GeoPolygon
object) to a json string of list of coordinates. Here is a snippet:file_path = Path(__file__).parent / "dynamo_model_sample_app.dyn"
_file = File.from_path(file_path)
dyn_file = DynamoFile(_file)
# convert the geopolygon to a MapPolygon
polygon = MapPolygon.from_geo_polygon(params.geopolygon)
# extract the geojson using the MapResult, and the dump it to a json string
polygon_json_string = json.dumps(MapResult([polygon]).geojson['features'][0]['geometry']['coordinates'][0])
# update the input field of the input node "Polygon GeoJSON string"
dyn_file.update("Polygon GeoJSON string", polygon_json_string)
...
Hopefully, if someone within the VIKTOR community with Dynamo experience has better alternatives, they will add to this conversation.
Let me know if this will work for you. If it is not clear, or if you have more questions, also let me know.
Fantastic.
Thanks Marcel. The idea makes sense in principle.
I will let you know if I run into any snags.
This worked. Thanks, Marcel. I, however, had to do other operations with Geopandas and Shapely to convert the coordinates into meters.