Skip to content

Commit d4629dc

Browse files
authored
Skip physical groups with no entities in check_overlap (#71)
1 parent 5733341 commit d4629dc

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/solidmodels/postrender.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,9 +1003,13 @@ Return the overlapping groups as a vector of `(group1, group2, dimension)` `Tupl
10031003
function check_overlap(sm::SolidModel)
10041004
overlapping_groups = Tuple{String, String, Int}[]
10051005
for dim = 1:3
1006-
for (name1, _) in SolidModels.dimgroupdict(sm, dim)
1007-
for (name2, _) in SolidModels.dimgroupdict(sm, dim)
1006+
for (name1, pg1) in SolidModels.dimgroupdict(sm, dim)
1007+
for (name2, pg2) in SolidModels.dimgroupdict(sm, dim)
10081008
name1 >= name2 && continue
1009+
(
1010+
isempty(SolidModels.entitytags(pg1)) ||
1011+
isempty(SolidModels.entitytags(pg2))
1012+
) && continue
10091013
intersections = intersect_geom!(sm, name1, name2, dim, dim)
10101014
for intersection in intersections
10111015
if intersection[1] > dim - 1

test/test_solidmodel.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,20 @@ import DeviceLayout.SolidModels.STP_UNIT
10581058
render!(sm, cs)
10591059
@test isempty(SolidModels.check_overlap(sm))
10601060

1061+
cs = CoordinateSystem("test", nm)
1062+
place!(cs, r1, SemanticMeta(Symbol("r1")))
1063+
place!(cs, r2, SemanticMeta(Symbol("r2")))
1064+
postrender_ops = [(
1065+
"r2",
1066+
SolidModels.difference_geom!,
1067+
("r2", "r2", 2, 2),
1068+
:remove_object => true,
1069+
:remove_tool => true
1070+
)]
1071+
sm = test_sm()
1072+
render!(sm, cs; postrender_ops=postrender_ops)
1073+
@test isempty(SolidModels.check_overlap(sm))
1074+
10611075
# TODO: Composing OptionalStyle
10621076

10631077
# Explicitly MeshSized Path.

0 commit comments

Comments
 (0)