Extract edge length and export information
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 871
✭✭✭✭
In SpaceClaim, how can I extract the length of an edge and export this information to an external file?
Tagged:
0
Answers
-
The following code can be adapted. The first edge of the first body in the tree is measured and the value is saved in a dictionary. This dictionary is then dumped to a json file.
import os import io import json filePath = os.path.join(r"D:\Test","demo_export.json") bodies = GetRootPart().GetAllBodies() my_body = bodies[0] my_edge = my_body.Edges[0] my_length = my_edge.Shape.Length my_dict = { "my edge length" : my_length } with io.open(filePath, "w", encoding="utf8") as json_file: json.dump(my_dict, json_file, ensure_ascii=False)
8