Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path length correction #4035

Merged
merged 37 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6f3b815
edb intersection bug fix
svandenb-dev Jun 29, 2023
c9c9183
Merge remote-tracking branch 'origin/main'
svandenb-dev Jun 29, 2023
2c93929
Merge remote-tracking branch 'origin/main'
svandenb-dev Jun 30, 2023
13681b3
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 11, 2023
44b29bd
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 14, 2023
fa118ee
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 14, 2023
4f5170d
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 17, 2023
c532310
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 19, 2023
0ed1957
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 24, 2023
9c1f90f
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 26, 2023
b17e28d
Merge remote-tracking branch 'origin/main'
svandenb-dev Jul 27, 2023
0775a9f
Merge remote-tracking branch 'origin/main'
svandenb-dev Aug 21, 2023
8efa6e0
Merge remote-tracking branch 'origin/main'
svandenb-dev Aug 24, 2023
c32599f
Merge remote-tracking branch 'origin/main'
svandenb-dev Aug 28, 2023
64b538b
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 6, 2023
a4735a4
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 15, 2023
7ebf925
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 18, 2023
5a2c70b
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 21, 2023
38be8d7
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 21, 2023
d3cb775
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 22, 2023
52870ae
Merge remote-tracking branch 'origin/main'
svandenb-dev Sep 25, 2023
befd2f0
Merge remote-tracking branch 'origin/main'
svandenb-dev Oct 2, 2023
c84e923
Merge remote-tracking branch 'origin/main'
svandenb-dev Oct 31, 2023
f89f32b
Merge remote-tracking branch 'origin/main'
svandenb-dev Nov 8, 2023
15c110e
Merge remote-tracking branch 'origin/main'
svandenb-dev Nov 9, 2023
7edbdf9
Merge remote-tracking branch 'origin/main'
svandenb-dev Nov 14, 2023
4cfe1b6
Merge remote-tracking branch 'origin/main'
svandenb-dev Nov 23, 2023
d999259
Merge remote-tracking branch 'origin/main'
svandenb-dev Dec 1, 2023
865e3f7
Merge remote-tracking branch 'origin/main'
svandenb-dev Dec 4, 2023
2bd2260
Merge remote-tracking branch 'origin/main'
svandenb-dev Dec 5, 2023
b9afbd7
Merge remote-tracking branch 'origin/main'
svandenb-dev Dec 6, 2023
b201fa9
Merge remote-tracking branch 'origin/main'
svandenb-dev Dec 6, 2023
0e618cf
Merge remote-tracking branch 'origin/main'
svandenb-dev Dec 14, 2023
eff4bbe
Merge remote-tracking branch 'origin/main'
svandenb-dev Dec 20, 2023
2a02001
Merge remote-tracking branch 'origin/main'
svandenb-dev Dec 22, 2023
ba50d7e
Merge remote-tracking branch 'origin/main'
svandenb-dev Jan 8, 2024
6051a59
path length bug correction
svandenb-dev Jan 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
32 changes: 32 additions & 0 deletions _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -3098,3 +3098,35 @@ def test_155_layout_auto_parametrization(self):
)
assert len(list(edbapp.variables.values())) == 2308
edbapp.close_edb()

def test_156_check_path_length(self):
source_path = os.path.join(local_path, "example_models", test_subfolder, "test_path_length.aedb")
target_path = os.path.join(self.local_scratch.path, "test_path_length", "test.aedb")
self.local_scratch.copyfolder(source_path, target_path)
edbapp = Edb(target_path, desktop_version)
net1 = [path for path in edbapp.modeler.paths if path.net_name == "loop1"]
net1_length = 0
for path in net1:
net1_length += path.length
assert net1_length == 0.01814480090225562
net2 = [path for path in edbapp.modeler.paths if path.net_name == "line1"]
net2_length = 0
for path in net2:
net2_length += path.length
assert net2_length == 0.007
net3 = [path for path in edbapp.modeler.paths if path.net_name == "lin2"]
net3_length = 0
for path in net3:
net3_length += path.length
assert net3_length == 0.04860555127546401
net4 = [path for path in edbapp.modeler.paths if path.net_name == "lin3"]
net4_length = 0
for path in net4:
net4_length += path.length
assert net4_length == 7.6e-3
net5 = [path for path in edbapp.modeler.paths if path.net_name == "lin4"]
net5_length = 0
for path in net5:
net5_length += path.length
assert net5_length == 0.026285623899038543
edbapp.close_edb()
17 changes: 11 additions & 6 deletions pyaedt/edb_core/edb_data/primitives_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,12 +725,17 @@ def length(self):
float
Path length in meters.
"""
center_line = self.get_center_line()
length = 0
for pt_ind in range(len(center_line)):
if pt_ind < len(center_line) - 1:
length += GeometryOperators.points_distance(center_line[pt_ind], center_line[pt_ind + 1])
return length

center_line_arcs = list(self.center_line.GetArcData())
path_length = 0.0
for arc in center_line_arcs:
path_length += arc.GetLength()
if self.end_cap_style[0]:
if not self.end_cap_style[1].value__ == 1:
path_length += self.width / 2
if not self.end_cap_style[2].value__ == 1:
path_length += self.width / 2
return path_length

@pyaedt_function_handler
def add_point(self, x, y, incremental=False):
Expand Down
Loading