Skip to content

Commit 289309c

Browse files
committed
Add new profile types
1 parent a2a89cb commit 289309c

File tree

5 files changed

+83
-49
lines changed

5 files changed

+83
-49
lines changed

src/cpp/wasm/web-ifc-wasm.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "../web-ifc/geometry/operations/bim-geometry/alignment.h"
2424
#include "../web-ifc/geometry/operations/bim-geometry/utils.h"
2525
#include "../web-ifc/geometry/operations/bim-geometry/boolean.h"
26-
#include "../web-ifc/geometry/operations/bim-geometry/ProfileI.h"
26+
#include "../web-ifc/geometry/operations/bim-geometry/Profile.h"
2727

2828
namespace webifc::parsing {
2929
void p21encode(std::string_view input, std::ostringstream &output);
@@ -844,9 +844,9 @@ bimGeometry::Boolean CreateBoolean()
844844
return bimGeometry::Boolean();
845845
}
846846

847-
bimGeometry::ProfileI CreateProfileI()
847+
bimGeometry::Profile CreateProfile()
848848
{
849-
return bimGeometry::ProfileI();
849+
return bimGeometry::Profile();
850850
}
851851

852852
EMSCRIPTEN_BINDINGS(my_module) {
@@ -1043,10 +1043,10 @@ EMSCRIPTEN_BINDINGS(my_module) {
10431043
.function("clear", &bimGeometry::Boolean::clear)
10441044
;
10451045

1046-
emscripten::class_<bimGeometry::ProfileI>("ProfileI")
1046+
emscripten::class_<bimGeometry::Profile>("Profile")
10471047
.constructor<>()
1048-
.function("GetBuffers", &bimGeometry::ProfileI::GetBuffers)
1049-
.function("SetValues", &bimGeometry::ProfileI::SetValues)
1048+
.function("GetBuffers", &bimGeometry::Profile::GetBuffers)
1049+
.function("SetValues", &bimGeometry::Profile::SetValues)
10501050
;
10511051

10521052
emscripten::function("CreateAABB", &CreateAABB);
@@ -1060,7 +1060,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
10601060
emscripten::function("CreateArc", &CreateArc);
10611061
emscripten::function("CreateAlignment", &CreateAlignment);
10621062
emscripten::function("CreateBooleanOperator", &CreateBoolean);
1063-
emscripten::function("CreateProfileI", &CreateProfileI);
1063+
emscripten::function("CreateProfile", &CreateProfile);
10641064
emscripten::function("LoadAllGeometry", &LoadAllGeometry);
10651065
emscripten::function("GetAllCrossSections", &GetAllCrossSections);
10661066
emscripten::function("GetAllAlignments", &GetAllAlignments);
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#include <vector>
2+
#include <algorithm>
3+
#include <glm/glm.hpp>
4+
#include "profile.h"
5+
#include "utils.h"
6+
#include "epsilons.h"
7+
8+
namespace bimGeometry
9+
{
10+
void Profile::SetValues(uint16_t _pType, double _width, double _depth, double _webThickness, double _flangeThickness, bool _hasFillet, double _filletRadius, double _radius, double _slope, std::vector<double> _placement) {
11+
pType = _pType;
12+
width = _width;
13+
depth = _depth;
14+
thickness = _webThickness;
15+
flangeThickness = _flangeThickness;
16+
hasFillet = _hasFillet;
17+
filletRadius = _filletRadius;
18+
radius = _radius;
19+
slope = _slope;
20+
placement = _placement;
21+
}
22+
23+
Buffers Profile::GetBuffers()
24+
{
25+
Buffers buffers;
26+
glm::dmat4 _placement = glm::dmat4(glm::dvec4(placement[0],placement[1],placement[2], 1),
27+
glm::dvec4(placement[3],placement[4],placement[5], 1),
28+
glm::dvec4(placement[6],placement[7],placement[8], 1),
29+
glm::dvec4(placement[9],placement[10],placement[11], 1));
30+
31+
if(pType == 0)
32+
{
33+
profile = bimGeometry::GetIShapedCurve(width, depth, thickness, flangeThickness, hasFillet, filletRadius, _placement);
34+
}
35+
if(pType == 1)
36+
{
37+
profile = bimGeometry::GetCShapedCurve(width, depth, thickness, flangeThickness, hasFillet, filletRadius, _placement);
38+
}
39+
if(pType == 2)
40+
{
41+
profile = bimGeometry::GetZShapedCurve(width, depth, thickness, flangeThickness, hasFillet, filletRadius, _placement);
42+
}
43+
if(pType == 3)
44+
{
45+
profile = bimGeometry::GetTShapedCurve(width, depth, thickness, hasFillet, filletRadius, radius, slope, _placement);
46+
}
47+
if(pType == 4)
48+
{
49+
profile = bimGeometry::GetLShapedCurve(width, depth, thickness, hasFillet, filletRadius, radius, slope, _placement);
50+
}
51+
if(pType == 5)
52+
{
53+
profile = bimGeometry::GetUShapedCurve(width, depth, thickness, flangeThickness, filletRadius, radius, slope, _placement);
54+
}
55+
56+
57+
for (int r = 0; r < profile.points.size(); r++)
58+
{
59+
buffers.AddPoint( profile.points[r]);
60+
}
61+
62+
return buffers;
63+
}
64+
}

src/cpp/web-ifc/geometry/operations/bim-geometry/profileI.h renamed to src/cpp/web-ifc/geometry/operations/bim-geometry/profile.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@
77
#pragma once
88

99
namespace bimGeometry {
10-
struct ProfileI
10+
struct Profile
1111
{
12+
uint16_t pType;
1213
double width;
1314
double depth;
14-
double webThickness;
15+
double thickness;
1516
double flangeThickness;
1617
bool hasFillet;
1718
double filletRadius;
19+
double radius;
20+
double slope;
1821
std::vector<double> placement;
1922
Curve profile;
2023

21-
void SetValues(double width, double depth, double webThickness, double flangeThickness, bool hasFillet, double filletRadius, std::vector<double> placement);
24+
void SetValues(uint16_t _pType, double _width, double _depth, double _webThickness, double _flangeThickness, bool _hasFillet, double _filletRadius, double _radius, double _slope, std::vector<double> _placement);
2225
Buffers GetBuffers();
2326
};
2427
}

src/cpp/web-ifc/geometry/operations/bim-geometry/profileI.cpp

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/ts/web-ifc-api.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,18 @@ export interface BooleanOperator {
252252
clear(): void;
253253
}
254254

255-
export interface ProfileI {
255+
export interface ProfileSection {
256256
GetBuffers(): Buffers;
257257
SetValues(
258+
pType: number,
258259
width: number,
259260
depth: number,
260261
webThickness: number,
261262
flangeThickness: number,
262263
hasFillet: boolean,
263264
filletRadius: number,
265+
radius: number,
266+
slope: number,
264267
placement: Array<number>): void;
265268
}
266269

@@ -597,9 +600,9 @@ export class IfcAPI {
597600
return this.wasmModule.CreateBooleanOperator();
598601
}
599602

600-
CreateProfileI()
603+
CreateProfile()
601604
{
602-
return this.wasmModule.CreateProfileI();
605+
return this.wasmModule.CreateProfile();
603606
}
604607

605608
/**

0 commit comments

Comments
 (0)