Closed Blogbotana closed 1 year ago
Hi, @Blogbotana. You can try and develop this code sample
var m_3DMdlContext = new Xbim3DModelContext(m_model);
m_3DMdlContext.MaxThreads = 1;
m_3DMdlContext.CreateContext();
var m_ShapeInsts = m_3DMdlContext.ShapeInstances().ToList();
if (shapeInsts == null || shapeInsts.Count == 0)
shapeInsts = (from inst in m_ShapeInsts
where inst.IfcProductLabel == EntLabel select inst).ToList();
foreach (var instance in shapeInsts)
{
using (var stream = new MemoryStream(data))
{
using (var reader = new BinaryReader(stream))
{
var mesh = reader.ReadShapeTriangulation();
List<XbimFaceTriangulation> faces = mesh.Faces as List<XbimFaceTriangulation>;
List<XbimPoint3D> vertices = mesh.Vertices as List<XbimPoint3D>;
}
}
}
You may need to change deflection angle when you create Xbim3DModelContext
That defines how smooth curves are tesselated.
@martin1cerny There's no any deflection angle and I didn't find any property or field
I found CustomMeshingBehaviour
delegate, but don't understand how it works
I tried to change deflection, but it didn't help me. May be because this is C profile in representation?
You can change deflection settings using IModel.ModelFactors. DeflectionAngle
. Can you share the IFC file?
Yes, sure. I'm trying to work with purlins out22.zip
Could you repeat the same result?
I found
CustomMeshingBehaviour
delegate, but don't understand how it works
You can use it something like this :
private Xbim3DModelContext.MeshingBehaviourResult MyCustomMeshingBehaviour(int elementId, int typeId, ref double linearDeflection, ref double angularDeflection)
{
if (typeId == 571) //rebars, don't make them too detailed (i.e. do coarse tessellation)
{
linearDeflection *= 10;
angularDeflection = 1.5;
}
return Xbim3DModelContext.MeshingBehaviourResult.Default;
}
IfcStore theModel = IfcStore.Open(theFileName);
var context = new Xbim3DModelContext(theModel);
context.CustomMeshingBehaviour = MyCustomMeshingBehaviour;
context.CreateContext();
Ok, now I actually looked at your images also, it's about the fillet radius, right?? Then you should be able to fiddle with the "ModelFactors", specifically "ProfileDefLevelOfDetail". From the comments in the code: "Indicates level of detail for IfcProfileDefinitions, if 0 no fillet radii are applied, no leg slopes area applied, if 1 all details are applied"
/Mikael
Just tested, it works, just set
theModel.ModelFactors.ProfileDefLevelOfDetail = 1;
before calling CreateContext() (First image below is with no fillet, the other two with fillet, i.e. ProfileDefLevelOfDetail set to one)
Thank you very much @jomijomi you helped me a lot
Hi everyone, can you help me with my problem? I have an IFC file and I need to get bynary data of geometry (Vertices, Triangles, Nornals). Usually I have "Swept Solid" representation.
I tried to use Xbim.Tessellator.XbimTessellator, but it doesn't work with IfcExtrudedAreaSolid. Also I tried to use Xbim.Geometry.Engine.Interop.XbimGeometryEngine but I didn't understand how it works properly. How I can get data of Vertices, Triangles and Normals?
Thank you