Skip to content

Commit

Permalink
chore: apply eslint to repo
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Sep 26, 2024
1 parent 7240dbd commit fc170a6
Show file tree
Hide file tree
Showing 37 changed files with 131 additions and 127 deletions.
4 changes: 2 additions & 2 deletions packages/clay/src/base/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class Model {
this._modelID = this.ifcAPI.CreateModel({ schema: WEBIFC.Schemas.IFC4X3 });
this._context = new WEBIFC.IFC4X3.IfcRepresentationContext(
new WEBIFC.IFC4X3.IfcLabel("Default"),
new WEBIFC.IFC4X3.IfcLabel("Model")
new WEBIFC.IFC4X3.IfcLabel("Model"),
);
}

Expand All @@ -45,7 +45,7 @@ export class Model {

delete(
item: WEBIFC.IfcLineObject | WEBIFC.Handle<IfcLineObject> | null,
recursive = false
recursive = false,
) {
if (item === null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class SimpleCurtainWall extends Element {
placement,
type.shape,
null,
null
null,
);

this.model.set(this.attributes);
Expand Down
2 changes: 1 addition & 1 deletion packages/clay/src/elements/CurtainWalls/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./SimpleCurtainWall"
export * from "./SimpleCurtainWall";
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Element } from "../Element";
import { ElementType } from "../ElementType";

export abstract class DynamicElementType<
T extends Element
T extends Element,
> extends ElementType {
abstract attributes: IFC.IfcElementType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export class SimpleFurnitureType extends StaticElementType<SimpleFurniture> {
constructor(model: Model) {
super(model);


this.body = new Brep(model);
const id = this.body.attributes.expressID;
this.geometries.set(id, this.body);
Expand All @@ -36,7 +35,7 @@ export class SimpleFurnitureType extends StaticElementType<SimpleFurniture> {
null,
null,
null,
null
null,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class SimpleFurniture extends Element {
null,
placement,
type.shape,
null
null,
);

this.model.set(this.attributes);
Expand Down
6 changes: 3 additions & 3 deletions packages/clay/src/elements/Members/SimpleMember/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { SimpleMember } from "./src";

export class SimpleMemberType extends DynamicElementType<SimpleMember> {
attributes: IFC.IfcMemberType;
memberType: IFC.IfcMemberTypeEnum

memberType: IFC.IfcMemberTypeEnum;

constructor(model: Model) {
super(model);

this.memberType = IFC.IfcMemberTypeEnum.MULLION
this.memberType = IFC.IfcMemberTypeEnum.MULLION;

this.attributes = new IFC.IfcMemberType(
new IFC.IfcGloballyUniqueId(uuidv4()),
Expand Down
6 changes: 3 additions & 3 deletions packages/clay/src/elements/Members/SimpleMember/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { IFC4X3 as IFC } from "web-ifc";
import { v4 as uuidv4 } from "uuid";
import * as THREE from "three";
import { Element } from "../../../Elements";
import { Model } from "../../../../base";
import { SimpleMemberType } from "..";
import { v4 as uuidv4 } from "uuid";
import { IfcUtils } from "../../../../utils/ifc-utils";
import { Extrusion, RectangleProfile } from "../../../../geometries";
import * as THREE from "three";

export class SimpleMember extends Element {
attributes: IFC.IfcMember;
Expand Down Expand Up @@ -44,7 +44,7 @@ export class SimpleMember extends Element {
placement,
IfcUtils.productDefinitionShape(model, [this.body.attributes]),
null,
type.memberType
type.memberType,
);
this.model.set(this.attributes);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/clay/src/elements/Members/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./SimpleMember"
export * from "./SimpleMember";
2 changes: 1 addition & 1 deletion packages/clay/src/elements/Openings/SimpleOpening/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class SimpleOpeningType extends StaticElementType<SimpleOpening> {
null,
null,
null,
null
null,
);

this.model.set(this.attributes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class SimpleOpening extends Element {
placement,
type.shape,
null,
null
null,
);

this.model.set(this.attributes);
Expand Down
6 changes: 3 additions & 3 deletions packages/clay/src/elements/Plates/SimplePlate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { SimplePlate } from "./src";

export class SimplePlateType extends DynamicElementType<SimplePlate> {
attributes: IFC.IfcPlateType;
plateType: IFC.IfcPlateTypeEnum

plateType: IFC.IfcPlateTypeEnum;

constructor(model: Model) {
super(model);

this.plateType = IFC.IfcPlateTypeEnum.CURTAIN_PANEL
this.plateType = IFC.IfcPlateTypeEnum.CURTAIN_PANEL;

this.attributes = new IFC.IfcPlateType(
new IFC.IfcGloballyUniqueId(uuidv4()),
Expand Down
82 changes: 40 additions & 42 deletions packages/clay/src/elements/Plates/SimplePlate/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,51 +1,49 @@
import { IFC4X3 as IFC } from "web-ifc";
import { v4 as uuidv4 } from "uuid";
import * as THREE from "three";
import { Element } from "../../../Elements";
import { Model } from "../../../../base";
import { SimplePlateType } from "..";
import { v4 as uuidv4 } from "uuid";
import { IfcUtils } from "../../../../utils/ifc-utils";
import { Extrusion, RectangleProfile } from "../../../../geometries";
import * as THREE from "three";

export class SimplePlate extends Element {
attributes: IFC.IfcPlate;

body: Extrusion<RectangleProfile>;

type: SimplePlateType

constructor(model: Model, type: SimplePlateType) {
super(model, type)
this.type = type

const placement = IfcUtils.localPlacement();

const profile = new RectangleProfile(model);
profile.dimension.x = 0.0833333333333333
profile.dimension.y = 1.9238
profile.dimension.z = 1
profile.position = new THREE.Vector3(0,0,0)
profile.update();

this.body = new Extrusion(model, profile);
const id = this.body.attributes.expressID;
this.type.geometries.set(id, this.body);
this.geometries.add(id);


this.attributes = new IFC.IfcPlate(
new IFC.IfcGloballyUniqueId(uuidv4()),
null,
null,
null,
null,
placement,
IfcUtils.productDefinitionShape(model, [this.body.attributes]),
null,
type.plateType,
)

this.model.set(this.attributes);
}

attributes: IFC.IfcPlate;

body: Extrusion<RectangleProfile>;

type: SimplePlateType;

constructor(model: Model, type: SimplePlateType) {
super(model, type);
this.type = type;

const placement = IfcUtils.localPlacement();

const profile = new RectangleProfile(model);
profile.dimension.x = 0.0833333333333333;
profile.dimension.y = 1.9238;
profile.dimension.z = 1;
profile.position = new THREE.Vector3(0, 0, 0);
profile.update();

this.body = new Extrusion(model, profile);
const id = this.body.attributes.expressID;
this.type.geometries.set(id, this.body);
this.geometries.add(id);

this.attributes = new IFC.IfcPlate(
new IFC.IfcGloballyUniqueId(uuidv4()),
null,
null,
null,
null,
placement,
IfcUtils.productDefinitionShape(model, [this.body.attributes]),
null,
type.plateType,
);

this.model.set(this.attributes);
}
}
4 changes: 2 additions & 2 deletions packages/clay/src/elements/Slabs/SimpleSlab/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export * from "./src";

export class SimpleSlabType extends DynamicElementType<SimpleSlab> {
attributes: IFC4X3.IfcSlabType;

constructor(model: Model) {
super(model);

Expand All @@ -22,7 +22,7 @@ export class SimpleSlabType extends DynamicElementType<SimpleSlab> {
null,
null,
null,
IFC.IfcSlabTypeEnum.FLOOR
IFC.IfcSlabTypeEnum.FLOOR,
);
}

Expand Down
8 changes: 5 additions & 3 deletions packages/clay/src/elements/Slabs/SimpleSlab/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ export class SimpleSlab extends Element {
constructor(model: Model, type: SimpleSlabType) {
super(model, type);
this.type = type;

this.body = new Extrusion(model, new ArbitraryClosedProfile(model));
const id = this.body.attributes.expressID;
this.type.geometries.set(id, this.body);
this.geometries.add(id);

const placement = IfcUtils.localPlacement();
const shape = IfcUtils.productDefinitionShape(model, [this.body.attributes]);
const shape = IfcUtils.productDefinitionShape(model, [
this.body.attributes,
]);

this.attributes = new IFC.IfcSlab(
new IFC.IfcGloballyUniqueId(uuidv4()),
Expand All @@ -37,7 +39,7 @@ export class SimpleSlab extends Element {
placement,
shape,
null,
null
null,
);

this.model.set(this.attributes);
Expand Down
2 changes: 1 addition & 1 deletion packages/clay/src/elements/Walls/SimpleWall/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class SimpleWallType extends DynamicElementType<SimpleWall> {
null,
null,
null,
IFC.IfcWallTypeEnum.STANDARD
IFC.IfcWallTypeEnum.STANDARD,
);
}

Expand Down
18 changes: 9 additions & 9 deletions packages/clay/src/elements/Walls/SimpleWall/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class SimpleWall extends Element {
return new THREE.Vector3(
(this.startPoint.x + this.endPoint.x) / 2,
(this.startPoint.y + this.endPoint.y) / 2,
(this.startPoint.z + this.endPoint.z) / 2
(this.startPoint.z + this.endPoint.z) / 2,
);
}

Expand Down Expand Up @@ -78,7 +78,7 @@ export class SimpleWall extends Element {
placement,
shape,
null,
null
null,
);

this.model.set(this.attributes);
Expand Down Expand Up @@ -116,24 +116,24 @@ export class SimpleWall extends Element {
const correctedNormalVector = new THREE.Vector3(
normalVector.x,
normalVector.z,
normalVector.y * -1
normalVector.y * -1,
);

const coplanarPoint = new THREE.Vector3(
wall.startPoint.x,
wall.startPoint.z,
wall.startPoint.y * -1
wall.startPoint.y * -1,
);

const plane = new THREE.Plane().setFromNormalAndCoplanarPoint(
correctedNormalVector,
coplanarPoint
coplanarPoint,
);

const correctedDirection = new THREE.Vector3(
this.direction.x * -1,
this.direction.z,
this.direction.y
this.direction.y,
);

if (atTheEndPoint) correctedDirection.negate();
Expand All @@ -145,14 +145,14 @@ export class SimpleWall extends Element {
const rayAxisWall1 = new THREE.Ray(rayOriginPoint, correctedDirection);
const intersectionPoint = rayAxisWall1.intersectPlane(
plane,
new THREE.Vector3()
new THREE.Vector3(),
);

if (intersectionPoint) {
const correctedIntersectionPoint = new THREE.Vector3(
intersectionPoint?.x,
intersectionPoint?.z * -1,
intersectionPoint?.y
intersectionPoint?.y,
);

wall.update(true);
Expand All @@ -166,7 +166,7 @@ export class SimpleWall extends Element {
private calculateDistances(
wall: SimpleWall,
atTheEndPoint: boolean,
intersectionPoint: THREE.Vector3
intersectionPoint: THREE.Vector3,
) {
const distance1 = this.midPoint.distanceTo(intersectionPoint);
const distance2 = wall.midPoint.distanceTo(intersectionPoint);
Expand Down
2 changes: 1 addition & 1 deletion packages/clay/src/elements/Windows/SimpleWindow/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class SimpleWindowType extends StaticElementType<SimpleWindow> {
IFC.IfcWindowTypeEnum.WINDOW,
IFC.IfcWindowTypePartitioningEnum.NOTDEFINED,
null,
null
null,
);

this.updateGeometry();
Expand Down
4 changes: 2 additions & 2 deletions packages/clay/src/elements/Windows/SimpleWindow/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class SimpleWindow extends Element {

const placement = IfcUtils.localPlacement();

for(const [id] of type.geometries) {
for (const [id] of type.geometries) {
this.geometries.add(id);
}

Expand All @@ -33,7 +33,7 @@ export class SimpleWindow extends Element {
null,
null,
null,
null
null,
);

this.model.set(this.attributes);
Expand Down
Loading

0 comments on commit fc170a6

Please sign in to comment.