Custom Dimension Geometry + RhinoCommon learning resources

Howdy,

I’m in the process of learning RhinoCommon, and C# generally, and I’m struggling to understand the way everything comes together. The RhinoCommon API docs are helpful to a point, but I find them lacking in detail in places, although maybe my inexperience means I cannot read them properly; It’s hard to line up what is relevant to my intent.

At the moment I am working on developing a simple script component in GH. It takes in two points and generates a custom dimension between them. Ideally I would like to work out how to create custom arrows, extensions and text border-shapes.Eventually I would like to break this out of GH and into a plugin.

I can see that LinearDimension() takes points but I do not see anything within the constructor or properties for custom geometry or line-type of the dim lines or extension lines. I had a look at the other constructors i.e Dimension(), CommonObject() & GeometryBase(), but I’m not sure if these are what I’m after, or how to use them if they are.

If anyone has any information on the above or any pointers for a developing developer, or can suggest any books or online resources specific to RhinoCommon (I’ve downloaded the GH C# scripting document), then please let me know.

Cheers,

S

Hi Stuart,

I will give you a short answer and one way you can do this in C#…and then we can go deeper if you have particular requests. You know how inside Rhino you have Dimension Styles. Well, you have them in code as well…you can create one from scratch or choose one of the existing ones. LinearDimension does not take that information as an argument in the constructor…however, you can set it up after the creation, for example, if you have a

DimensionStyle dimStyle;

LinearDimension lnDim = new LinearDimension(localPlane, pt0, pt1, ptOffset);

lnDim.DimensionStyleId = dimStyle.Id;

So you basically just assign the ID…if you need help with getting or creating a Dimension Style, we can go there as well. The RhinoDoc holds a table of Dimension styles.
This is spoken from the perspective of someone who mostly does plug-ins but it should translate to a GH component.

Milos

Thanks Milos,

That’s great, I’ll give it a go on the weekend to better explore how I can manipulate dim styles and the linear dimensions.

It is possible to specify the linetypes for the linear dimension geometry? This Linetype for dimensions illustrates exactly what I’d like to be able to manipulate with code.

Cheers,

Stuart.

Hi Stuart,

glad I could help. It seems like the Linetypes of those extension lines are a bit tricky to set… I will check if that is possible in Rhino WIP and let you know if there is an update there.

1 Like