mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
geometry: Profile: Copy/Paste using system clipboard.
This commit is contained in:
1 parent
012f7ce445
commit
e4c07e0e3e
8 files changed
+77
-21
No files matched your search
@@ -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})"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user