Grasshopper

algorithmic modeling for Rhino

Ensure that components cannot be copied on the Grasshopper canvas

Hi All,

I would like to ensure that my custom components can't be copied, by the user selecting the component and using crtl+C. 

As far as I can tell I can't stop this behavior by override the GH_ObjectResponse of the component, so how can I implement this code?

Many thanks!

Views: 328

Replies to This Discussion

You can do like this:

Attachments:

Are you doing this in Visual Studio?

There is no difference programmatically between adding a component from the clipboard, or by merging files, or by placing a new one on the canvas. What you can do is handle the method that gets called when a component is added to a document, then see if that document already contains another component like it and disable the new instance.

Do you not want people to have more than one instance of the same type of component, or are they allowed to add multiple components, as long as they don't share some sort of state?

Oh I see, you're not worried about one of your components being copy+pasted, you just don't want its serialized data ending up in the clipboard? Why? Do you also not want your component to be included in the gh/ghx file? Because that's exactly the same thing.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service