algorithmic modeling for Rhino
Hi everyone,
I am creating a custom GH component which just like the geometry curve component (which allows the user to set a curve or several curves) allows the user to select text in Rhino and assign it to a component.
The component will then have a TextEntity instance as its output.
I am doing this by creating a Textgoo which inherits from GH_GeometricGoo - please see the file TextGoo and then by creating a TextParam which takes Textgoo as an argument and inherits from GH_PersistentGeometryParam.
The TextEntity from Rhino is assigned to the Textgoo.value property however at some point this value is lost and therefore when I drop the component onto the canvas I get the following error seen in the picture.
Does anyone have any pointers on what is going on? Please let me know if I haven't made the question clear enough I am new to using Grasshopper SDK.
Tags:
Hi Anton,
I can not help you with your problem.
Just to mention that grasshopper's "Guid" parameter can input text, text dots, points clouds and other types which do not have a specific grasshopper parameter. Once inputted, you can check for their geometry:
textEntity = Rhino.RhinoDoc.ActiveDoc.Objects.Find(txtGuid).Geometry
I apologize for intruding the topic.
Since Value can be null, you need to test for null before calling any methods/properties on it. Your ToString() override called directly into Value without checking. That may have been the problem.
David,
Thank you for your reply, this does indeed solve the issue of the pop up NullReferenceException but I still haven't solved the issue as to why Value is Null not the instance of the TextEntity that I am selecting in Rhino.
At this point Value is always null. Do you have any ideas about this?
Are you sure you want TextEntity? Wouldn't Text3d in the Rhino.Display namespace be better? It seems there is very little support for TextEntity in the SDK and it's also a vaguely abstract type.
Attached a cs file which uses Text3d instead of TextEntity. I'm having a lot of trouble with entity, can't get boundingboxes, can't get it to draw, it's a hopeless type.
David,
Thank you very much for your code, it works for me! I now have to go through and understand it.
Cheers,
Anton
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by