Giter Club home page Giter Club logo

Comments (8)

fangq avatar fangq commented on August 21, 2024

hi @TheNightbringer117, can you give me a short example how I can produce this issue?

it is actually quite common that tetgen fails if a user does not process the input surface carefully - mostly because your input surface is self-intersecting. If it is a single closed surface, you can use meshcheckrepair() with the 'meshfix' option to repair the bad surface, then tetgen will not complain.

from iso2mesh.

TheNightbringer117 avatar TheNightbringer117 commented on August 21, 2024

Hi fangq,
Sorry for the delayed response.

I modified my script to include the check and it caused another error.
The script I am using is now:

file_1 = "K:\AMA\ISO2MESH\20mmcube18infillstrokeregioninset2mm.stl"
file_2 = "K:\AMA\ISO2MESH\20mmcube18infillstrokeregioninset3mm.stl"

disp("Importing geometry file data...")

[VL1unchecked,FL1unchecked] = VLFLreadSTLb(file_1)
[VL2unchecked,FL2unchecked] = VLFLreadSTLb(file_2)

[VL1,FL1] = meshcheckrepair(VL1unchecked,FL1unchecked,meshfix)
[VL2,FL2] = meshcheckrepair(VL2unchecked,FL2unchecked,meshfix)

disp(".stl File Reading Complete")

disp("Plotting Individual Files...")

figure
subplot(2,1,1)
plotsurf(VL1,FL1)

subplot(2,1,2)
plotsurf(VL2,FL2)

keepratio=1;
maxvol=10;

addpath('C:\MATLAB\iso2mesh-master\iso2mesh-master')
which vol2mesh

[node,elem,face] = surf2mesh(VL1,FL1,[-100 -100 -100],[100 100 100],keepratio,maxvol);
figure
plotmesh(face(:,1:3),node);

disp("Calculating Boolean Subtraction...")

Which returns the error:

Error in meshfix (line 16)
writeOFF(off_filename,V,F);

Error in PolyComparison (line 27)
[VL1,FL1] = meshcheckrepair(VL1unchecked,FL1unchecked,meshfix)

Previously, I was using:

file_1 = "K:\AMA\ISO2MESH\20mmcube18infillstrokeregioninset2mm.stl"
file_2 = "K:\AMA\ISO2MESH\20mmcube18infillstrokeregioninset3mm.stl"

disp("Importing geometry file data...")

[VL1,FL1] = VLFLreadSTLb(file_1)
[VL2,FL2] = VLFLreadSTLb(file_2)

disp(".stl File Reading Complete")

disp("Plotting Individual Files...")

figure
subplot(2,1,1)
plotsurf(VL1,FL1)

subplot(2,1,2)
plotsurf(VL2,FL2)

keepratio=1;
maxvol=10;

addpath('C:\MATLAB\iso2mesh-master\iso2mesh-master')
which vol2mesh

[node,elem,face] = surf2mesh(VL1,FL1,[-100 -100 -100],[100 100 100],keepratio,maxvol);
figure
plotmesh(face(:,1:3),node);

disp("Calculating Boolean Subtraction...")

Which returned the error:

Error using surf2mesh (line 114)
Tetgen command failed

Error in PolyComparison (line 48)
[node,elem,face] = surf2mesh(VL1,FL1,[-100 -100 -100],[100 100 100],keepratio,maxvol);

I can email you the .stls if that will help.
Your help is much appreciated.

Regards,

Nightbringer

from iso2mesh.

fangq avatar fangq commented on August 21, 2024

@TheNightbringer117, it appears to me that you called meshcheckrepair() using an incorrect input, please change

[VL1,FL1] = meshcheckrepair(VL1unchecked,FL1unchecked,meshfix)
[VL2,FL2] = meshcheckrepair(VL2unchecked,FL2unchecked,meshfix)

to

[VL1,FL1] = meshcheckrepair(VL1unchecked,FL1unchecked,'meshfix');
[VL2,FL2] = meshcheckrepair(VL2unchecked,FL2unchecked,'meshfix');

and let me know what you see.

from iso2mesh.

fangq avatar fangq commented on August 21, 2024

I am closing this ticket as there was no updates. feel free to reopen if issue remains.

from iso2mesh.

praveenvenky avatar praveenvenky commented on August 21, 2024

Dear Fang,
I have used

[node,elem]=meshcheckrepair(nodes_TP(:,2:4),triangularelements,'meshfix').

This generated node array of size103242x3 and element array of size 208868x3.

Later I ran
[node1,face1]=extrudesurf(node(:,1:3),elem(:,1:3),[0 0 +7]);
keepratio = 1;
maxvol=0.1;
[node11,elem11,face11] = s2m(node1,face1,keepratio,maxvol).

still I am getting the same error.
Please help me.
Thanks in advance

from iso2mesh.

fangq avatar fangq commented on August 21, 2024

extrudesurf can easily generate self-intersecting triangles, you will have to call meshcheckrepair again before calling s2m.

from iso2mesh.

hzhao329 avatar hzhao329 commented on August 21, 2024

Dear Dr. Fang,

I am using iso2mesh to generate a 4-slab medium, but it generates "Tetgen command failed" error. Could you help with it?

Here is my code:
L = [10, 20, 30];
[node1,face1]=meshabox([0 0 0],[100 100 L(1)], 2sqrt(2), 2^3/6);
[node2,face2]=meshabox([0 0 L(1)],[100 100 L(2)], 2
sqrt(2), 2^3/6);
[node3,face3]=meshabox([0 0 L(2)],[100 100 L(3)], 2sqrt(2), 2^3/6);
[node4,face4]=meshabox([0 0 L(3)],[100 100 100], 2
sqrt(2), 2^3/6);
[node,face]=mergemesh(node1,face1,node2,face2,node3,face3,node4,face4);
plotmesh(node,face);
[node,elem]=surf2mesh(node,face,[],[],1,2^3/6,[1 1 1; 1 1 11; 1 1 21; 1 1 31],[],0);

Error information:
Error using surf2mesh (line 117)
Tetgen command failed
Error in exmaple_4slab_MMC_simulation (line 13)
[node,elem]=surf2mesh(node,face,[],[],1,2^3/6,[1 1 1; 1 1 11; 1 1 21; 1 1 31],[],0);

Thank you in advance!

from iso2mesh.

fangq avatar fangq commented on August 21, 2024

@hzhao329, mergemesh does not do intersection test. it simply concatenate meshes. in your case, separately generated box-shaped meshes are completely overlapping on z=L(1/2/3) and those inconsistent boundaries make it impossible to surf2mesh to create volumetric mesh.

instead of creating boxes for each layer, you should use latticegrid and this example to create a single mesh of multiple compartment, see

https://github.com/fangq/mmc/blob/master/mmclab/example/demo_sfdi_2layer.m#L20-L41

from iso2mesh.

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.