dragonfly-schema 1.12.1-v10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/helpers/class-validator.ts +94 -0
  2. package/index.ts +1 -0
  3. package/models/Building.ts +98 -0
  4. package/models/BuildingEnergyPropertiesAbridged.ts +65 -0
  5. package/models/BuildingPropertiesAbridged.ts +73 -0
  6. package/models/BuildingRadiancePropertiesAbridged.ts +63 -0
  7. package/models/ContextShade.ts +83 -0
  8. package/models/ContextShadeEnergyPropertiesAbridged.ts +74 -0
  9. package/models/ContextShadePropertiesAbridged.ts +73 -0
  10. package/models/ContextShadeRadiancePropertiesAbridged.ts +63 -0
  11. package/models/DetailedSkylights.ts +73 -0
  12. package/models/DetailedWindows.ts +73 -0
  13. package/models/ExteriorApertureGridParameter.ts +74 -0
  14. package/models/ExteriorApertureType.ts +8 -0
  15. package/models/ExteriorFaceGridParameter.ts +82 -0
  16. package/models/ExteriorFaceType.ts +9 -0
  17. package/models/ExtrudedBorder.ts +63 -0
  18. package/models/GriddedSkylightArea.ts +71 -0
  19. package/models/GriddedSkylightRatio.ts +71 -0
  20. package/models/LouversByCount.ts +63 -0
  21. package/models/LouversByDistance.ts +63 -0
  22. package/models/Model.ts +125 -0
  23. package/models/ModelEnergyProperties.ts +606 -0
  24. package/models/ModelProperties.ts +73 -0
  25. package/models/ModelRadianceProperties.ts +253 -0
  26. package/models/Overhang.ts +73 -0
  27. package/models/RectangularWindows.ts +89 -0
  28. package/models/RepeatingWindowRatio.ts +94 -0
  29. package/models/RoofSpecification.ts +67 -0
  30. package/models/Room2D.ts +166 -0
  31. package/models/Room2DEnergyPropertiesAbridged.ts +123 -0
  32. package/models/Room2DPropertiesAbridged.ts +73 -0
  33. package/models/Room2DRadiancePropertiesAbridged.ts +74 -0
  34. package/models/RoomGridParameter.ts +72 -0
  35. package/models/RoomRadialGridParameter.ts +80 -0
  36. package/models/SimpleWindowArea.ts +71 -0
  37. package/models/SimpleWindowRatio.ts +71 -0
  38. package/models/SingleWindow.ts +78 -0
  39. package/models/Story.ts +111 -0
  40. package/models/StoryEnergyPropertiesAbridged.ts +65 -0
  41. package/models/StoryPropertiesAbridged.ts +73 -0
  42. package/models/StoryRadiancePropertiesAbridged.ts +63 -0
  43. package/models/_GridParameterBase.ts +71 -0
  44. package/models/_LouversBase.ts +99 -0
  45. package/models/_OpenAPIGenBaseModel.ts +38 -0
  46. package/models/_WindowParameterBase.ts +62 -0
  47. package/models/index.ts +46 -0
  48. package/package.json +28 -0
  49. package/tsconfig.json +32 -0
  50. package/vite.config.ts +14 -0
@@ -0,0 +1,63 @@
1
+ import { IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
4
+
5
+ /** Base class for all objects that are not extensible with additional keys.\n\nThis effectively includes all objects except for the Properties classes\nthat are assigned to geometry objects. */
6
+ export class ContextShadeRadiancePropertiesAbridged extends _OpenAPIGenBaseModel {
7
+ @IsString()
8
+ @IsOptional()
9
+ @Matches(/^ContextShadeRadiancePropertiesAbridged$/)
10
+ type?: string;
11
+
12
+ @IsString()
13
+ @IsOptional()
14
+ /** Name of a Modifier to set the reflectance and specularity of the ContextShade. If None, the the default of 0.2 diffuse reflectance will be used. */
15
+ modifier?: string;
16
+
17
+
18
+ constructor() {
19
+ super();
20
+ this.type = "ContextShadeRadiancePropertiesAbridged";
21
+ }
22
+
23
+
24
+ override init(_data?: any) {
25
+ super.init(_data);
26
+ if (_data) {
27
+ const obj = plainToClass(ContextShadeRadiancePropertiesAbridged, _data);
28
+ this.type = obj.type;
29
+ this.modifier = obj.modifier;
30
+ }
31
+ }
32
+
33
+
34
+ static override fromJS(data: any): ContextShadeRadiancePropertiesAbridged {
35
+ data = typeof data === 'object' ? data : {};
36
+
37
+ let result = new ContextShadeRadiancePropertiesAbridged();
38
+ result.init(data);
39
+ return result;
40
+ }
41
+
42
+ override toJSON(data?: any) {
43
+ data = typeof data === 'object' ? data : {};
44
+ for (var property in this) {
45
+ if (this.hasOwnProperty(property))
46
+ data[property] = this[property];
47
+ }
48
+
49
+ data["type"] = this.type;
50
+ data["modifier"] = this.modifier;
51
+ data = super.toJSON(data);
52
+ return instanceToPlain(data);
53
+ }
54
+
55
+ async validate(): Promise<boolean> {
56
+ const errors = await validate(this);
57
+ if (errors.length > 0){
58
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
59
+ throw new Error(`Validation failed: ${errorMessages}`);
60
+ }
61
+ return true;
62
+ }
63
+ }
@@ -0,0 +1,73 @@
1
+ import { IsArray, IsDefined, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { IsNestedNumberArray } from "./../helpers/class-validator";
4
+ import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
5
+
6
+ /** Several detailed skylights defined by 2D Polygons (lists of 2D vertices). */
7
+ export class DetailedSkylights extends _OpenAPIGenBaseModel {
8
+ @IsArray()
9
+ @IsNestedNumberArray()
10
+ @IsDefined()
11
+ /** An array of arrays with each sub-array representing a polygonal boundary of a skylight. Each sub-array should consist of arrays representing points, which contain 2 values for 2D coordinates in the world XY system. These coordinate values should lie within the parent Room2D Polygon. */
12
+ polygons!: number [] [] [];
13
+
14
+ @IsString()
15
+ @IsOptional()
16
+ @Matches(/^DetailedSkylights$/)
17
+ type?: string;
18
+
19
+ @IsArray()
20
+ @IsBoolean({ each: true })
21
+ @IsOptional()
22
+ /** An array of booleans that align with the polygons and note whether each of the polygons represents an overhead door (True) or a skylight (False). If None, it will be assumed that all polygons represent skylights and they will be translated to Apertures in any resulting Honeybee model. */
23
+ are_doors?: boolean [];
24
+
25
+
26
+ constructor() {
27
+ super();
28
+ this.type = "DetailedSkylights";
29
+ }
30
+
31
+
32
+ override init(_data?: any) {
33
+ super.init(_data);
34
+ if (_data) {
35
+ const obj = plainToClass(DetailedSkylights, _data);
36
+ this.polygons = obj.polygons;
37
+ this.type = obj.type;
38
+ this.are_doors = obj.are_doors;
39
+ }
40
+ }
41
+
42
+
43
+ static override fromJS(data: any): DetailedSkylights {
44
+ data = typeof data === 'object' ? data : {};
45
+
46
+ let result = new DetailedSkylights();
47
+ result.init(data);
48
+ return result;
49
+ }
50
+
51
+ override toJSON(data?: any) {
52
+ data = typeof data === 'object' ? data : {};
53
+ for (var property in this) {
54
+ if (this.hasOwnProperty(property))
55
+ data[property] = this[property];
56
+ }
57
+
58
+ data["polygons"] = this.polygons;
59
+ data["type"] = this.type;
60
+ data["are_doors"] = this.are_doors;
61
+ data = super.toJSON(data);
62
+ return instanceToPlain(data);
63
+ }
64
+
65
+ async validate(): Promise<boolean> {
66
+ const errors = await validate(this);
67
+ if (errors.length > 0){
68
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
69
+ throw new Error(`Validation failed: ${errorMessages}`);
70
+ }
71
+ return true;
72
+ }
73
+ }
@@ -0,0 +1,73 @@
1
+ import { IsArray, IsDefined, IsString, IsOptional, Matches, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { IsNestedNumberArray } from "./../helpers/class-validator";
4
+ import { _WindowParameterBase } from "./_WindowParameterBase";
5
+
6
+ /** Several detailed windows defined by 2D Polygons (lists of 2D vertices). */
7
+ export class DetailedWindows extends _WindowParameterBase {
8
+ @IsArray()
9
+ @IsNestedNumberArray()
10
+ @IsDefined()
11
+ /** An array of arrays with each sub-array representing a polygonal boundary of a window. Each sub-array should consist of arrays representing points, which can either contain 2 values (indicating they are 2D vertices within the plane of a parent wall segment) or they can contain 3 values (indicating they are 3D world coordinates). For 2D points, the wall plane is assumed to have an origin at the first point of the wall segment and an X-axis extending along the length of the segment. The wall plane Y-axis always points upwards. Therefore, both X and Y values of each point in the polygon should always be positive. Some sample code to convert from 2D vertices to 2D vertices in the plane of the wall can be found here: https://www.ladybug.tools/dragonfly-core/docs/dragonfly.windowparameter.html#dragonfly.windowparameter.DetailedWindows */
12
+ polygons!: number [] [] [];
13
+
14
+ @IsString()
15
+ @IsOptional()
16
+ @Matches(/^DetailedWindows$/)
17
+ type?: string;
18
+
19
+ @IsArray()
20
+ @IsBoolean({ each: true })
21
+ @IsOptional()
22
+ /** An array of booleans that align with the polygons and note whether each of the polygons represents a door (True) or a window (False). If None, it will be assumed that all polygons represent windows and they will be translated to Apertures in any resulting Honeybee model. */
23
+ are_doors?: boolean [];
24
+
25
+
26
+ constructor() {
27
+ super();
28
+ this.type = "DetailedWindows";
29
+ }
30
+
31
+
32
+ override init(_data?: any) {
33
+ super.init(_data);
34
+ if (_data) {
35
+ const obj = plainToClass(DetailedWindows, _data);
36
+ this.polygons = obj.polygons;
37
+ this.type = obj.type;
38
+ this.are_doors = obj.are_doors;
39
+ }
40
+ }
41
+
42
+
43
+ static override fromJS(data: any): DetailedWindows {
44
+ data = typeof data === 'object' ? data : {};
45
+
46
+ let result = new DetailedWindows();
47
+ result.init(data);
48
+ return result;
49
+ }
50
+
51
+ override toJSON(data?: any) {
52
+ data = typeof data === 'object' ? data : {};
53
+ for (var property in this) {
54
+ if (this.hasOwnProperty(property))
55
+ data[property] = this[property];
56
+ }
57
+
58
+ data["polygons"] = this.polygons;
59
+ data["type"] = this.type;
60
+ data["are_doors"] = this.are_doors;
61
+ data = super.toJSON(data);
62
+ return instanceToPlain(data);
63
+ }
64
+
65
+ async validate(): Promise<boolean> {
66
+ const errors = await validate(this);
67
+ if (errors.length > 0){
68
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
69
+ throw new Error(`Validation failed: ${errorMessages}`);
70
+ }
71
+ return true;
72
+ }
73
+ }
@@ -0,0 +1,74 @@
1
+ import { IsString, IsOptional, Matches, IsNumber, IsEnum, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { _GridParameterBase } from "./_GridParameterBase";
4
+ import { ExteriorApertureType } from "./ExteriorApertureType";
5
+
6
+ /** Instructions for a SensorGrid generated from exterior Aperture. */
7
+ export class ExteriorApertureGridParameter extends _GridParameterBase {
8
+ @IsString()
9
+ @IsOptional()
10
+ @Matches(/^ExteriorApertureGridParameter$/)
11
+ type?: string;
12
+
13
+ @IsNumber()
14
+ @IsOptional()
15
+ /** A number for how far to offset the grid from the Apertures. (Default: 0.1, suitable for Models in Meters). */
16
+ offset?: number;
17
+
18
+ @IsEnum(ExteriorApertureType)
19
+ @Type(() => String)
20
+ @IsOptional()
21
+ /** Text to specify the type of Aperture that will be used to generate grids. Window indicates Apertures in Walls. Skylights are in parent Roof faces. */
22
+ aperture_type?: ExteriorApertureType;
23
+
24
+
25
+ constructor() {
26
+ super();
27
+ this.type = "ExteriorApertureGridParameter";
28
+ this.offset = 0.1;
29
+ this.aperture_type = ExteriorApertureType.All;
30
+ }
31
+
32
+
33
+ override init(_data?: any) {
34
+ super.init(_data);
35
+ if (_data) {
36
+ const obj = plainToClass(ExteriorApertureGridParameter, _data);
37
+ this.type = obj.type;
38
+ this.offset = obj.offset;
39
+ this.aperture_type = obj.aperture_type;
40
+ }
41
+ }
42
+
43
+
44
+ static override fromJS(data: any): ExteriorApertureGridParameter {
45
+ data = typeof data === 'object' ? data : {};
46
+
47
+ let result = new ExteriorApertureGridParameter();
48
+ result.init(data);
49
+ return result;
50
+ }
51
+
52
+ override toJSON(data?: any) {
53
+ data = typeof data === 'object' ? data : {};
54
+ for (var property in this) {
55
+ if (this.hasOwnProperty(property))
56
+ data[property] = this[property];
57
+ }
58
+
59
+ data["type"] = this.type;
60
+ data["offset"] = this.offset;
61
+ data["aperture_type"] = this.aperture_type;
62
+ data = super.toJSON(data);
63
+ return instanceToPlain(data);
64
+ }
65
+
66
+ async validate(): Promise<boolean> {
67
+ const errors = await validate(this);
68
+ if (errors.length > 0){
69
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
70
+ throw new Error(`Validation failed: ${errorMessages}`);
71
+ }
72
+ return true;
73
+ }
74
+ }
@@ -0,0 +1,8 @@
1
+ // Auto-generated
2
+
3
+ /** An enumeration. */
4
+ export enum ExteriorApertureType {
5
+ Window = "Window",
6
+ Skylight = "Skylight",
7
+ All = "All",
8
+ }
@@ -0,0 +1,82 @@
1
+ import { IsString, IsOptional, Matches, IsNumber, IsEnum, IsBoolean, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { _GridParameterBase } from "./_GridParameterBase";
4
+ import { ExteriorFaceType } from "./ExteriorFaceType";
5
+
6
+ /** Instructions for a SensorGrid generated from exterior Faces. */
7
+ export class ExteriorFaceGridParameter extends _GridParameterBase {
8
+ @IsString()
9
+ @IsOptional()
10
+ @Matches(/^ExteriorFaceGridParameter$/)
11
+ type?: string;
12
+
13
+ @IsNumber()
14
+ @IsOptional()
15
+ /** A number for how far to offset the grid from the Faces. (Default: 0.1, suitable for Models in Meters). */
16
+ offset?: number;
17
+
18
+ @IsEnum(ExteriorFaceType)
19
+ @Type(() => String)
20
+ @IsOptional()
21
+ /** Text to specify the type of face that will be used to generate grids. Note that only Faces with Outdoors boundary conditions will be used, meaning that most Floors will typically be excluded unless they represent the underside of a cantilever. */
22
+ face_type?: ExteriorFaceType;
23
+
24
+ @IsBoolean()
25
+ @IsOptional()
26
+ /** A boolean to note whether the punched_geometry of the faces should be used (True) with the areas of sub-faces removed from the grid or the full geometry should be used (False). */
27
+ punched_geometry?: boolean;
28
+
29
+
30
+ constructor() {
31
+ super();
32
+ this.type = "ExteriorFaceGridParameter";
33
+ this.offset = 0.1;
34
+ this.face_type = ExteriorFaceType.Wall;
35
+ this.punched_geometry = false;
36
+ }
37
+
38
+
39
+ override init(_data?: any) {
40
+ super.init(_data);
41
+ if (_data) {
42
+ const obj = plainToClass(ExteriorFaceGridParameter, _data);
43
+ this.type = obj.type;
44
+ this.offset = obj.offset;
45
+ this.face_type = obj.face_type;
46
+ this.punched_geometry = obj.punched_geometry;
47
+ }
48
+ }
49
+
50
+
51
+ static override fromJS(data: any): ExteriorFaceGridParameter {
52
+ data = typeof data === 'object' ? data : {};
53
+
54
+ let result = new ExteriorFaceGridParameter();
55
+ result.init(data);
56
+ return result;
57
+ }
58
+
59
+ override toJSON(data?: any) {
60
+ data = typeof data === 'object' ? data : {};
61
+ for (var property in this) {
62
+ if (this.hasOwnProperty(property))
63
+ data[property] = this[property];
64
+ }
65
+
66
+ data["type"] = this.type;
67
+ data["offset"] = this.offset;
68
+ data["face_type"] = this.face_type;
69
+ data["punched_geometry"] = this.punched_geometry;
70
+ data = super.toJSON(data);
71
+ return instanceToPlain(data);
72
+ }
73
+
74
+ async validate(): Promise<boolean> {
75
+ const errors = await validate(this);
76
+ if (errors.length > 0){
77
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
78
+ throw new Error(`Validation failed: ${errorMessages}`);
79
+ }
80
+ return true;
81
+ }
82
+ }
@@ -0,0 +1,9 @@
1
+ // Auto-generated
2
+
3
+ /** An enumeration. */
4
+ export enum ExteriorFaceType {
5
+ Wall = "Wall",
6
+ Roof = "Roof",
7
+ Floor = "Floor",
8
+ All = "All",
9
+ }
@@ -0,0 +1,63 @@
1
+ import { IsNumber, IsDefined, IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
4
+
5
+ /** Extruded borders over all windows in the wall. */
6
+ export class ExtrudedBorder extends _OpenAPIGenBaseModel {
7
+ @IsNumber()
8
+ @IsDefined()
9
+ /** A number for the depth of the border. */
10
+ depth!: number;
11
+
12
+ @IsString()
13
+ @IsOptional()
14
+ @Matches(/^ExtrudedBorder$/)
15
+ type?: string;
16
+
17
+
18
+ constructor() {
19
+ super();
20
+ this.type = "ExtrudedBorder";
21
+ }
22
+
23
+
24
+ override init(_data?: any) {
25
+ super.init(_data);
26
+ if (_data) {
27
+ const obj = plainToClass(ExtrudedBorder, _data);
28
+ this.depth = obj.depth;
29
+ this.type = obj.type;
30
+ }
31
+ }
32
+
33
+
34
+ static override fromJS(data: any): ExtrudedBorder {
35
+ data = typeof data === 'object' ? data : {};
36
+
37
+ let result = new ExtrudedBorder();
38
+ result.init(data);
39
+ return result;
40
+ }
41
+
42
+ override toJSON(data?: any) {
43
+ data = typeof data === 'object' ? data : {};
44
+ for (var property in this) {
45
+ if (this.hasOwnProperty(property))
46
+ data[property] = this[property];
47
+ }
48
+
49
+ data["depth"] = this.depth;
50
+ data["type"] = this.type;
51
+ data = super.toJSON(data);
52
+ return instanceToPlain(data);
53
+ }
54
+
55
+ async validate(): Promise<boolean> {
56
+ const errors = await validate(this);
57
+ if (errors.length > 0){
58
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
59
+ throw new Error(`Validation failed: ${errorMessages}`);
60
+ }
61
+ return true;
62
+ }
63
+ }
@@ -0,0 +1,71 @@
1
+ import { IsNumber, IsDefined, IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
4
+ import { Autocalculate } from "honeybee-schema";
5
+
6
+ /** Gridded skylights defined by an absolute area. */
7
+ export class GriddedSkylightArea extends _OpenAPIGenBaseModel {
8
+ @IsNumber()
9
+ @IsDefined()
10
+ /** A number for the skylight area in current model units. If this area is larger than the area of the roof that it is applied to, the skylight will fill the parent roof at a 99 percent ratio. */
11
+ skylight_area!: number;
12
+
13
+ @IsString()
14
+ @IsOptional()
15
+ @Matches(/^GriddedSkylightArea$/)
16
+ type?: string;
17
+
18
+ @IsOptional()
19
+ /** A number for the spacing between the centers of each grid cell. This should be less than a third of the dimension of the Roof geometry if multiple, evenly-spaced skylights are desired. If Autocalculate, a spacing of one third the smaller dimension of the parent Roof will be automatically assumed. */
20
+ spacing?: (Autocalculate | number);
21
+
22
+
23
+ constructor() {
24
+ super();
25
+ this.type = "GriddedSkylightArea";
26
+ this.spacing = new Autocalculate();
27
+ }
28
+
29
+
30
+ override init(_data?: any) {
31
+ super.init(_data);
32
+ if (_data) {
33
+ const obj = plainToClass(GriddedSkylightArea, _data);
34
+ this.skylight_area = obj.skylight_area;
35
+ this.type = obj.type;
36
+ this.spacing = obj.spacing;
37
+ }
38
+ }
39
+
40
+
41
+ static override fromJS(data: any): GriddedSkylightArea {
42
+ data = typeof data === 'object' ? data : {};
43
+
44
+ let result = new GriddedSkylightArea();
45
+ result.init(data);
46
+ return result;
47
+ }
48
+
49
+ override toJSON(data?: any) {
50
+ data = typeof data === 'object' ? data : {};
51
+ for (var property in this) {
52
+ if (this.hasOwnProperty(property))
53
+ data[property] = this[property];
54
+ }
55
+
56
+ data["skylight_area"] = this.skylight_area;
57
+ data["type"] = this.type;
58
+ data["spacing"] = this.spacing;
59
+ data = super.toJSON(data);
60
+ return instanceToPlain(data);
61
+ }
62
+
63
+ async validate(): Promise<boolean> {
64
+ const errors = await validate(this);
65
+ if (errors.length > 0){
66
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
67
+ throw new Error(`Validation failed: ${errorMessages}`);
68
+ }
69
+ return true;
70
+ }
71
+ }
@@ -0,0 +1,71 @@
1
+ import { IsNumber, IsDefined, IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { _OpenAPIGenBaseModel } from "./_OpenAPIGenBaseModel";
4
+ import { Autocalculate } from "honeybee-schema";
5
+
6
+ /** Gridded skylights derived from an area ratio with the roof. */
7
+ export class GriddedSkylightRatio extends _OpenAPIGenBaseModel {
8
+ @IsNumber()
9
+ @IsDefined()
10
+ /** A number between 0 and 1 for the ratio between the skylight area and the total Roof face area. */
11
+ skylight_ratio!: number;
12
+
13
+ @IsString()
14
+ @IsOptional()
15
+ @Matches(/^GriddedSkylightRatio$/)
16
+ type?: string;
17
+
18
+ @IsOptional()
19
+ /** A number for the spacing between the centers of each grid cell. This should be less than a third of the dimension of the Roof geometry if multiple, evenly-spaced skylights are desired. If Autocalculate, a spacing of one third the smaller dimension of the parent Roof will be automatically assumed. */
20
+ spacing?: (Autocalculate | number);
21
+
22
+
23
+ constructor() {
24
+ super();
25
+ this.type = "GriddedSkylightRatio";
26
+ this.spacing = new Autocalculate();
27
+ }
28
+
29
+
30
+ override init(_data?: any) {
31
+ super.init(_data);
32
+ if (_data) {
33
+ const obj = plainToClass(GriddedSkylightRatio, _data);
34
+ this.skylight_ratio = obj.skylight_ratio;
35
+ this.type = obj.type;
36
+ this.spacing = obj.spacing;
37
+ }
38
+ }
39
+
40
+
41
+ static override fromJS(data: any): GriddedSkylightRatio {
42
+ data = typeof data === 'object' ? data : {};
43
+
44
+ let result = new GriddedSkylightRatio();
45
+ result.init(data);
46
+ return result;
47
+ }
48
+
49
+ override toJSON(data?: any) {
50
+ data = typeof data === 'object' ? data : {};
51
+ for (var property in this) {
52
+ if (this.hasOwnProperty(property))
53
+ data[property] = this[property];
54
+ }
55
+
56
+ data["skylight_ratio"] = this.skylight_ratio;
57
+ data["type"] = this.type;
58
+ data["spacing"] = this.spacing;
59
+ data = super.toJSON(data);
60
+ return instanceToPlain(data);
61
+ }
62
+
63
+ async validate(): Promise<boolean> {
64
+ const errors = await validate(this);
65
+ if (errors.length > 0){
66
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
67
+ throw new Error(`Validation failed: ${errorMessages}`);
68
+ }
69
+ return true;
70
+ }
71
+ }
@@ -0,0 +1,63 @@
1
+ import { IsInt, IsDefined, IsString, IsOptional, Matches, validate, ValidationError as TsValidationError } from 'class-validator';
2
+ import { Type, plainToClass, instanceToPlain } from 'class-transformer';
3
+ import { _LouversBase } from "./_LouversBase";
4
+
5
+ /** A specific number of louvered Shades over a wall. */
6
+ export class LouversByCount extends _LouversBase {
7
+ @IsInt()
8
+ @IsDefined()
9
+ /** A positive integer for the number of louvers to generate. */
10
+ louver_count!: number;
11
+
12
+ @IsString()
13
+ @IsOptional()
14
+ @Matches(/^LouversByCount$/)
15
+ type?: string;
16
+
17
+
18
+ constructor() {
19
+ super();
20
+ this.type = "LouversByCount";
21
+ }
22
+
23
+
24
+ override init(_data?: any) {
25
+ super.init(_data);
26
+ if (_data) {
27
+ const obj = plainToClass(LouversByCount, _data);
28
+ this.louver_count = obj.louver_count;
29
+ this.type = obj.type;
30
+ }
31
+ }
32
+
33
+
34
+ static override fromJS(data: any): LouversByCount {
35
+ data = typeof data === 'object' ? data : {};
36
+
37
+ let result = new LouversByCount();
38
+ result.init(data);
39
+ return result;
40
+ }
41
+
42
+ override toJSON(data?: any) {
43
+ data = typeof data === 'object' ? data : {};
44
+ for (var property in this) {
45
+ if (this.hasOwnProperty(property))
46
+ data[property] = this[property];
47
+ }
48
+
49
+ data["louver_count"] = this.louver_count;
50
+ data["type"] = this.type;
51
+ data = super.toJSON(data);
52
+ return instanceToPlain(data);
53
+ }
54
+
55
+ async validate(): Promise<boolean> {
56
+ const errors = await validate(this);
57
+ if (errors.length > 0){
58
+ const errorMessages = errors.map((error: TsValidationError) => Object.values(error.constraints || [error]).join(', ')).join('; ');
59
+ throw new Error(`Validation failed: ${errorMessages}`);
60
+ }
61
+ return true;
62
+ }
63
+ }