algorithmic modeling for Rhino
Tags:
GH_Document.ExpandSelection Method might be what you are looking for.
I'm still trying to get the current GH_Document Object inside the SolveInstance method :(
I hope the GH_DocumentObject.OnPingDocument Method is the right one
Sorry I cannot help more I only knew about the growselection because it is available in the UI
Connections are made between parameters. A parameter maintains a list of sources it gets data from and each parameter also has a list of recipients to which it disseminates data.
Both of those properties are publicly accessible so you should be able to figure out which objects are 'upstream' from a specific component.
--
David Rutten
david@mcneel.com
Hi David,
first of all, thank you for your relay. But your description is a little abstract for me at this moment.
Specifically speaking, I want use the EW and PW parameter of the "BUI Modifier " component(the left one) inside the "Connector" component. You mean I should first find the GUID of the B17 parameter and look for the "BUI Modifier" Component in the whole Document? Or there is a way to backtrace it directly?
Right now I can only get the InstanceGuid of each Input Parameter of the "Connector" component using the method you mentioned with "sources". It is still not clear for me, how to get it work.
I'd appreciate it if you cound explain it more explicitly.
Thank you!
Here is an example that does what David mentioned:
https://github.com/mostaphaRoudsari/ladybug/blob/master/src/Ladybug...
Thank you for sharing this, I'll look your code. I'm using C# by the way. Hope there is no difficult to read it.
now I can get the Component connected to it.
GH_Document ghDocument = this.OnPingDocument();
foreach (IGH_Param param in this.Params.Input)
{
foreach (IGH_Param source in param.Sources)
{
//MessageBox.Show(source.Attributes.GetTopLevel.DocObject.Name);
if (source.Attributes.GetTopLevel.DocObject.Name == "BUI/B17 File Modifier")
{
Guid guid = source.Attributes.GetTopLevel.DocObject.InstanceGuid;
IGH_Component ghComponent = ghDocument.FindComponent(guid);
}
}
}
next step will be how to get the input parameters
Now I can get the position of each input parameter of the Midifier Component, but still can not find the right method to get the value, which is marked with "// get input value from Modifier Component" in following code, any idea?
foreach (IGH_Param param in this.Params.Input)
{
foreach (IGH_Param source in param.Sources)
{
//MessageBox.Show(source.Attributes.GetTopLevel.DocObject.Name);
if (source.Attributes.GetTopLevel.DocObject.Name == "BUI/B17 File Modifier")
{
Guid guid = source.Attributes.GetTopLevel.DocObject.InstanceGuid;
IGH_Component ghComponent = ghDocument.FindComponent(guid);
foreach (IGH_Param input in ghComponent.Params.Input)
{
switch (input.Name)
{
case "EW Type":
EW_Type = input.Name;
EW_ID = // get input value from Modifier Component
break;case "PW Type":
PW_Type = input.Name;PW_ID = // get input value from Modifier Component
break;case "IF Type":
IF_Type = input.Name;
IF_ID = // get input value from Modifier Component
break;case "WIN Type":
WIN_Type = input.Name;
WIN_ID = // get input value from Modifier Component
break;}
}
}
}
}
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by