i think they should have a get/set method
agree with this 100%. Would be very nice to code into predefined styles.
Hello @romainjanil and @DevinLavigne
Thanks for your input. With python it is indeed only possible to set attributes, but no styles.
The CE team is looking into this.
Thanks
Thomas Fuchs
great, I didn't realized this wasn't possible till I tried to use a similar feature (pre set some geo styles with local attributes values inside a generic geo-typical rule file and call them depending on the shape geo-location)
Thanks @ThomasFuchs - cga too right?
@DevinLavigne yes, from within CGA, it is not possible to set a style.
Styles can only be selected in the CE Inspector.
This would be of great help in a number of projects. I've cobbled together a style creator (for external assets) in python but having a formal way of doing all of this would be nice.
I agree that a new way to get/set styles is the ideal here and came to find out if it was possible, which it is not.
But one workaround after you create the style is turn it back into a function. So a style gets transformed from:
style SuperStyle
attr Color = "Red"
Use a find and replace on your style selection:
Find: "attr" Replace "set("
Find: "=" Replace ","
I can't get the carriage return to work for setting the " ) " so that's has to been done manually.
And then loop it back to ruleset however in the stack you placed it, probably all the way at the top.
Now your style is a function and can be used in conditional logic.
SuperStyle-->
set(Color,"Red")
NextRule //Your setting your attributes at the top of your ruleset and this a detour.
But yeah, a get/set is what we need.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.