Hello,
I am currently in the process of extracting a floor plan from an SVG file. So far, I have successfully obtained the element coordinates. However, I am unsure about the most effective approach to reconstruct a 3D model and assign the appropriate wall types.
In my initial attempt, I calculated the average point between two corner points and used the extracted coordinates to create a polycurve. However, I have noticed that with more complex floor plans, the calculated average points are not precise enough to generate an accurate 3D model as lines are getting not straight.
It is crucial for me to develop a universal script that does not require manual adjustment of the coordinates, as I intend to apply it to other SVG files as well.
If anyone has any suggestions or advice, I would greatly appreciate it!
Here the list:
[[193.19, 232.83], [732.94, 232.83], [756.94, 208.83], [169.1, 208.83]]
[[732.94, 232.83], [732.94, 955.71], [756.94, 979.71], [756.94, 208.83]]
[[732.94, 955.71], [81.79, 955.71], [57.79, 979.71], [756.94, 979.71]]
[[81.79, 955.71], [81.79, 645.21], [57.79, 621.21], [57.79, 979.71]]
[[81.79, 645.21], [194.79, 645.21], [170.7, 621.21], [57.79, 621.21]]
[[194.79, 645.21], [193.19, 232.83], [169.1, 208.83], [170.7, 621.21]]
[[237.16, 979.71], [237.16, 1105.4], [247.16, 1095.4], [247.16, 979.71]]
[[237.16, 1105.4], [419.1, 1105.4], [409.1, 1095.4], [247.16, 1095.4]]
[[419.1, 1105.4], [419.1, 979.71], [409.1, 979.71], [409.1, 1095.4]]
Python Code to create coords:
input_list = IN[0]
def extract_coordinates(input_list):
x_coordinates = []
y_coordinates = []
for sublist in input_list:
for coordinate in sublist:
x_coordinates.append(coordinate[0])
y_coordinates.append(coordinate[1])
return x_coordinates, y_coordinates
x_coords, y_coords = extract_coordinates(input_list)
OUT = x_coords #y_coords in another python block
Thank you.