i would like to store the override Graphic setting of a selected element to a file so that I can call the file and apply the same graphics to a element in another project.
Is there way to save the instance of the object(override settings) to file and read again?
I just don’t want to open the previous project every time to copy the settings.
Kind of looking for a way to have a universal graphics for elements in all projects that have some common properties.
Actual case scenario: I am developing a RFI system where elements associated with a RFI is highlighted regardless of the project and I need to highlight these elements so that the user knows that particular elements has an RFI with it thus making people respond to RFIs faster.
Actually I have now created a txt file with each individual values(like projection line color,Pattern ect…) and it works but,also want to know if it can be saved as a instance.
Hello,
I think that the data serialization of properties via json or csv or txt…, remains indeed the most appropriate means in this case
2 Likes
I believe serialization works by saving the data and recreating the object by deserialzation. ( correct me if I am wrong) so, to accomplish this I will need a class that has the exact same structure of OverrideGraphicSettings, because it tends to save the contents in the basic datatypes.( again correct me if wrong).
For example : if I set projection line color. I need to construct a color as the serialized object would have stored RGB values and not an object called color.
So, I need a intermediate setup for the conversions to happen, is that right?
In short, the data inside the instance is intact but we have to write a method to recreate object from the data.
Wish, it would be good if it can be saved and called back directly as an object/instance.
yes this requires storing the property values as a string or a numeric value, then reconverting them, as you do with your txt file
you can try to use the pickle module