Coder Social home page Coder Social logo

load_GDF ValueError about meshmagick HOT 1 CLOSED

lheea avatar lheea commented on September 27, 2024
load_GDF ValueError

from meshmagick.

Comments (1)

michaelcdevin avatar michaelcdevin commented on September 27, 2024

I discovered the problem I was having. If I'm understanding the code correctly, load_GDF assumes that each point is contained on its own line, so each face consists of four lines before moving on to the next face. For example:

X1(1)   Y1(1)   Z1(1)
X2(1)   Y2(1)   Z2(1)
X3(1)   Y3(1)   Z3(1)
X4(1)   Y4(1)   Z4(1)
X2(1)   Y2(1)   Z2(1)
X2(2)   Y2(2)   Z3(2)
...
X4(nf)  Y4(nf)  Z4(nf)

My GDF file contains all four points of each face on one line:

X1(1)   Y1(1)   Z1(1)   X2(1)   Y2(1)   Z2(1)   X3(1)   Y3(1)   Z3(1)   X4(1)   Y4(1)   Z4(1)
X1(2)   Y1(2)   Z1(2)   X2(2)   Y2(2)   Z2(2)   X3(2)   Y3(2)   Z3(2)   X4(2)   Y4(2)   Z4(2)
...
X1(nf)  Y1(nf)  Z1(nf)  X2(nf)  Y2(nf)  Z2(nf)  X3(nf)  Y3(nf)  Z3(nf)  X4(nf)  Y4(nf)  Z4(nf)

According to the WAMIT documentation, line breaks must exist between faces, but additional line breaks can also be used without effect, so either format above is acceptable. However, load_GDF starts returning empty arrays once it reaches the end of the file with the second format because it is trying to read four times as many lines as the GDF file contains, resulting in the ValueError I encountered.

I modified my local version of meshmagick.mmio.load_GDF to generalize how it reads the points in the file so either format is acceptable (or really any format as long as there is a line break at the end of each face). I will create a pull request with my changes.

from meshmagick.

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.