Closed Zannick closed 5 days ago
Correct method as below, seems to work:
@staticmethod
def add_mx_geo_with_points(element, curve):
geo = ET.SubElement(element, MxConst.GEO, {"as": "geometry"}, relative="1")
# cbset
if len(curve.cbset) > 0:
array = ET.SubElement(geo, MxConst.ARRAY, {"as": "points"})
for cb in curve.cbset:
ET.SubElement(array, MxConst.POINT, x=str(cb[0][0]), y=str(cb[0][1]))
if cb:
ET.SubElement(array, MxConst.POINT, x=str(cb[1][0]), y=str(cb[1][1]))
Can confirm, just encountered this bug and the fix works, thanks!
This is fixed in the upcoming 0.3 release. Feel free to reopen or create a new issue if that release does not work as you expect. Thanks for the report!
https://github.com/hbmartin/graphviz2drawio/blob/751993505ef02db43ad116e7d4cd38a20608945a/graphviz2drawio/mx/MxGraph.py#L115-L118
Line 117 here throws an exception when
curve.cbset
is empty, thus leavingcb
unset.