GithubHelp home page GithubHelp logo

Comments (4)

daveime avatar daveime commented on August 18, 2024

EDIT: Ignore all the above, I'm an idiot. Okay, so I now worked out how to populate the models thus 👎

var context = new Xbim3DModelContext(model);
context.CreateContext();

And can now see all the shapes with cutouts and voids already applied with what appears to be vertices and triangle data inside the ShapeGeometries.ShapeData

So my question now is simply, how do I get the values back out of ShapeData ?

I can get the counts of the vertices and triangles thus
var tri = XbimShapeTriangulation.TriangleCount(((IXbimShapeGeometryData)item).ShapeData);
var vert = XbimShapeTriangulation.VerticesCount(((IXbimShapeGeometryData)item).ShapeData);

But how do I get the individual values for each triangle and vertex?

I can see the basic storage mechanism for the vertices and triangles inside the binary blob, but surely there must be a built-in method in the library to avoid all this low level hacking?

from xbimgeometry.

CBenghi avatar CBenghi commented on August 18, 2024

@daveime,
you are right, we have been quite brainiacs (derogatory use) about this.
I'll see if this can be rectified.
Thanks for the feedback.

from xbimgeometry.

thorade avatar thorade commented on August 18, 2024

I would be interrested in the same and am unsure what the comment means: Is this already easily possible and just not well documented, or this this a feature that might be added in the future?

from xbimgeometry.

daveime avatar daveime commented on August 18, 2024

@thorade It is possible but requires some custom code - there's nothing built in to the XbimShapeTriangulation class to convert the binary ShapeData blob back into vertices, triangles and normals.

If you're interested, check out http://marikinacgi.com/XBIM/convert.txt

The function takes the shapedata as a byte[] array, references to the lists of vertices, triangles and normals you want to extract, an XbimMatrix3D matrix to convert the points directly to world coordinates, and a double onemeter which can be parsed from the model data so that the points are expressed in meters.

@CBenghi if you're interested to add this to the XbimShapeTriangulation class or just add to the documentation as an example of how to parse the data, please feel free.

from xbimgeometry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.