Replies: 2 comments 2 replies
-
Hi @Snowthe, Thanks for the question. I think I can give a workaround, but I'm also interested in how we could make this workflow easier. For the workaround: I don't believe deep copies are supported for cross sections in mikeio1d yet. However, you can make a deep copy of its underlying C# object, and then create a new CrossSection from that:
From here you could update the topo IDs and such via:
For a better workflow I wonder if you have any suggestions? Some thoughts I have are:
I partly wonder if copying cross sections and using Zmin/Zmax was an efficient way for GUIs. Now that we can use Python, I was thinking a better approach would be to allow cross sections to easily be built from the ground up. But curious to hear your thoughts on that general approach as well 😄 |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for the follow up. Based on your suggestion, I tried to execute the following code:
However, this fails with the error message AttributeError: 'CrossSection' object has no attribute 'm1d_cross_section' Else:
|
Beta Was this translation helpful? Give feedback.
-
I have an existing cross section file, to which I want to add some additional cross sections to.
I load the file via
I tried:
This, however, does not allow me to set other things such as zmin/zmax which we also use in our setups.
2. To create new cross sections as a copy of existing ones (as in my current application, I only need to modify the raw data of existing ones) via
This, however, updates also the old cross section (as deepcopy would be required?)
Am I overlooking something completely? Does any of you have a suggestion on how this could be implemented?
I even tried to add a "setter" for the topo_id property, to allow the following:
xs_new.topo_id = 'VP3L_wType'
(which so far, results in AttributeError: property 'topo_id' of 'CrossSection' object has no setter )
by adding
to cross_section.py. But that still doesn't solve the problem with copying...
Beta Was this translation helpful? Give feedback.
All reactions