Skip to content

[Layout API] Limitations for setting units of Dimensions #1049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Fredosixx opened this issue May 14, 2025 · 1 comment
Open

[Layout API] Limitations for setting units of Dimensions #1049

Fredosixx opened this issue May 14, 2025 · 1 comment

Comments

@Fredosixx
Copy link

In the Layout interactive UI, dimensions can be configured for the unit system:

  • at document level
  • at dimension level

In the Layout API, there are several problems:

  1. At Dimension level: the unit system of the LinearDimension can be obtained via its style with the method: LinearDimension#style.dimension_units. However there is no way to SET the unit, because there is no setter method LinearDimension#style.dimension_units=

  2. At Document level, there is are getter and setter methods to get the unit system of the Document: Document: Document.unit and Document.precision. HOWEVER, it seems that there are limitations in the unit system you can set in the document, probably based on the template used. For instance, I can only set the unit in Decimal or in Fractional, but NOT in Engineering and Architectural. I get an API error otherwise. This seems to be a limitation in the interactive UI too.
    Image

  3. In the Imperial systems (Architectural and Fractional), there is an option to use or not an hyphen between after the first number (ex: 3'-2 2/4" or 4-3/4"). This option exists in the interactive UI at Dimension level:

Image

This setting is absent from the API, whether at Document level (in get and set) or at Dimension level (get).

It would be ueful to have a complete and consistent set of methods to get and set the unit system in the API, at least at the same level as the interactive UI.

@Fredosixx
Copy link
Author

I think we can close this one.

There is a setter method for dimension unit in the Style class, called set_dimension_units (and not dimension_units=).

There remain the question of the hyphen, which is less an issue, as it is not even supported in Sketchup. It seems to have been added lately, and the API was not updated.

For the Document units, I still do not understand why there is a limitation to Decimal and Fractional. The fact is that the unit system set at Document level are used as the default for all dimensions, except if they have their own unit system specified via their style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant