-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: GetLine() output of Boolean attributes #1257
Comments
This will be fixed when #1289 is merged. Regarding the {type: 10, value: [1, 2, 3, 4]} question: When Type is defined as ARRAY OF <Standard Type (e.g., Real, Integer, String...)>, // EXPRESS specification:
TYPE IfcComplexNumber = ARRAY [1:2] OF REAL;
END_TYPE;
// converted code
export class IfcComplexNumber {
type: number = 4;
constructor(public value: Array<number>) {}
} However, when Type is defined as an IFCType, it will return [...typeClass...] // EXPRESS specification:
ENTITY IfcBSplineCurve
ABSTRACT SUPERTYPE OF (ONEOF
(IfcBezierCurve))
SUBTYPE OF (IfcBoundedCurve);
Degree : INTEGER;
ControlPointsList : LIST [2:?] OF IfcCartesianPoint;
CurveForm : IfcBSplineCurveForm;
ClosedCurve : LOGICAL;
SelfIntersect : LOGICAL;
DERIVE
ControlPoints : ARRAY [0:255] OF IfcCartesianPoint := IfcListToArray(ControlPointsList,0,UpperIndexOnControlPoints);
UpperIndexOnControlPoints : INTEGER := (SIZEOF(ControlPointsList) - 1);
WHERE
WR41 : SIZEOF(QUERY(Temp <* ControlPointsList |
Temp.Dim <> ControlPointsList[1].Dim))
= 0;
END_ENTITY;
// converted code
export class IfcBSplineCurve extends IfcBoundedCurve {
type: number = 1967976161;
constructor(
public Degree: number,
public ControlPointsList: (Handle<IfcCartesianPoint> | IfcCartesianPoint)[],
public CurveForm: IfcBSplineCurveForm,
public ClosedCurve: logical,
public SelfIntersect: logical
) {
super();
}
} You can find this converted code in src/ts/ifc-schema.ts. I hope this comment is helpful. |
Hey thanks for the answer regarding my question! Great to see the boolean wrapped inside the usual object, so it's consistent with other values. In the IFC raw text, boolean values look liky any other enumeration. For example here: .NOTDEFINED. is part of the "IfcWindowStyleConstructionEnum" in this example: .F. represents an IfcBoolean, which may be seen as part of an enumeration definition F and T. I hope this makes sense, I guess we all wish IFC would just be less complex... :-) |
I have just seen at the very bottom of your pull request that UNKNOWN will be translated to JS primitive value 'undefined'. So that case is actually handled, which I wasn't sure of in my last comment. Thanks for fixing this issue and properly wrapping these values in the usual object! I'm looking forward to the next release! |
Thanks for sharing your idea. I initially thought that the However, TypeScript users would need to define a variable that allows In my opinion, For example, const IFCLOGIC_ENUM= {
TRUE : true,
FALSE : false,
UNKNOWN : undefined,
} as const;
type IFCLOGIC_VALUE = typeof IFCLOGIC_ENUM[keyof typeof IFCLOGIC_ENUM]; |
Yes I like this approach - thanks for your contributions here. |
@andy-wrks do you think this can be considered closed with the PR now merged? |
What happened?
I'm using GetLine() to read an IfcWindowStyle entity and I realized that the boolean attributes are hard to identify from the returned object.
This is the raw line:

#150288=IFCWINDOWSTYLE('2oBbts7bIYPxtVzht3Nx15',#30,'Kombi-Fenster 1-Fl 22',$,$,$,$,'B22E5DF6-1E54-A267-BDDF-F6BDC35FB045',.NOTDEFINED.,.NOTDEFINED.,.F.,.F.);
I get the following object from GetLine():

The highlighted boolean enumeration values "F" show up differently than the "NOTDEFINED" enumeration values. Is there a reason the booleans don't show up as {type: 3, value: 'F'}? I wasn't expecting a naked string here that's not wrapped in the usual value/type object. It also makes it hard to identify booleans when they're not tagged as an enumeration. It may just be a string 'F', it's hard to know.
It would be great if the IfcBooleans and IfcLogicals would show up consistently like other enumerations.
A related question: I came across objects like {type: 10, value: [1, 2, 3, 4]}. Type=10 stands for Integer. Can this refer to single values as well as an array of Integers? Does this apply to all types? I couldn't find any documentation on this other than the type map in some code file.
Thanks for the great work on web-ifc!
Version
0.0.66
What browsers are you seeing the problem on?
Chrome
Relevant log output
Anything else?
No response
The text was updated successfully, but these errors were encountered: