Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ class SurfaceEdgeRefinement(Flow360BaseModel):
retain_on_smoothing: bool = pd.Field(
True, description="Maintain the edge when smoothing is applied."
)
geometric_test_only: bool = pd.Field(
False, description="If enabled, only geometric tests are performed on the edge (region edge will be ignored)."
)

@pd.model_validator(mode="after")
def _check_spacing_format(self) -> Self:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def apply_SnappySurfaceEdgeRefinement(
edges["minLen"] = refinement.min_len.value.item()
if refinement.retain_on_smoothing is not None:
edges["retainOnSmoothing"] = refinement.retain_on_smoothing
edges["geometricTestOnly"] = "yes" if refinement.geometric_test_only else "no"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent boolean format for geometricTestOnly field

Medium Severity

geometricTestOnly is serialized as a string "yes"/"no", while every other boolean field in the same edges dictionary (e.g., retainOnSmoothing) and elsewhere in the snappy translator output (e.g., multiRegionFeatureSnap, strictRegionSnap) uses a native JSON boolean (true/false). This inconsistency likely means the downstream consumer will receive an unexpected type for this field, potentially causing it to be ignored or misinterpreted.

Fix in Cursor Fix in Web

if refinement.spacing is None:
edges["edgeSpacing"] = defaults.min_spacing.value.item()
elif isinstance(refinement.spacing, unyt_array) and isinstance(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"edgeSpacing": [[5, 4]],
"minElem": 3,
"includedAngle": 120,
"retainOnSmoothing": true
"retainOnSmoothing": true,
"geometricTestOnly": "no"
}
},
{
Expand All @@ -38,7 +39,8 @@
],
"minLen": 6,
"includedAngle": 150,
"retainOnSmoothing": false
"retainOnSmoothing": false,
"geometricTestOnly": "no"
}
}
]
Expand All @@ -54,7 +56,8 @@
"edgeSpacing": 4,
"minElem": 3,
"includedAngle": 120,
"retainOnSmoothing": true
"retainOnSmoothing": true,
"geometricTestOnly": "yes"
},
"regions": [
{
Expand All @@ -80,7 +83,8 @@
],
"minLen": 6,
"includedAngle": 150,
"retainOnSmoothing": false
"retainOnSmoothing": false,
"geometricTestOnly": "no"
}
},
{
Expand Down Expand Up @@ -122,7 +126,8 @@
],
"minLen": 6,
"includedAngle": 150,
"retainOnSmoothing": false
"retainOnSmoothing": false,
"geometricTestOnly": "no"
},
"regions": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"edgeSpacing": 4,
"minElem": 3,
"includedAngle": 120,
"retainOnSmoothing": true
"retainOnSmoothing": true,
"geometricTestOnly": "no"
},
"regions": []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"edgeSpacing": 4,
"minElem": 3,
"includedAngle": 120,
"retainOnSmoothing": false
"retainOnSmoothing": false,
"geometricTestOnly": "yes"
}
},
{
Expand All @@ -32,7 +33,8 @@
"edgeSpacing": 4,
"minElem": 3,
"includedAngle": 120,
"retainOnSmoothing": false
"retainOnSmoothing": false,
"geometricTestOnly": "yes"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ def snappy_basic_refinements():
min_elem=3,
included_angle=120 * u.deg,
entities=test_geometry.snappy_bodies["body1"],
geometric_test_only=True,
),
snappy.SurfaceEdgeRefinement(
spacing=[4 * u.mm],
Expand Down Expand Up @@ -796,6 +797,7 @@ def snappy_refinements_multiple_regions():
included_angle=120 * u.deg,
entities=[test_geometry["body0::patch0"], test_geometry["body0::patch1"]],
retain_on_smoothing=False,
geometric_test_only=True,
),
],
smooth_controls=snappy.SmoothControls(),
Expand Down
Loading