Favourites and script/python/c# component
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-11-01
01:06 PM
- last edited on
2023-05-11
11:03 AM
by
Noemi Balogh
So, I read in the connection manual that for most elements, the parameters available are not complete, and if we want completion we should use favourites and connect them to design components directly.
In order to avoid having dozens of favourites with only minor changes between them, is there a way to do this: insert a script/python/c# component (say between a wall favourite and wall design or between wall design and wall parameter) and change for example the thickness or the layer of the wall?
As a test, I try to have a script component with the favourite as input and an unaltered copy as output (either by a = x, or python deepcopy or a copy using classes), and I get "data conversion failed from goo to wall settings". Type hinting is not useful either.
I guess the more general question, for scripting, when the archicad component has an archicad structure/object as an output, are the data in it private and totally inaccessible or there's a way to read/parse/copy/edit them?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-12-06 01:36 AM
So it seems (most?) Archicad data (from favourite components or others) can be read/changed after all.
With a C# script, if you make sure you avoid an (implicit) conversion (from the original Archicad class to the generic Grasshopper class) while getting the data, then you GetType(), and then with intellisense/autocomplete you can see what's inside the Archicad class, including parameters you can change by script.
I have ended up writing a small number of helper functions (creating/deleting a component on the grasshopper canvas, connecting/disconnecting objects, getting/setting data, etc). It's basic functionality, but it takes quite a bit of time if one is not familiar with the Rhino/Grasshopper API, or also C#. I could attach them here at some point, if there is an interest.
I'm not sure if Python is a good option for the above, I didn't give it a proper chance, but the dynamic typing and also the inferior intellisense created problems for me.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-12-07 10:14 AM
Have you ever considered making a GitHub for that?
Cheers, runxel
POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-12-08 03:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-01-18 11:34 AM
That would be awsome!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-01-19 12:55 AM
So, to make it a precise step by step, by list access of input components and choosing, you mean something like this scenario?
1) Programmatically (or not) add a zone category component on GH.
2) Programmatically (or not) create a GH list (or extract one) that for example contains string entries "Zone Category A", "Zone Category B" etc (zone categories already existing on AC).
3) Programmatically select, say, "Zone Category B" for the newly created zone category component. (Which I assume is then linked on GH to a Zone Setting component).
Did I understand correctly?
1 and 2 are easy. 3 is tricky, you can let me know if I got it right above and then I write some of my tests on that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-01-19 09:25 AM
This is working but not in terms of Inout types like Zone Category, as you simply cannot match them with the existing ones in the project. It is actually not very Grasshopper-like to pick and choose such entities from a Drop Down Menu, but I guess there must be a reason behind it ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-01-20 12:33 AM
It's bad luck that, generally, the input components seem to be the worse to play with. As I understand, they don't contain the full data of what they hold, but references to the object/thing in AC.
At least with favourites (and some other inputs) you can extract/deconstruct the data with the right component connection (and then explore/manipulate subvalues). But zone category is not like this. I tried everything that looks like a setter in the zone category component class (to change/set without a drop-down) but all I got was errors, items seem to be read-only.
I don't know, perhaps the solution is purely in GH. I assume the drop-down could be some GH construct that can be manipulated/extracted/clicked programmatically.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-01-20 10:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-01-21 12:16 AM