Skip to content

Commit

Permalink
fix: add support for decimeters and centimeters
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Jul 4, 2024
1 parent 989be31 commit 722e8cb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components",
"description": "Collection of core functionalities to author BIM apps.",
"version": "2.0.22",
"version": "2.0.23",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/core/Components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Components implements Disposable {
/**
* The version of the @thatopen/components library.
*/
static readonly release = "2.0.22";
static readonly release = "2.0.23";

/** {@link Disposable.onDisposed} */
readonly onDisposed = new Event<void>();
Expand Down
8 changes: 7 additions & 1 deletion packages/core/src/fragments/IfcLoader/src/units.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ export class Units {
}
if (length.Name.value === "FOOT") {
this.factor = 0.3048;
} else if (length.Prefix?.value === "MILLI") {
}

if (length.Prefix?.value === "MILLI") {
this.complement = 0.001;
} else if (length.Prefix?.value === "CENTI") {
this.complement = 0.01;
} else if (length.Prefix?.value === "DECI") {
this.complement = 0.01;
}
}

Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/ifc/Utils/properties-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ export class IfcPropertiesUtils {
if (unit.Name.value === "FOOT") {
unitValue = 0.3048;
}

if (unit.Prefix?.value === "MILLI") {
factor = 0.001;
} else if (unit.Prefix?.value === "CENTI") {
factor = 0.01;
} else if (unit.Prefix?.value === "DECI") {
factor = 0.01;
}
return unitValue * factor;
}
Expand Down

0 comments on commit 722e8cb

Please sign in to comment.