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 ?