Skip to content

Commit d914875

Browse files
committed
Update FM-layers logic to better catch "FM-Grid".
1 parent b9bc777 commit d914875

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changes
22

3+
## Version 1.0.2
4+
5+
_2025-12-16_
6+
7+
- Update FM-layers logic to better catch "FM-Grid"
8+
39
## Version 1.0.1
410

511
_2025-12-15_

mpldxf/backend_dxf.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,11 @@ def _determine_element_layer(self):
169169
if current_element == "patch":
170170
return "PENDING"
171171

172-
# Line2D elements - distinguish data vs frame
172+
# Line2D elements - data
173173
elif current_element == "line2d":
174174
if any(keyword in context_str for keyword in ["tick", "matplotlib.axis"]):
175-
return "FM-Frame"
176-
elif "axes" in context_str:
177-
return "FM-Graph"
178-
else:
179-
return "FM-Graph"
175+
return "FM-Grid"
176+
return "FM-Graph"
180177

181178
# Collections - check what type
182179
# Collections - check what type
@@ -193,7 +190,7 @@ def _determine_element_layer(self):
193190

194191
# Specific frame elements
195192
elif any(keyword in context_str for keyword in ["tick", "matplotlib.axis"]):
196-
return "FM-Frame"
193+
return "FM-Grid"
197194

198195
return "0"
199196

@@ -253,7 +250,7 @@ def _analyze_patch_size(self, vertices, gc):
253250
"""Simple shape-based classification of patches"""
254251

255252
if vertices is None or len(vertices) == 0:
256-
return "FM-Frame"
253+
return "FM-Grid"
257254

258255
verts = np.array(vertices)
259256
min_x, min_y = np.min(verts, axis=0)
@@ -268,7 +265,7 @@ def _analyze_patch_size(self, vertices, gc):
268265
return "FM-Graph"
269266

270267
if height == 0 or width == 0:
271-
return "FM-Frame"
268+
return "FM-Grid"
272269

273270
aspect_ratio = max(width, height) / min(width, height)
274271
context_str = " ".join(self._groupd).lower() if self._groupd else ""
@@ -278,8 +275,8 @@ def _analyze_patch_size(self, vertices, gc):
278275
if in_axes and aspect_ratio < 1000:
279276
return "FM-Graph"
280277

281-
# Default small patches -> Frame elements
282-
return "FM-Frame"
278+
# Default small patches -> Grid elements
279+
return "FM-Grid"
283280

284281
def _get_polyline_attribs(self, gc):
285282
"""Get polyline attributes with correct layer and color"""

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "mpldxf"
3-
version = "1.0.1"
3+
version = "1.0.2"
44
description = "A fork of mpldxf - a matplotlib backend to write DXF drawings. Modified by NGI to handle geotechnical plots"
55
authors = ["David Kent",
66
"Jon-Michael Josefsen <[email protected]>",

0 commit comments

Comments
 (0)