Fixed interactor
Added proj lines selected
This commit is contained in:
@@ -5,7 +5,7 @@ from copy import copy
|
||||
import numpy as np
|
||||
from PySide6.QtWidgets import QApplication, QWidget, QMessageBox, QInputDialog
|
||||
from PySide6.QtGui import QPainter, QPen, QColor, QTransform
|
||||
from PySide6.QtCore import Qt, QPoint, QPointF, Signal
|
||||
from PySide6.QtCore import Qt, QPoint, QPointF, Signal, QLine
|
||||
from python_solvespace import SolverSystem, ResultFlag
|
||||
|
||||
|
||||
@@ -51,13 +51,11 @@ class SketchWidget(QWidget):
|
||||
def create_workplane_projected(self):
|
||||
self.wp = self.solv.create_2d_base()
|
||||
|
||||
def create_proj_lines(self, lines):
|
||||
def create_proj_points(self, proj_points):
|
||||
"""Lines as orientation projected from the sketch"""
|
||||
|
||||
for point in lines:
|
||||
for point in proj_points:
|
||||
x, y = point
|
||||
self.proj_snap_lines = lines
|
||||
# Invert X from projection might be happening in the projection for some reason Careful
|
||||
coord = QPoint(x, y)
|
||||
self.proj_snap_points.append(coord)
|
||||
|
||||
@@ -69,6 +67,24 @@ class SketchWidget(QWidget):
|
||||
|
||||
self.slv_points_main.append(relation_point)"""
|
||||
|
||||
def create_proj_lines(self, sel_edges):
|
||||
"""Lines as orientation projected from the sketch"""
|
||||
print("Incoming corrd lines", sel_edges)
|
||||
for line in sel_edges:
|
||||
|
||||
start = QPoint(line[0][0], line[0][1] )
|
||||
end = QPoint(line[1][0], line[1][1])
|
||||
coord = QLine(start, end)
|
||||
self.proj_snap_lines.append(coord)
|
||||
|
||||
"""relation_point = {} # Reinitialize the dictionary
|
||||
#handle_nr = self.get_handle_nr(str(point))
|
||||
#relation_point['handle_nr'] = handle_nr
|
||||
#relation_point['solv_handle'] = point
|
||||
relation_point['ui_point'] = QPoint(x, y)
|
||||
|
||||
self.slv_points_main.append(relation_point)"""
|
||||
|
||||
def find_duplicate_points_2d(self, edges):
|
||||
points = []
|
||||
seen = set()
|
||||
@@ -675,11 +691,11 @@ class SketchWidget(QWidget):
|
||||
return QPoint(int(widget_x), int(widget_y))
|
||||
|
||||
def from_quadrant_coords_no_center(self, point):
|
||||
"""Translate quadrant coordinates to linear coordinates."""
|
||||
"""Invert Y Coordinate for mesh"""
|
||||
center_x = 0
|
||||
center_y = 0
|
||||
widget_x = center_x + point.x() * self.zoom
|
||||
widget_y = center_y - point.y() * self.zoom # Note the subtraction here
|
||||
widget_x = point.x()
|
||||
widget_y = -point.y()
|
||||
return QPoint(int(widget_x), int(widget_y))
|
||||
|
||||
def paintEvent(self, event):
|
||||
@@ -746,6 +762,11 @@ class SketchWidget(QWidget):
|
||||
for cross in self.proj_snap_points:
|
||||
self.draw_cross(painter, cross, 10 / self.zoom)
|
||||
|
||||
for selected in self.proj_snap_lines:
|
||||
pen = QPen(Qt.white, 1, Qt.DashLine)
|
||||
painter.setPen(pen)
|
||||
painter.drawLine(selected)
|
||||
|
||||
painter.end()
|
||||
|
||||
def wheelEvent(self, event):
|
||||
|
||||
Reference in New Issue
Block a user