Direction of dimensions

Hi

I try to add some linear dimensions using RhinoCommon & Python, using:

dim = Rhino.Geometry.LinearDimension.FromPoints ( pointA, pointB, pointC );
dim.Aligned = True;
doc.Objects.AddLinearDimension ( dim );

This only works for horizontal dimensions. How do I setup it to work for vertical dimensions and other directions.

rhinoscriptsyntax.AddAlignedDimension works but I would like to using RhinoCommon.

Thank you

Stratos

If you want complete control over the orientation of the dimention, you need to use a different constructor.

var dim = new LinearDimension(dimensionPlane, extensionLine1End, extensionLine2End, pointOnDimensionLine);

The key being dimensionPlane.

Does this help?

Thank you Dale. This worked indeed for vertical orientation! I haven’t tried a tilted dimension yet (like aligned ones from default GUI), but I guess they follow the same principle,
(By the way, do you have any idea about what is the use of the .Aligned property?)

I have a follow up question, for which I would also appreciate some guidance.
What I try to do in my Python script (RhinoCommon) is to automatically add some lines in the document, along with dimensions that show their relative distances.
Ideally, I would like to have these dimensions automatically self-updating when the user moves the lines.

I was shown by members of this forum how to achieve this in the GUI by enabling ‘Record History’.
Is it possible to create a similar setup using a Python script?

I noticed that methods like AddLinearDimension and AddLine do include a HistoryRecord parameter.

I have also seen your code in:
https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCsHistory.cs

which, as far as I can read, is more of a custom history-based updating process, and I also don’t know if Python scripts can get callbacks from Rhino (?)
I would think that commands like AddLinearDimension expect HistoryRecord structures where specific object references are signed to specific indices (?). However, I couldn’t found any examples/documentation…

Any help is appreciated !

Thank you

Stratos

History recording is command-based. Thus, you are (most likely) going to want to do this in a plug-in.

OK. No worries,

Thank you for your help.

A post was split to a new topic: Dimensions with History