Templates (small objects etc.) affect Frustum?

My plugin scales dimension objects automatically before they are created so as to have them be a useful size for the current model. It does this by multiplying the right value from the GetFrustum function with a constant and then applying the result to the text height. Other aspects of dimensions are sized similarly.

This works great when the default template is used. But I recently realized that scale is way off when used with other templates, like ‘small object cm’ for instance.

I thought resetting the units as follows would fix this:
doc.AdjustModelUnitSystem(UnitSystem.Millimeters, 1)
doc.AdjustPageUnitSystem(UnitSystem.Millimeters, 1)

But it does not. So it seems like the Frustum is somehow affected by the different units in a way that isn’t affected by changing the units. If this is the case, what is it exactly and how can I change the frustum to behave as if no template had been selected?

Any other thoughts on how to solve this?


Hi @samlochner,

Can you describe, in detail, what you are trying to and why?

I doubt using the view frustum to determine text height is a good idea.

– Dale

Hi Dale,

My plugin uses Rhino’s dimensions for a kind of parametric input. So it creates the dimensions, and when it does so it has to choose the right size. The plugin works just fine except when the user chooses something other than ‘no template’ or the small objects millimeters template.

Rather than digging into why my method fails for other templates, I think the simplest solution for now is to just check if the user is using a template other than small objects millimeters, and if they are then tell them not to.

I can check the units as follows:
If doc.ModelUnitSystem.ToString <> “Millimeters” Or doc.PageUnitSystem.ToString <> “Millimeters” Then

How then would I check if it was a Small objects or Large objects template?


I believe the different is in the modeling tolerance.

– Dale

That worked, thanks!