Dear all,
I am trying to create an ordinate dimension by scripting. Since ordinate dimensions are not available in in the rhinoscriptsyntax I want to solve this problem by rhino common (I should say that I don’t have much experience in rhino common). Here is my try:
import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc
dim_scale = 5
dimstyle = "dim01"
if not rs.IsDimStyle(dimstyle):
dimstyle = rs.AddDimStyle(dimstyle_name=dimstyle)
rs.DimStyleTextHeight(dimstyle, height=2)
rs.DimStyleLinearPrecision(dimstyle, precision=1)
rs.DimStyleArrowSize(dimstyle, 1.250)
rs.DimStyleExtension(dimstyle, 1.250)
rs.DimStyleScale(dimstyle, scale=dim_scale)
rs.DimStyleOffset(dimstyle, offset=2)
rs.CurrentDimStyle(dimstyle)
index = sc.doc.DimStyles.Add("dim01")
ds = sc.doc.DimStyles[index]
odim = Rhino.Geometry.OrdinateDimension()
odim.Create(dimStyle=ds,
plane=rs.WorldXYPlane(),
direction=Rhino.Geometry.OrdinateDimension.MeasuredDirection.Xaxis,
basepoint=Rhino.Geometry.Point3d(0,0,0),
defpoint=Rhino.Geometry.Point3d(100,100,0),
leaderpoint=Rhino.Geometry.Point3d(120,120,0),
kinkoffset1=5,
kinkoffset2=5
)
sc.doc.Objects.AddOrdinateDimension(dimordinate=odim, attributes=Rhino.DocObjects.ObjectAttributes(), history=None, reference=False)
sc.doc.Views.Redraw()
The code doesn’t return any errors, but it doesn’t add a ordinate dimension as well. Does anyonr have a suggestion what has to be done?
Best Peter