File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
src/compas_ghpython/utilities Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
1010### Added
1111
12+ * Added ` create_id ` to ` compas_ghpython.utilities ` . (moved from ` compas_fab ` )
13+
1214### Changed
1315
1416* Fixed bug that caused a new-line at the end of the ` compas.HERE ` constant in IronPython for Mac.
Original file line number Diff line number Diff line change 5252 :toctree: generated/
5353
5454 unload_modules
55+ create_id
5556
5657"""
5758from __future__ import absolute_import
9394 "list_to_ghtree" ,
9495 "ghtree_to_list" ,
9596 "update_component" ,
97+ "create_id" ,
9698]
99+
100+
101+ def create_id (component , name ):
102+ """Creates an identifier string using `name` and the ID of the component passed to it.
103+
104+ The resulting string can be used to store data elements in the global sticky dictionary.
105+ This can be useful when setting variable in a condition activated by a button.
106+
107+ Paramaters
108+ ----------
109+ components : `ghpythonlib.componentbase.executingcomponent`
110+ The components instance. Use `self` in advanced (SDK) mode and `ghenv.Components` otherwise.
111+ name : str
112+ A user chosen prefix for the identifier.
113+
114+ Returns
115+ -------
116+ str
117+ For example: `somename55dd-c7cc-43c8-9d6a-65e4c8503abd`
118+
119+ """
120+ return "{}_{}" .format (name , component .InstanceGuid )
You can’t perform that action at this time.
0 commit comments