xBimTeam / XbimEssentials

A .NET library to work with data in the IFC format. This is the core component of the Xbim Toolkit
https://xbimteam.github.io/
Other
490 stars 173 forks source link

Support for Curve3D #323

Open johnnyontheweb opened 4 years ago

johnnyontheweb commented 4 years ago

Why in XbimRepresentationType.cs the Curve3D is not included? Is it not already supported? I have files from Revit using this to represent IfcBeam elements. For now, I'm handling it using a workaround: if shaperepr.RepresentationType = "Curve3D" then ....

CBenghi commented 4 years ago

Hi @johnnyontheweb, can you show us more of the code that you use? What do you need to do with that representation? Have you got models that use that class? Can you share an instance? Not necessarily the whole file, even a selection of representations would be useful.

johnnyontheweb commented 4 years ago

Hello, my code still doesn't work for that. I'm sure it's a problem of my code, because Xbim Xplorer can read the attached model. test_Curve3D.zip I cannot read beams with my codes, please find below an excerpt:

If shaperepr.RepresentationType = Xbim.Common.Enumerations.XbimRepresentationType.SweptSolid.ToString Then
    ImportSweptSolidBeams(bb, shaperepr, sectRip, basePos, baseTransf)
ElseIf shaperepr.RepresentationType = "Curve3D" Then
    ImportCurve3DBeams(bb, shaperepr, sectRip, basePos, baseTransf) ' da finire
End If

As I wrote in the first post, I cannot find the suitable Enum for Curve3D.

CBenghi commented 4 years ago

Warning: part of the thread temporarily switches to :it:, goes back to :gb: further down.

@johnnyontheweb, temo di non aver capito il problema che hai, puoi riformulare in italiano? Per quale motivo devi trattare questo tipo in modo diverso dagli altri? Che cosa fanno le funzioni che hai scritto? Importano aspetti semantici o le geometrie? Claudio

johnnyontheweb commented 4 years ago

solo non capisco come mai non esista l'Enum adatto per il RepresentationType. Il codice importa geometrie, e devo specializzarlo per ogni tipo, come già fatto per SweptSolid in ImportSweptSolidBeams.

Per quale motivo devi trattare questo tipo in modo diverso dagli altri? Come posso leggere altrimenti la forma della sezione trasversale?

CBenghi commented 4 years ago

Qual e' l'entityLabel della rappresentazione che ti da problemi?

CBenghi commented 4 years ago

Ma ti stai riferendo ad esempio a una riga come questa?

#644= IFCSHAPEREPRESENTATION(#102,'Axis','Curve3D',(#641));
fponta commented 4 years ago

Si riferisce al fatto che pensava di trovare il Representation Type 'Curve3D' nell'enum Xbim.Common.Enumerations.XbimRepresentationType (poiché è un Representation Type conteplato da Ifc4: https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2/HTML/schema/ifcrepresentationresource/lexical/ifcshaperepresentation.htm) e invece non c'è.

Quindi non gli è possibile fare un confronto del tipo

ElseIf shaperepr.RepresentationType = Xbim.Common.Enumerations.XbimRepresentationType.Curve3D.ToString Then
...

per verificare che l'oggetto sia proprio di quel tipo per poterlo importare correttamente nel suo programma.

C'è forse un altro metodo più corretto per verificare che tipo di rappresentazione standard ha un oggetto invece che tramite l'enum?

johnnyontheweb commented 4 years ago

esatto è proprio questo il problema.

CBenghi commented 4 years ago

Hi, Reverting to English to sum up the situation for other developers and any other reading the thread. I've had a quick look at the issue.

The problem seems to be that the enum for RepresentationType does not include all the values defined in the documentation referenced above by @fponta (https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2/HTML/schema/ifcrepresentationresource/lexical/ifcshaperepresentation.htm).

A short comparison of the enum with the values in the documentation is as follows:

AdvancedBrep (new in ifc4, not implemented)
AdvancedSurface (old in schema but missing in enum)
AdvancedSweptSolid
Annotation2D (old in schema but missing in enum)
BoundingBox
Brep
CSG
Clipping
Curve (new in ifc4, not implemented)
Curve2D
Curve3D (new in ifc4, not implemented)
FillArea (new in ifc4, not implemented)
GeometricCurveSet
GeometricSet
LightSource (new in ifc4, not implemented)
MappedRepresentation
Point (new in ifc4, not implemented)
PointCloud (new in ifc4, not implemented)
SectionedSpine
SolidModel
Surface (new in ifc4, not implemented)
Surface2D (new in ifc4, not implemented)
Surface3D (new in ifc4, not implemented)
SurfaceModel
SweptSolid
Tessellation (new in ifc4, not implemented)
Text (new in ifc4, not implemented)

The fix for the enum is not obvious, because it's stored with [Flags] attribute in a short field, which would not fit all the required values.

However, there is no need to rely on the enum for any evaluation of the value, because 'IfcShapeRepresentation.RepresentationType' is an optional IfcLabel, that can be compared with a string, in your code.

@johnnyontheweb,

I'm also thinking that the information that you want from the model is not to be found in those instances but in the other representations attached to the elements. Send me an email at claudio.benghi@gmail.com and we'll arrange a quick call to show you how to extract them.

CBenghi commented 4 years ago

@martin1cerny,

I see a few ways to address this:

  1. we add the missing values by 1.1. keeping the [Flags] attribute, but changing the type from short to int 1.2 dropping the [Flags] attribute will fit the missing options in the short

  2. we mark the whole thing as [Obsolete] for future removal, it's never used in Essentials, Geometry or WindowsUI.

Any thoughts?