I better ask this in another topic.
@DavidRutten, could you (or anyone) give me example of the usage of GH_TagArtist?
I always get stuck when I try to use the APIs without example.
I better ask this in another topic.
@DavidRutten, could you (or anyone) give me example of the usage of GH_TagArtist?
I always get stuck when I try to use the APIs without example.
Donât ask me how it might work in Python⌠The idea is that you create a new class which inherits from GH_TagArtist
, you implement the Paint()
method and youâll probably want to create a constructor for it in which you give it all the information it needs. You then register the instance using GH_Canvas.AddTagArtist()
, and eventually when itâs done you remove it again using GH_Canvas.RemoveTagArtist()
. Of course a tag artist class can decide to remove itself from within its Paint()
method if it feels it has come to the end of its lifespan, so it can be a âfire-and-forgetâ sort of approach.
Edit: forget about removing a tag artist from within its Paint method. That leads to problems. Dang.
tagger.gh (3.9 KB)
Yeah, I know you donât speak Python, I can manage to translate it from csharp to python. The problem I have is that I donât know which object from the API is defined how.
I donât know if:
something()
I know probably these are basic things but I never worked with such APIs and when I search the web really basic questions are mocked. In books there are no Icons that match the object in the api and how it is called.
This is why I always so desperately ask for examples.
This is if you care, just FYI, I doubt anyone will use a grid that small.
You can find some canvas components in Wombat.
Thanks @Michael_Pryor, but as we already discussed (in other threads) I prefer not to use 3rd party plugins. It doesnât help me learn.
Ok, I guess Iâm gonna need a little more help:
Why do I then get the following error:
Thereâs no IGH_TagArtist in the csharp code.
Where is Brushes.Black coming from? Do I need to override another class?
Where is PaintEnd coming from?
I guess I need to figure out how to define global variables from within functions to be accessed from other functions to match what csharp is doing.
But according to Programming FAQ â IronPython 2.7.2b1 documentation
By using global variables. This isnât thread-safe, and is not recommended.
Plus whatâs the recommendation there to put âglobalâ doesnât work for me.
In Python, variables that are only referenced inside a function are implicitly global. If a variable is assigned a new value anywhere within the functionâs body, itâs assumed to be a local. If a variable is ever assigned a new value inside the function, the variable is implicitly local, and you need to explicitly declare it as âglobalâ.
Though a bit surprising at first, a momentâs consideration explains this. On one hand, requiring global for assigned variables provides a bar against unintended side-effects. On the other hand, if global was required for all global references, youâd be using global all the time. Youâd have to declare as global every reference to a built-in function or to a component of an imported module. This clutter would defeat the usefulness of the global declaration for identifying side-effects.
Some explanation, right? What is the difference between âInside the functionâ and âInside the functionâs bodyâ?
tagger_RE.gh (3.9 KB) (fixed no color change)
Thanks in advance to whoever helps.
Dude, if you upload a script that modifies the colors of the canvas just oppening the file, let us know or at least put an option to restore the default colors
WoW, sorry, my bad, Truth be told, I didnât think this will stay.
First I have to learn how to do that.
The wombat one has a bool to switch back to default. Been using if for when ppl send me files with changed colors. If you want a shortcut for the future.
First I have to learn how to do that.
I think just have a bool that overwrites each of your input values with the defaults. if true use input color, if false use default color.
yes, I know but I donât know the default ones.
If the grasshopper_gui.xml file is removed, it returns to the original setting when restarting GH.
Before changing a color, keep the original color (just get instead of set) in a global variable and use a button to use that default or user color.
Default colors:
grasshopper_gui.xml (11.0 KB)
<?xml version="1.0"?>
-<Fragment name="Settings">
-<items count="91">
-<item name="black.sel.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;35;0</ARGB>
</item>
-<item name="black.sel.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;25;60;25</ARGB>
</item>
-<item name="black.sel.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;190;250;180</ARGB>
</item>
-<item name="black.std.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="black.std.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;50;50;50</ARGB>
</item>
-<item name="black.std.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;255;255;255</ARGB>
</item>
-<item name="blue.sel.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;5;90;55</ARGB>
</item>
-<item name="blue.sel.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;70;220;100</ARGB>
</item>
-<item name="blue.sel.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="blue.std.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;55;100</ARGB>
</item>
-<item name="blue.std.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;90;115;235</ARGB>
</item>
-<item name="blue.std.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="brown.sel.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;35;50;0</ARGB>
</item>
-<item name="brown.sel.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;135;145;10</ARGB>
</item>
-<item name="brown.sel.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="brown.std.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;50;20;0</ARGB>
</item>
-<item name="brown.std.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;140;80;30</ARGB>
</item>
-<item name="brown.std.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="canvas_backcolor" type_code="36" type_name="gh_drawing_color">
<ARGB>255;212;208;200</ARGB>
</item>
<item name="canvas_columnwidth" type_code="3" type_name="gh_int32">150</item>
-<item name="canvas_edgecolor" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="canvas_gridcolor" type_code="36" type_name="gh_drawing_color">
<ARGB>30;0;0;0</ARGB>
</item>
<item name="canvas_monochromatic" type_code="1" type_name="gh_bool">false</item>
-<item name="canvas_monocolor" type_code="36" type_name="gh_drawing_color">
<ARGB>255;255;255;255</ARGB>
</item>
<item name="canvas_rowheight" type_code="3" type_name="gh_int32">50</item>
-<item name="canvas_shadecolor" type_code="36" type_name="gh_drawing_color">
<ARGB>80;0;0;0</ARGB>
</item>
<item name="canvas_shadowsize" type_code="3" type_name="gh_int32">30</item>
-<item name="error.sel.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;50;0</ARGB>
</item>
-<item name="error.sel.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;125;155;0</ARGB>
</item>
-<item name="error.sel.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;255;255;255</ARGB>
</item>
-<item name="error.std.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;60;0;0</ARGB>
</item>
-<item name="error.std.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;200;0;0</ARGB>
</item>
-<item name="error.std.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="grey.sel.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;35;0</ARGB>
</item>
-<item name="grey.sel.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;120;180;120</ARGB>
</item>
-<item name="grey.sel.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;20;0</ARGB>
</item>
-<item name="grey.std.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;20;20;20</ARGB>
</item>
-<item name="grey.std.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;150;150;150</ARGB>
</item>
-<item name="grey.std.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="group_backcolor" type_code="36" type_name="gh_drawing_color">
<ARGB>150;170;135;255</ARGB>
</item>
-<item name="hidden.sel.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;35;0</ARGB>
</item>
-<item name="hidden.sel.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;80;180;10</ARGB>
</item>
-<item name="hidden.sel.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;25;0</ARGB>
</item>
-<item name="hidden.std.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;35;35;35</ARGB>
</item>
-<item name="hidden.std.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;140;140;155</ARGB>
</item>
-<item name="hidden.std.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="locked.sel.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;40;70;40</ARGB>
</item>
-<item name="locked.sel.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;110;150;115</ARGB>
</item>
-<item name="locked.sel.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;75;100;65</ARGB>
</item>
-<item name="locked.std.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;90;90;90</ARGB>
</item>
-<item name="locked.std.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;120;120;120</ARGB>
</item>
-<item name="locked.std.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;70;70;70</ARGB>
</item>
-<item name="normal.sel.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;50;0</ARGB>
</item>
-<item name="normal.sel.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;130;215;50</ARGB>
</item>
-<item name="normal.sel.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;25;0</ARGB>
</item>
-<item name="normal.std.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;50;50;50</ARGB>
</item>
-<item name="normal.std.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;200;200;200</ARGB>
</item>
-<item name="normal.std.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="panel_backcolor" type_code="36" type_name="gh_drawing_color">
<ARGB>255;255;250;90</ARGB>
</item>
-<item name="pink.sel.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;50;0</ARGB>
</item>
-<item name="pink.sel.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;160;210;30</ARGB>
</item>
-<item name="pink.sel.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;255;255;255</ARGB>
</item>
-<item name="pink.std.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;100;0;50</ARGB>
</item>
-<item name="pink.std.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;255;0;125</ARGB>
</item>
-<item name="pink.std.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="trans.sel.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;10;65;25</ARGB>
</item>
-<item name="trans.sel.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>125;75;225;125</ARGB>
</item>
-<item name="trans.sel.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;30;15</ARGB>
</item>
-<item name="trans.std.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;30;30;30</ARGB>
</item>
-<item name="trans.std.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>100;200;200;200</ARGB>
</item>
-<item name="trans.std.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="warning.sel.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;50;0</ARGB>
</item>
-<item name="warning.sel.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;185;205;0</ARGB>
</item>
-<item name="warning.sel.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="warning.std.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;80;10;0</ARGB>
</item>
-<item name="warning.std.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;255;140;20</ARGB>
</item>
-<item name="warning.std.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="white.sel.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;50;0</ARGB>
</item>
-<item name="white.sel.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;130;215;50</ARGB>
</item>
-<item name="white.sel.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;25;0</ARGB>
</item>
-<item name="white.std.edge" type_code="36" type_name="gh_drawing_color">
<ARGB>255;50;50;50</ARGB>
</item>
-<item name="white.std.fill" type_code="36" type_name="gh_drawing_color">
<ARGB>255;200;200;200</ARGB>
</item>
-<item name="white.std.text" type_code="36" type_name="gh_drawing_color">
<ARGB>255;0;0;0</ARGB>
</item>
-<item name="wire_default" type_code="36" type_name="gh_drawing_color">
<ARGB>150;0;0;0</ARGB>
</item>
-<item name="wire_empty" type_code="36" type_name="gh_drawing_color">
<ARGB>180;255;60;0</ARGB>
</item>
-<item name="wire_selected_a" type_code="36" type_name="gh_drawing_color">
<ARGB>255;125;210;40</ARGB>
</item>
-<item name="wire_selected_b" type_code="36" type_name="gh_drawing_color">
<ARGB>50;0;0;0</ARGB>
</item>
-<item name="zui_edgecolor" type_code="36" type_name="gh_drawing_color">
<ARGB>255;75;140;150</ARGB>
</item>
-<item name="zui_edgehighlightcolor" type_code="36" type_name="gh_drawing_color">
<ARGB>255;60;135;180</ARGB>
</item>
-<item name="zui_fillcolor" type_code="36" type_name="gh_drawing_color">
<ARGB>255;175;220;230</ARGB>
</item>
-<item name="zui_fillhighlightcolor" type_code="36" type_name="gh_drawing_color">
<ARGB>255;170;210;255</ARGB>
</item>
</items>
</Fragment>
When I deleted that xml the default colors returned but not the xml file
Go to File -> Special Folders
menu. in Settings Folder open grasshopper_gui.xml in something like notepad. You will see all the values there.
Update: the picture above is after deleting the xml, with rhino closed. Then restarted rhino and grasshopper, the file was still missing. It appeared after the second or third restart.
If the grasshopper_gui.xml file is removed, it returns to the original setting when restarting GH.
Yeap just saying if you are feeling particularly lazy and donât want to close and reopen.
Maybe a stupid question, but you closed and reopened? Worst case steal it from @Dani_Abalde he attached it in his above comment.
Restart RH and GH again.