engine_web-ifc icon indicating copy to clipboard operation
engine_web-ifc copied to clipboard

[Bug]: Attribute is derived subtype.

Open RyugaRyuzaki opened this issue 1 year ago • 7 comments

What happened?

When i try to create IfcGeometricRepresentationSubContext :

this.IfcGeometricRepresentationSubContext1 =
      new IFC4X3.IfcGeometricRepresentationSubContext(
        new IFC.IfcLabel("Axis"),
        new IFC.IfcLabel("Model"),
        this.IfcAxis2PlacementGlobal3D,
        this.IfcGeometricRepresentationContext,
        new IFC.IfcPositiveRatioMeasure(1e-3),
        IFC.IfcGeometricProjectionEnum.GRAPH_VIEW,
        new IFC.IfcLabel("")
      );

Then i checked from here https://validate.buildingsmart.org/dashboard It threw this error image

Version

0.0.54

What browsers are you seeing the problem on?

No response

Relevant log output

null

Anything else?

null

RyugaRyuzaki avatar Jun 14 '24 02:06 RyugaRyuzaki

From snippet :

constructor IFC4X3.IfcSIUnit(
Dimensions: (Handle<IFC.IfcDimensionalExponents> | IFC.IfcDimensionalExponents),
 UnitType: IFC.IfcUnitEnum, 
Prefix: IFC.IfcSIPrefix | null, 
Name: IFC.IfcSIUnitName): IFC.IfcSIUnit

So i follow

 IfcDimensionalExponents: IFC.IfcDimensionalExponents =
    new IFC.IfcDimensionalExponents(1, 1, 1, 1, 1, 1, 1);
  IfcLengthUnit: IFC.IfcSIUnit = new IFC.IfcSIUnit(
    this.IfcDimensionalExponents,
    IFC.IfcUnitEnum.LENGTHUNIT,
    "",
    IFC.IfcSIUnitName.METRE
  );

And result

#19= IFCSIUNIT(#18,.LENGTHUNIT.,$,.METRE.);

Expected :

#19= IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);

The problem "*" instead "#18".

RyugaRyuzaki avatar Jun 22 '24 05:06 RyugaRyuzaki

Can you share the full code for writing it?

beachtom avatar Jun 27 '24 14:06 beachtom

Can you share the full code for writing it?

@beachtom to define and to export and to writeline

RyugaRyuzaki avatar Jun 27 '24 15:06 RyugaRyuzaki

This is fixed!

beachtom avatar Jun 27 '24 17:06 beachtom

This is fixed!

Ops! @beachtom it's still error! image Result :

#88=IFCSIUNIT(.LENGTHUNIT.,'',.MILLI.,$);

Expected :

#88=IFCSIUNIT(*,.LENGTHUNIT.,'',.MILLI.,$);

RyugaRyuzaki avatar Jun 29 '24 01:06 RyugaRyuzaki

Did you test with the code here - new version hasn't been released yet? In any case I will double check

beachtom avatar Jun 29 '24 20:06 beachtom

Did you test with the code here - new version hasn't been released yet? In any case I will double check

yes. i downloaded build.zip then i followed this

    class IfcSIUnit extends IfcNamedUnit {
        UnitType: IfcUnitEnum;
        Prefix: IfcSIPrefix | null;
        Name: IfcSIUnitName;
        type: number;
        constructor(UnitType: IfcUnitEnum, Prefix: IfcSIPrefix | null, Name: IfcSIUnitName);
    }

And output

#88=IFCSIUNIT(.LENGTHUNIT.,'',.MILLI.,$);

RyugaRyuzaki avatar Jun 29 '24 20:06 RyugaRyuzaki

I think I may be hitting the same or a similar issue with 0.0.61. In the below code I'm writing a minimal IFC file with just a single instance of IfcSIUnit. It outputs the line #1=IFCSIUNIT(#0,.LENGTHUNIT.,$,.METRE.); rather than the expects #1=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);. My understanding is that the first parameter should be '*' as that is now derived.

Code used to reproduce the issue:

import WebIFC from "web-ifc";
import * as fs from "fs";

const ifcApi = new WebIFC.IfcAPI();
await ifcApi.Init();
const newIfcModel = {
    schema: WebIFC.Schemas.IFC4,
    name: `Test Project`,
}
const modelId = ifcApi.CreateModel(newIfcModel);
const metres = new WebIFC.IFC4.IfcSIUnit(
    WebIFC.IFC4.IfcUnitEnum.LENGTHUNIT,
    null,
    WebIFC.IFC4.IfcSIUnitName.METRE
);
ifcApi.WriteLine(
    modelId,
    metres,
);
fs.writeFileSync('test.ifc', ifcApi.SaveModel(modelId));
ifcApi.CloseModel(modelId);

Output:

ISO-10303-21;
HEADER;
/******************************************************
* STEP Physical File produced by: That Open Engine WebIfc 0.0.61
* Module: web-ifc/IfcLoader
* Version: 0.0.61
* Source: https://github.com/ThatOpen/engine_web-ifc
* Issues: https://github.com/ThatOpen/engine_web-ifc/issues
******************************************************/
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');
FILE_NAME('Test Project','2024-11-11T10:58:51',($),($),'thatopen/web-ifc-api','thatopen/web-ifc-api',$);
FILE_SCHEMA(('IFC4'));
ENDSEC;
DATA;
#1=IFCSIUNIT(#0,.LENGTHUNIT.,$,.METRE.);
ENDSEC;
END-ISO-10303-21;

JakeOShannessy avatar Nov 11 '24 11:11 JakeOShannessy

This has resolved the bug for me.

JakeOShannessy avatar Nov 14 '24 22:11 JakeOShannessy