개정판 965b9c88
auto connection
Change-Id: I2848cb5dc7bd107661afd949dce1aff0ccac7408
DTI_PID/DTI_PID/LineDetector.py | ||
---|---|---|
559 | 559 |
|
560 | 560 |
def connectLineToLine(self, lhs, rhs, toler=20): |
561 | 561 |
try: |
562 |
if lhs is rhs: |
|
563 |
return |
|
564 |
|
|
562 | 565 |
res = lhs.connect_if_possible(rhs, toler) |
563 | 566 |
if not res: |
564 | 567 |
return |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
862 | 862 |
# connect line to line |
863 | 863 |
try: |
864 | 864 |
for line in lines: |
865 |
matches = [it for it in lines if (it is not line) and (not line.isParallel(it))] |
|
866 |
|
|
867 |
for match in matches:
|
|
865 |
#matches = [it for it in lines if (it is not line) and (not line.isParallel(it))]
|
|
866 |
#for match in matches: |
|
867 |
for match in lines:
|
|
868 | 868 |
detector.connectLineToLine(match, line, toler) |
869 | 869 |
except Exception as ex: |
870 | 870 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
455 | 455 |
try: |
456 | 456 |
#vectors = [(self.end_point()[0] - self.start_point()[0], self.end_point()[1] - self.start_point()[1]), |
457 | 457 |
# (rhs.end_point()[0] - rhs.start_point()[0], rhs.end_point()[1] - rhs.start_point()[1])] |
458 |
allowed_error = 0.01 |
|
458 | 459 |
angle = self.getAngle(rhs) |
459 |
if (angle == 0) or (angle == math.pi): return True |
|
460 |
if (abs(angle - 0) < allowed_error) or (abs(angle - math.pi) < allowed_error): |
|
461 |
return True |
|
460 | 462 |
except ZeroDivisionError: |
461 | 463 |
return True |
462 | 464 |
|
내보내기 Unified diff