RhinoCommon and InstanceDefinition : missing summaries

Blocks…
I’m trying to use the RhinoCommon documentation to make C# scripts in Grasshopper, but I there’s all these missing summaries…
Please @dale , could you write a short description for what these properties are ?

In particular, Id’ like to know what the “IsDeleted” property.
Does it mean that there is no instance of that block definition ?
If that’s the case, I find the name of the property misleading…

Also, in the Python example (wow, Python sure is concise compared to C# !), the “.isDeleted” property is not even used !!!

I wonder what you need those properties for, it might be that those are in RhinoCommon just for the fact that those properties exist, rather than having real use for scripting/programming.

I suspect the .isDeleted is to make sure undo works, see for example:
https://developer.rhino3d.com/api/RhinoCommon/html/P_Rhino_DocObjects_Layer_IsDeleted.htm

Well, the “IsDeleted” property has the luxury of having sample scripts !
Doesn’t that mean that it might be useful to a dev’ ?

The summaries are missing, so it would be nice if Dale could spend three minutes filling them in, don’t you think ?

Well, I don’t see how this can relate to a Block definition.
If there WAS a summary, one might not have to guess.

By the way, I’m looking for the property that will tell me if an InstanceDefinition has InstanceObjects in the model.
Do you know which property will tell me this, without having to reference and count the InstanceObjects ?

It might be misleading to think that ‘it is important because there is an example script’

Better to go from what you want to achieve and then search the right methods for them.

if it is deleted, it is in the dustbin, otherwise it can’t be taken out of it (undo) if it is thrown away right away (no .isDeleted property)

Well, there’s so little sample code in the Rhinocommon documentation, so whenever I find some, I tend to check it out.
Funny that the property isn’t even present in the Python version :slight_smile:

In this case, I need a property, not a Method.
And that’s why I need to understand what all the properties relate to !!!

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Runtime_TextFields_BlockInstanceCount.htm

1 Like

These are probaly autogenerated from the source code:

/// <summary>
/// This does fancy stuff...
/// </summary>
public int SomeProperty { get; set;}

Sometimes, during a bugfix etc, a non-public member becomes public to be called from “outside”. If you miss to document this you probaly end up like this.

An api like Rhinocommon has thousands of public member, so its likely something is not commented. So what? Furthermore, properties like IsActive can be commented, but what should the comment tell you? And even if commented, its questionable if you really understand its meaning without seeing the source code…
If you really need to find out what it does, just use ILSpy. But even with this, since RC is a wrapper, you probally don’t see the underlying native logic.

As a beginner, I find this remark somewhat arrogant.

Then what’s the use of a dictionnary ?

I think might be a useful example for what you want to do:
https://developer.rhino3d.com/api/RhinoCommon/html/P_Rhino_RhinoDoc_InstanceDefinitions.htm

Why is this arrogant? It think you misunderstood this statement…
Without a context you cannot always tell when something has a specific value. Usually you have to see the source code. As a enduser you have no access to the (original) source code.
Its super impractical to write 10 lines of comments just to explain when a value changes in detail. Chances are even high, that any small change of the code makes the comments obsolete. Its just not working.

As a developer, they have no obligation to document or facilitate its use. I think it would be in their interest to get better at this because in the end every developer is contributing to their software, but I don’t get the impression that this is the case. The SDK talks to you and tells you that you shouldn’t use those methods if you don’t know what they do for yourself. And so it is, you can ask once, twice, three times, until you get tired or you adapt… Rhinocommon is submerged in this dark water in which you only see if you belong to it or adapt to it. In the small area of clear water for all the fish, there is not much to eat.

However, they are updating the docs (at least aesthetically) here is a WIP version with the same absences:
https://mcneel-apidocs.herokuapp.com/api/rhinocommon/rhino.docobjects.instancedefinition

EDIT: Rereading this, it seems to me that it falls very much on the unfair side. They have done a lot of work for third party developers, a lot, but I guess their software is much bigger than their documentation is.

Sorry, but I have no clue what you’re talking about.
Let’s take the “IsTenuous” property , what does that friggin’ mean ???

And If McNeel thinks I’m too dumb or unworthy of knowing, or even if there’s no use in me knowing , then why document it in the first place ?

Usually C#/C++ developers tend to use the ‘public’ access modifier way to often.

My experience is that there is huge difference between a small and large api.
I do work on a project with more then 100 classes. I find it extremly hard to maintain documentation on such a large scale. Usually I apply comments to anything public, and to important non-public members. But come on, its likely you miss something or that the comment is nonesense. Rhino is even bigger.

Just because its “public”, doesn’t necessary mean its a property a enduser like you should use. So the mistake is not a missing comment, but having the wrong access modifier, since its likely of internal usage. The context is unknown to you because you don’t see the source code. So I would expect if this flag is true, something is likely to break. But I don’t know what may causes the state. A good documentation would tell when it becomes true, but this is just impractical from a developers perspective.

No, this is not a good example because it uses the InstanceDefinition.ObjectCount Property, which does not count the instances, but the objects in a definition !

See how useful a summary can be when it’s actually available ?

The first part of the script seems to count the object definitions in your file. I haven’t tested it myself, hence the ‘might’

Btw: I usually just make a small script and use the method or property to see what it returns. That can serve often better than a description

2 Likes

Yes, but I don’t want to count the object definitions in my model.
I need to know, for each Object definition, how many instances of it there are.

When it gets to blocks, things get confusing real fast, hence the need for a proper documentation with many examples, comments, etc…

Since you are probally new to programming… its just how it is! There is never a perfect situation, api or whatsoever. See, I wonder if you document your kind of work always perfectly, assuming anyone can use it for any case. Why don’t you just create a new thread, explaining the problem you have and why the default way of doing it does not work for you? All the complaining did just distract from problem you are trying to solve.

I am new to programming with object oriented languages.
I’m not the “it’s just how it is” type of guy, and you can save some time by keeping your “it’s just as it is” comments to yourself.