Skip to content

Update UnitSymbol to switch method. Refactor Converts to Internal - #181

Merged
peterjamesnugent merged 5 commits into
developfrom
Units_Engine-#180-add-unitsymbol-and-refactor-convert-methods-to-internal-for-access
Sep 7, 2026
Merged

peterjamesnugent merged 5 commits into
developfrom
Units_Engine-#180-add-unitsymbol-and-refactor-convert-methods-to-internal-for-access

Conversation

@Chrisshort92

@Chrisshort92 Chrisshort92 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Depends On

This change creates conflicts in Etabs & SAP Toolkits through the use of Adapter.Query() & Units.Query() . Both resolved in these PRs.

Issues addressed by this PR

Closes #180

Adds Query.UnitSymbol(Enum), returning the symbol for a BH.oM.Units member —
LengthUnit.Millimeter -> mm, AreaMomentOfInertiaUnit.CentimeterToTheFourth -> cm⁴.

It dispatches on the quantity and reuses the BHoM -> UnitsNet mapper that already backs the
conversions, so a symbol and a conversion can never disagree about which UnitsNet unit a BHoM unit
is. Those 22 mappers move from private to internal so Query can reach them. internal
publishes nothing — the Grasshopper harvest keys off public static.

image

Test files

https://burohappold.sharepoint.com/:f:/r/sites/BHoM/02_Current/12_Scripts/02_Pull%20Request/BHoM/Localisation_Toolkit/Units_Engine/%23178-add-fromunitstring-and-tounitstring-extension-methods-to-bhengineunits?d=wa31dff9fd66d429d82862958d7784b0d&csf=1&web=1&e=oFSP83

Changelog

  • Added Query.UnitSymbol to Units_Engine, returning a unit's display symbol
  • Convert's per-quantity unit mappers are now internal rather than private

Additional comments

ToPressureUnit was the only mapper declared this object unit. Inert while private, but as
internal it would publish an extension method on object across the assembly, so the this is
removed. Both call sites already used static-call syntax.

@Chrisshort92
Chrisshort92 marked this pull request as ready for review September 4, 2026 11:52
@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check required

@bhombot-ci

bhombot-ci Bot commented Sep 4, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check code-compliance
  • check documentation-compliance
  • check project-compliance
  • check core
  • check null-handling
  • check serialisation
  • check versioning
  • check installer

There are 22 requests in the queue ahead of you.

Comment thread Units_Engine/Query/UnitSymbol.cs
@peterjamesnugent

Copy link
Copy Markdown
Member

@BHoMBot check versioning

@bhombot-ci

bhombot-ci Bot commented Sep 4, 2026

Copy link
Copy Markdown

@peterjamesnugent to confirm, the following actions are now queued:

  • check versioning

There are 18 requests in the queue ahead of you.

@peterjamesnugent

Copy link
Copy Markdown
Member

@BHoMBot check versioning

@bhombot-ci

bhombot-ci Bot commented Sep 4, 2026

Copy link
Copy Markdown

@peterjamesnugent to confirm, the following actions are now queued:

  • check versioning

There are 18 requests in the queue ahead of you.

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check installer

@bhombot-ci

bhombot-ci Bot commented Sep 7, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check installer

There are 18 requests in the queue ahead of you.

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check versioning

@bhombot-ci

bhombot-ci Bot commented Sep 7, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check versioning

There are 8 requests in the queue ahead of you.

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check versioning

@bhombot-ci

bhombot-ci Bot commented Sep 7, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check versioning

There are 9 requests in the queue ahead of you.

@bhombot-ci

bhombot-ci Bot commented Sep 7, 2026

Copy link
Copy Markdown

The check versioning has already been run previously and recorded as a successful check. This check has not been run again at this time.

@peterjamesnugent peterjamesnugent left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with the latest script, works for me.

@peterjamesnugent

Copy link
Copy Markdown
Member

@BHoMBot check ready-to-merge

@bhombot-ci

bhombot-ci Bot commented Sep 7, 2026

Copy link
Copy Markdown

@peterjamesnugent to confirm, the following actions are now queued:

  • check ready-to-merge

There are 2 requests in the queue ahead of you.

@peterjamesnugent
peterjamesnugent merged commit abca944 into develop Sep 7, 2026
21 checks passed
@peterjamesnugent
peterjamesnugent deleted the Units_Engine-#180-add-unitsymbol-and-refactor-convert-methods-to-internal-for-access branch September 7, 2026 15:04
@BHoMBot BHoMBot mentioned this pull request Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New capability or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add UnitSymbol.cs and refactor convert methods to internal for access

2 participants