Grasshopper

algorithmic modeling for Rhino

Is there a way to select one or many components and completely remove all wire connections from them? It would be a nice tool to have when wires get crazy and you feel like reconnecting them and parceling them out, but don't want to delete all the existing components.

 

Any ideas?

Views: 7431

Replies to This Discussion

Hi Aaron,

 

there is no UI for this. It wouldn't be difficult to add as every object on the canvas has a function you can call that will remove all wires going into it. 

 

I'd say eventually the best solution would be to be able to select wires using window selection and delete them like you'd delete any object. It is not possible at present to attach any data to wires (like 'selected' or 'enabled' or 'colour' or 'linetype' because wires only really exist during canvas redraws. I'd need to quite drastically change the SDK to support this feature.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

What about the option to copy a component with an option to disconnect wires from the inputs? This way you could copy the whole definition and paste it in a new canvas with no wires.

Thanks for the reply, David. I actually enjoy the wires the way they are, so I hope any down-the-line changes to them are optional. I just thought that since right clicking on each input results in a "disconnect all" option, extending that option to perhaps the entire set of inputs and outputs of the component may be possible without changing the wires themselves. Something like "Unplug Component".

 

Thanks again,

Aaron

window selection and deletion of wires sounds like pure win for the UI.

David / GH Team,

Just curious: Is there a c# method to disconnect an incoming or outgoing wire upon an event or some other logic? If so can you point me toward it?

Many thanks.

AddSource and RemoveSource methods on IGH_Param can be used to connect and disconnect parameters. These methods will expire the parameter in question, but they will not automatically cause a recompute of the document, so you will need to make sure you do that when you're done.

Do note that changing the topology of a network (and adding/removing wires falls under that category) is not allowed during solutions.

David / GH Team,

How do I ensure 'RemoveAllSources' does not happen during a solution? I've seen you've recommended Schedule Solution, but am unsure how to implement this when I'm triggering with a 'run' button input to the VB component. My other input x is the collection of component objects provided by Metahopper Get Selected Objects 

Many thanks


Sub

if run = True Then

Dim comp As IGH_Component = x

If (comp Is Nothing) Then

Print("No components.")

Return

End If

If (comp.Params.Input.Count = 0) Then

Print("The component needs at least a single input parameter.")

Return

End If

comp.Params.Input(0).RemoveAllSources 

End If

End Sub

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service