I am trying to add a radial dimension via Python/RhinoCommon:
dimension = Rhino.Geometry.RadialDimension(pCenter, pTip, vX, vZ, dOffset)
id = doc.Objects.AddRadialDimension(dimension)
This works fine, but I (always) get a DIAMETER dimension instead of a RADIUS dimension. The property IsDiameterDimension is read only, so how can I define the type?
Note that IsDiameterDimension still returns True, would be to easy, also tried to change diameter.Text to “R<>” but it remains a diameter dimension and that does not change the value, just the prefix…
I don’t think this is gonna work, since dimension is created as an instance of Rhino.Geometry.RadialDimension. You can’t divide that by two and if you assign a float value to it AddRadialDimension won’t accept it as input anymore.
Using a command script would be the last resort of course, but if there’s a way to avoid this I’d rather go for “proper” programming…
thanks for the idea. Since the resulting model is to be exported as fabrication data both in Rhino and DWG-Format for a client, I’d rather have proper dynamic dimensions in there. But for printing PDFs I’ll just change the text.
Do you happen to have any idea how the TextFormula-property of the AnnotationBase-class is working?
The documentation is a bit minimalistic at this point…
The TextFormula basically determines the format of the Text property. Use the angle brackets <> to determine the position of the NumericValue property.
For example the following dimension.TextFormula:
dimension.TextFormula = "Ø _something in here <>"
Will result in the the following dimension.Text:
"Ø _something in here 50"
(in case your NumericValue is 50)
Also if you are using the Ø character, make sure that you add the # coding=utf-8 on top of your script.
i am not entirely sure if TextFormula is properly evaluated when used in a radial dimension. I thought that these only apply to Text fields, as described in the Rhino helpfile under “Text fields”. Eg if i try this on a circle with diameter 20:
If just creates the radial dimension with this dimension text: Ø20 %<modelunits>%
The angle brackets can be used in the Text property too eg. using dimension.Text = "R<>" but as described in my first reply it still printed a diameter value instead of the radius.
If the dimension needs to stay dynamic, i’ve wondered if you couldn’t create a seperate dimension style with LengthFactor set to 0.5 and assign that after replacing the diameter symbol with R ? But i’d rather choose the static way and force the correct radius value to prevent errors in the downstream…
Maybe @dale can take a look why IsDiameterDimension is read only or has a fix for the problem ?