I just ran into what i think is an undocument constraint for Plugin UserData Objects.
I made a new UserData
- but within a second DLL which i reference from our plugin.
[Guid("3b4b4cf6-e319-4a56-8b8a-989eb70f7451")]
public class MyData: UserData { }
I then get this exception in UserDataList.cs
I assume this fails because there is no Plugin class in this second DLL.
Is there any way around this?
If not can we add a line to the follow documents to explain the constraint.
Rhino - User Data (rhino3d.com)
Rhino - Plugin User Data (rhino3d.com)
menno
(Menno Deij - van Rijswijk)
July 4, 2024, 3:39pm
2
Currently there is no way around this, user data must be defined in the plugin DLL. There is an existing issue for this; I have added a request to document this limiation.
see https://mcneel.myjetbrains.com/youtrack/issue/RH-23446
The issue comes up now and then on the forum.
Question about userdata defined in a dll
ok scenario :
I want to be able to read userdata from both a rhino plugin (rhp) and a grasshopper dll (GHA)
so I have defined a derived UserData class in a dll.
I get a exception when I call the routine (in my case a Layer object ) from the rhp plugin
UserDataEx data = new UserDataEx();
myLayer.UserData.Add(data);
Before moving the class into a dll it was working fine, so I assume the class needs something else
but since I am not a c# gur…
I have a plug-in that loads a file resulting in a Mesh. To this I want to add a UserData definition. I have found that when the class definition of the UserData is not in a plug-in assembly, that I get a NullReferenceException:
at Rhino.DocObjects.Custom.UserData.NonConstPointer(Boolean createIfMissing)
at Rhino.DocObjects.Custom.UserDataList.Add(UserData userdata)
<snip my code>
It would be nice if this restriction could be lifted somehow.
1 Like