Controlling dimension attributes in rhinocommon


#1

I’m using rhinocommon to add some dimension to the document. I have 4 questions relating to dimension style etc.

  1. I would like to change the scale of a dimension object (arrows, text etc. all should grow). I’m not seeing an option for this. I do see something for text height, but it doesn’t seem to work for me when I use it as follows:
    MyDimension.TextHeight = 50
    doc.Objects.AddDimension(MyDimension)
    also tried this:
    doc.DimStyles.CurrentDimensionStyle.TextHeight = 30
    doc.DimStyles.CurrentDimensionStyle.CommitChanges()

  2. I would like to change a line type to something other than continuous. I’ve tried the code below but it doesn’t seem to work.
    Dim attributes = New Rhino.DocObjects.ObjectAttributes()
    attributes.LinetypeSource = DocObjects.ObjectLinetypeSource.LinetypeFromObject
    attributes.LinetypeIndex = 4
    doc.Objects.AddLine(pt0, pt1, attributes)

  3. I would like a locked object to not be the generic grey locked color. I know I could change the generic locked color, but what I need is to change it for specific objects, but not all. Is there a way to do this short of putting it on a layer and locking the layer?

  4. When using angular dimensions, sometimes the dimension arrows are forced outside the angle, is there a way to force them inside the angle?

Thanks,
Sam


Programatically change all existing dimensions styles
(Dale Fugier) #2

This seem to work for me:

Protected Overrides Function RunCommand(ByVal doc As RhinoDoc, ByVal mode As RunMode) As Result
    Dim dim_style As DimensionStyle = doc.DimStyles.CurrentDimensionStyle
    dim_style.TextHeight = 30
    dim_style.CommitChanges()
    doc.Views.Redraw()
    Return Result.Success
End Function

This is not possible in Rhino 5. Its on the wish list for Rhino 6.

Without creating a custom display conduit to draw the objects with your own special locked object color, you will need to put the objects on a locked layers.

No, there isn’t. You can with linear dimensions (Object Properties -> Dimensions -> Arrows. But the controls don’t work with angular dimensions. The fact that the UI appears is a bug, in my opinion. This too is on the to-do list for V6


#3

Thanks Dale, that worked great, looking forward to V6.
Sam