pipauwel / ifc.java Goto Github PK
View Code? Open in Web Editor NEWJAVA class library for IFC
License: Other
JAVA class library for IFC
License: Other
Hi,
while loading your sample the following error occures:
private void sample() {
InputStream is = null;
try {
String filePath = "sample.ifcxml";
File xml = new File(filePath);
is = new FileInputStream(xml);
XmlMapper m = new XmlMapper();
m.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
m.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
m.configure(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true);
IfcProject proj = m.readValue(is, IfcProject.class);
IfcLabel s = proj.getName();
System.out.println(s.getValue());
} catch (Exception ex) {
System.out.println(ex.getMessage());
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} finally {
//ignore null for now
is.close();
}
}
Cannot construct instance of `com.buildingsmart.tech.ifc.IfcKernel.IfcProject` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: (FileInputStream); line: 2, column: 1]
Nov 13, 2020 8:35:22 AM de.comp.Main start
SCHWERWIEGEND: null
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `com.buildingsmart.tech.ifc.IfcKernel.IfcProject` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: (FileInputStream); line: 2, column: 1]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1329)
at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1031)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1275)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:325)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeWithObjectId(BeanDeserializerBase.java:1235)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:192)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:161)
at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:120)
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:130)
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:97)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeWithType(BeanDeserializerBase.java:1156)
at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserializeWithType(WrapperHandlingDeserializer.java:137)
at com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:68)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3058)
at de.comp.Main.start(Main.java:35)
at de.comp.Main.main(Main.java:21)
Any ideas what I might be doing wrong?
The type of IfcObjectDefinition.isDecomposedBy in this repository is IfcRelAggregates, but it's supposed to be a Set of IfcRelAggregates according to the IFC version 4.1 specification (and even earlier version as far as I can tell).
I'm trying to fix this myself both in that class and in IfcParser but I'm getting all kinds of errors when doing mvn clean install
, so I figured I'd post about it here in the meantime.
The following error occurred during file conversion:
Exception in thread "main" java.lang.IllegalArgumentException: Can not set com.buildingsmart.tech.ifc.IfcMeasureResource.IfcValue field com.buildingsmart.tech.ifc.IfcPropertyResource.IfcPropertySingleValue.nominalValue to com.buildingsmart.tech.ifc.IfcMeasureResource.IfcLogical
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
at java.lang.reflect.Field.set(Field.java:764)
at com.buildingsmart.tech.IO.IfcParser.loadToClassLibrary(IfcParser.java:324)
at com.buildingsmart.tech.IO.IfcParser.parseModelFromSPF(IfcParser.java:200)
at com.buildingsmart.tech.IO.IfcParser.main(IfcParser.java:102)
Hi,
In the ifc file there is an id for every object but in the xml or json generated I don't see this id, instead I see a new generated guid. We need to link some extra data to the actual model but without the original identifier I don't know how I can link the parsed data to the original object in the ifc model.
I am talking about the first number at the start of the line.
...
#1= IFCORGANIZATION($,'Autodesk Revit 2019 (ENU)',$,$,$);
#5= IFCAPPLICATION(#1,'2019','Autodesk Revit 2019 (ENU)','Revit');
#6= IFCCARTESIANPOINT((0.,0.,0.));
#9= IFCCARTESIANPOINT((0.,0.));
#11= IFCDIRECTION((1.,0.,0.));
#13= IFCDIRECTION((-1.,0.,0.));
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.