Diagram on how to convert objects

Hi all,

a scheme that dictates the guidelines on how to convert a certain piece of data into another,
in the various different cases of input type: using Get() or FindByObjectType() etc exist?

Yes and no. What language are you planning to use?

What is the intended goal? We might have some suggestions.

thanks for reply @scottd,

the language is C# Sharp, if I write a code in Python the conversion between objects happens automatically, while while typed in C# you have to know well what you are
about to do and (as you said) what you want to achieve.

Precisely for this reason it would be advisable to have a scheme to refer to for every possible situation, as happens when converting the different formats in C#

Going into specifics as I was saying, if I use Get():

pt.Get();

I can immediately use this object as Geometry

pt.Object(0).Point()

while if I go to search for the objects present in the file

 var ros = doc.Objects.FindByObjectType(Rhino.DocObjects.ObjectType.Mesh);

I have to convert type in this example:

as Rhino.Geometry.Mesh

but this is the last case that happened to me, but every time I manage different objects you have to do conversions and in every situation you have to know the correct syntax for the conversion in that case,
and I always find myself in difficulty with this type of action.

type this:

Screenshot 2024-04-07 at 23-59-52 c# cast object - Cerca con Google

Hi @0904,

Maybe this long thread will help.

– Dale

1 Like

Hi Dale and thanks for the link, I just did a quick read,
I will try to delve deeper into the topic and assimilate as many explanations as possible relating to the issue.