geometry: Profile: Copy/Paste using system clipboard.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-04-26 17:13:10 +02:00
1 parent 012f7ce445
commit e4c07e0e3e
8 files changed
+77 -21

No files matched your search

+23
View File
@@ -14,6 +14,29 @@ class PointXYZ(Point):
self._y = float(y)
self._z = float(z)
@classmethod
def from_data(cls, header, data):
point = None
try:
if len(header) == 0:
point = cls(
*data
)
else:
valid_header = {'name', 'x', 'y', 'z'}
d = {}
for i, v in enumerate(data):
h = header[i].strip().lower().split(' ')[0]
if h in valid_header:
d[h] = v
point = cls(**d)
except Exception as e:
raise ClipboardFormatError(header, data)
return point
def __repr__(self):
return f"({self._x}, {self._y}, {self._z}, {self._name})"
+1
View File
@@ -5,6 +5,7 @@ from typing import List
from tools import timer
from Model.Except import ClipboardFormatError
from Model.Geometry.Profile import Profile
from Model.Geometry.PointXYZ import PointXYZ
from Model.Geometry.Vector_1d import Vector1d