You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been struggling for days, how to get Vertices, Triangles and Material out of an IFC file with Xbim (in XbimWindowsUI)..
I have the Vertices and Triangles.. but are pulling my hair out now, just to figure out how I get a material color or a valid Material.
privatestaticbyte[]ReadIfcFileAjesStyle(stringifcFilename){List<Vector3[]>vecs=newList<Vector3[]>();List<int[]>trises=newList<int[]>();List<string>types=newList<string>();using(varmodel2=IfcStore.Open(ifcFilename)){if(model2.GeometryStore.IsEmpty){Console.WriteLine("model.GeometryStore.IsEmpty");varcontext=newXbim3DModelContext(model2);context.CreateContext();//skal køre for at virke..}XbimModelPositioningCollectionmodelPositions=newXbimModelPositioningCollection();shortuserDefinedId=0;model2.UserDefinedId=userDefinedId;modelPositions.AddModel(model2.ReferencingModel);if(model2.IsFederation){foreach(IReferencedModelrefModelinmodel2.ReferencedModels){refModel.Model.UserDefinedId=++userDefinedId;IfcStorev=refModel.ModelasIfcStore;if(v!=null)modelPositions.AddModel(v.ReferencingModel);}}XbimRect3DmodelBounds=modelPositions.GetEnvelopeInMeters();XbimPoint3Dp=modelBounds.Centroid();XbimVector3DmodelTranslation=newXbimVector3D(-p.X,-p.Y,-p.Z);doubleoneMeter=model2.ModelFactors.OneMetre;XbimMatrix3Dtranslation=XbimMatrix3D.CreateTranslation(modelTranslation*oneMeter);XbimMatrix3Dscaling=XbimMatrix3D.CreateScale(1/oneMeter);XbimMatrix3Dtransform=translation*scaling;WpfMaterialmat=newWpfMaterial();ColorSelectionColor=Colors.Blue;mat.CreateMaterial(newXbimColour("Selection",SelectionColor.ScR,SelectionColor.ScG,SelectionColor.ScB,SelectionColor.ScA));Console.WriteLine("model.Instances amount: "+model2.Instances.Count);boolrunOnce=false;foreach(IPersistEntityentityTheinmodel2.Instances){WpfMeshGeometry3Dm=WpfMeshGeometry3D.GetGeometry(entityThe,transform,mat);stringnameOfType=entityThe.GetType().ToString();List<Vector3>vecsHere=newList<Vector3>();foreach(Point3Dpointinm.Mesh.Positions){vecsHere.Add(newVector3(point));}vecs.Add(vecsHere.ToArray());trises.Add(m.Mesh.TriangleIndices.ToArray());types.Add(nameOfType);}}byte[]data=SerializerMeshPack.SerializeMeshPack(vecs,trises,types);returndata;}
The text was updated successfully, but these errors were encountered:
I'm opening this issue on behalf of @Ajes1337, who asked the question in the webUI, but using WindowsUI primitives.
===
@Ajes1337 Says:
I have been struggling for days, how to get Vertices, Triangles and Material out of an IFC file with Xbim (in XbimWindowsUI)..
I have the Vertices and Triangles.. but are pulling my hair out now, just to figure out how I get a material color or a valid Material.
Anyone know a 'simple' way to get the material?
Here is my code that get Vertices and Triangles:
since I cant seem to use this inbuild 'insert code' here is pastbin: https://pastebin.com/VfmG4rfN
The text was updated successfully, but these errors were encountered: