How to adjust the VTK file drawing code in Freecad?

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
User avatar
freecadlzh
Posts: 138
Joined: Fri Mar 06, 2020 12:52 pm

How to adjust the VTK file drawing code in Freecad?

Post by freecadlzh »

I load the same in VTK file in freecad 0.19 and paraview,Loaded the file in freecad through file \ import . And different results are obtained, as shown in the following figure.
Image

I guess it is necessary to adjust the drawing code in freecad, but after one-step tracking, I can't locate the specific drawing code file in freecad. Do you know which drawing code file is? How to adjust the code file of the drawing?

Thanks a lot.
Attachments
loadVTK.png
loadVTK.png (101.39 KiB) Viewed 2156 times
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: How to adjust the VTK file drawing code in Freecad?

Post by HoWil »

Is it possible to share the vtk file?
User avatar
freecadlzh
Posts: 138
Joined: Fri Mar 06, 2020 12:52 pm

Re: How to adjust the VTK file drawing code in Freecad?

Post by freecadlzh »

HoWil wrote: Wed Jan 26, 2022 2:06 pm Is it possible to share the vtk file?
The file name is : DAHA.vtk

Code: Select all


# vtk DataFile Version 4.2
vtk output
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 26 float
10 10 0 10 10 10 10 0 0 
10 0 10 0 10 0 0 10 10 
0 0 0 0 0 10 0 5 10 
5 10 10 10 5 10 5 0 10 
0 5 0 5 10 0 10 5 0 
5 0 0 10 10 5 0 10 5 
10 0 5 0 0 5 5 5 10 
5 5 0 5 10 5 5 0 5 
10 5 5 0 5 5 
CELLS 5 55
10 3 6 5 7 23 25 20 11 19 8 
10 5 6 3 0 25 23 20 22 21 24 
10 6 4 0 5 12 13 21 25 17 22 
10 6 3 0 2 23 24 21 15 18 14 
10 1 3 0 5 10 24 16 9 20 22 

CELL_TYPES 5
24
24
24
24
24

POINT_DATA 26
FIELD FieldData 20
Displacement 3 26 double
-3.38163e-06 2.57532e-05 7.89095e-05 -4.65403e-06 -3.60828e-05 9.414e-05 0 0 0 
0 0 0 3.46959e-06 2.54436e-05 7.52494e-05 3.98424e-06 -3.85675e-05 9.75419e-05 
0 0 0 0 0 0 1.49163e-06 -2.06878e-05 5.88075e-05 
9.45592e-07 -3.67725e-05 9.5927e-05 -9.36444e-07 -2.47068e-05 5.65302e-05 0 0 0 
3.96268e-06 1.9454e-05 4.22077e-05 1.27912e-06 2.48282e-05 7.71571e-05 -5.18886e-06 1.70879e-05 4.12587e-05 
0 0 0 -4.46967e-06 -3.57666e-06 8.1669e-05 3.13775e-06 -5.10807e-06 8.12117e-05 
0 0 0 0 0 0 -4.75349e-07 -2.15076e-05 5.78348e-05 
-1.01888e-06 1.586e-05 4.33475e-05 8.62431e-07 -5.60747e-06 8.34745e-05 0 0 0 
-2.21863e-06 -2.43359e-07 4.02675e-05 3.09224e-06 -1.36144e-06 4.09289e-05 
Displacement%20Magnitude 1 26 double
8.3074496218e-05 0.00010092555698 0 0 7.9510295158e-05 0.00010496546327 0 0 6.2358095586e-05 
0.00010273801745 6.1700619167e-05 0 4.6643872996e-05 8.1063516724e-05 4.4957768185e-05 0 8.1869383824e-05 8.1432659732e-05 
0 0 6.1706295509e-05 4.6169074852e-05 8.3667076304e-05 0 4.0329308188e-05 4.1068118076e-05 
Tresca%20Stress 1 26 double
0.0029466441697 0.0055745840716 0.010291014091 0.012669214789 0.00095758453928 0.0088701055865 0.0098015403789 0.015241979552 0.010012013212 
0.0055498105641 0.0094682324912 0.015101181055 0.0056047357041 0.0012053214372 0.0055210882825 0.010458893288 0.0030857150668 0.004718479539 
0.0089887305451 0.010772663244 0.0099362355191 0.0058515219134 0.0032488796934 0.0097071974165 0.0058503329176 0.0043290408786 
Strain%20xx%20component 1 26 double
-1.20916e-06 -1.37602e-06 4.54715e-12 1.74761e-07 -1.91059e-07 -5.83249e-07 -4.40353e-07 2.14489e-12 -3.93394e-07 
-8.63821e-07 -3.4831e-07 2.14489e-12 -7.49276e-07 -6.85115e-07 -8.33993e-07 4.54715e-12 -1.32251e-06 -2.08028e-07 
4.54715e-12 2.14489e-12 -2.34826e-07 -8.88173e-07 -7.85808e-07 -7.23781e-08 -4.9307e-07 -6.23798e-07 
Strain%20xy%20component 1 26 double
3.1766e-07 -4.97119e-07 -8.68691e-07 -2.63415e-07 -4.10658e-07 1.22139e-07 1.43929e-07 9.91131e-08 1.17233e-07 
1.27271e-07 -6.07896e-07 -9.75849e-08 -2.62941e-07 2.24942e-08 -4.62975e-08 -4.51692e-07 -2.16348e-07 -3.45199e-07 
-5.71667e-07 2.59175e-07 -1.78668e-09 2.27117e-07 1.41292e-07 5.9326e-08 9.26967e-09 5.78843e-08 
Strain%20xz%20component 1 26 double
-7.21772e-08 -1.6056e-07 -4.80596e-13 -2.67877e-07 1.06429e-07 8.66947e-08 1.94943e-07 1.40304e-12 -2.57332e-07 
-1.1659e-07 3.43344e-08 1.40304e-12 -2.42162e-08 8.24178e-08 8.81461e-08 -4.80596e-13 -2.5278e-07 2.59775e-07 
-4.80596e-13 1.40304e-12 -1.89642e-07 1.39344e-07 6.60737e-08 -6.10169e-08 -2.36437e-07 1.99862e-07 
Strain%20yy%20component 1 26 double
1.43881e-06 -9.42096e-07 4.25981e-06 -4.35071e-06 -1.48542e-07 -3.36407e-06 3.96464e-06 -4.41834e-06 -3.85673e-06 
-1.71988e-06 -3.60827e-06 -4.5823e-06 2.54435e-06 4.4718e-07 2.57531e-06 4.01424e-06 6.66444e-07 -2.09578e-06 
7.93561e-07 -5.53071e-07 -4.0239e-06 2.6711e-06 -8.82788e-07 -8.45158e-08 -1.32404e-06 1.88548e-07 
Strain%20yz%20component 1 26 double
3.39393e-07 -5.9448e-07 4.30624e-06 5.11912e-06 -6.3912e-08 -7.77964e-08 3.91284e-06 6.88437e-06 2.94442e-06 
-4.12123e-07 2.10183e-06 6.7871e-06 1.8263e-06 2.4473e-08 2.21232e-06 4.51511e-06 1.02315e-07 3.69421e-07 
4.20712e-06 5.09651e-06 2.54243e-06 2.1502e-06 3.20587e-07 4.6022e-06 2.50523e-06 1.80766e-06 
Strain%20zz%20component 1 26 double
-2.88152e-07 3.46532e-06 1.08083e-12 1.89095e-06 1.55687e-07 5.04379e-06 -1.03903e-06 -1.94957e-11 3.57571e-06 
3.46162e-06 4.22365e-06 -1.94957e-11 -1.29254e-06 2.26713e-07 -1.98234e-07 1.08083e-12 1.52303e-06 2.22924e-06 
1.08083e-12 -1.94957e-11 3.90602e-06 -8.14908e-07 2.0446e-06 1.94405e-07 1.01891e-06 2.09352e-06 
Stress%20xx%20component 1 26 double
-0.00276741 0.00138633 0.0159179 -0.00817012 -0.00108997 0.00286783 0.00835857 -0.0165103 -0.00334937 
0.00145972 0.000263796 -0.017123 0.000298469 -0.0014861 0.00400813 0.0150003 0.000451874 -0.00071713 
0.00296537 -0.00206675 -0.00181296 0.00174506 -0.000251387 -1.23954e-05 -0.00402204 0.00488164 
Stress%20xy%20component 1 26 double
0.0006696 -0.00104788 -0.00183112 -0.000555256 -0.000865631 0.000257459 0.000303391 0.000208922 0.000247116 
0.000268277 -0.00128139 -0.000205701 -0.000554257 4.74158e-05 -9.75911e-05 -0.000952127 -0.000456043 -0.000727649 
-0.00120502 0.000546318 -3.76616e-06 0.000478742 0.000297831 0.000125054 1.95397e-05 0.000122015 
Stress%20xz%20component 1 26 double
-0.000152143 -0.000338446 -1.01306e-09 -0.000564661 0.000224343 0.000182745 0.000410924 2.95749e-09 -0.000542433 
-0.000245762 7.23739e-05 2.95749e-09 -5.10457e-05 0.00017373 0.000185804 -1.01306e-09 -0.000532839 0.000547583 
-1.01306e-09 2.95749e-09 -0.000399748 0.000293725 0.000139278 -0.000128618 -0.00049839 0.000421292 
Stress%20yy%20component 1 26 double
0.00281427 0.002301 0.0248972 -0.0177094 -0.00100035 -0.0029939 0.0176439 -0.0258238 -0.0106498 
-0.00034478 -0.00660791 -0.0267821 0.00724116 0.000900683 0.0111946 0.0234619 0.00464442 -0.00469635 
0.00463812 -0.00323258 -0.0098 0.00924771 -0.000455813 -3.79806e-05 -0.00577366 0.00659399 
Stress%20yz%20component 1 26 double
0.000715411 -0.00125311 0.00907717 0.0107907 -0.000134721 -0.000163988 0.00824793 0.0145117 0.00620658 
-0.00086872 0.00443047 0.0143066 0.00384969 5.1587e-05 0.00466338 0.00951747 0.000215671 0.000778708 
0.00886824 0.010743 0.00535921 0.00453243 0.00067577 0.00970104 0.00528081 0.00381039 
Stress%20zz%20component 1 26 double
-0.000826013 0.0115915 0.0159179 -0.00455255 -0.000359064 0.0147291 0.00709661 -0.0165104 0.00501715 
0.0105774 0.0099011 -0.017123 -0.000846675 0.000435959 0.00534825 0.0150003 0.00645003 0.00442043 
0.00296537 -0.0020668 0.0069156 0.0018995 0.00571487 0.000549961 -0.00083492 0.0106095 
Major%20Principal%20Stress 1 26 double
0.0030185479728 0.011761370729 0.030698564287 0.0015668507617 2.000003911e-09 0.014733359487 0.022175577927 -0.0059251203947 0.007195554208 
0.010653772338 0.011020439947 -0.0068513689876 0.0088139992365 0.00090820974203 0.013775249917 0.029689993389 0.0065319864843 0.0045316724657 
0.01279047568 0.0081229734581 0.0085005898183 0.011440333101 0.0057928292139 0.0099614860292 0.002550953579 0.012931045491 
Intermediate%20Principal%20Stress 1 26 double
-0.00092296060635 0.0029052566846 0.015917899607 -0.0082273419459 -0.00053421892146 0.0028765221981 0.0083510049043 -0.016510300106 -0.0033491019921 
0.0014844164516 0.00045257108811 -0.017122999915 0.00027442693515 0.00044476539036 0.0040426567311 0.015000299799 0.004653781165 -0.00061943585348 
0.0029653697297 -0.002066750429 -0.0018260685984 0.001714647625 -8.0229040981e-05 -8.9922255294e-06 -0.0040318613228 0.0048811207752 
Minor%20Principal%20Stress 1 26 double
-0.0028747403665 0.00061220258608 0.010116536105 -0.023771578816 -0.0019151670785 -0.0030068516855 0.0025724971689 -0.036409079499 -0.012828472216 
-0.00044584878992 -0.0079160250352 -0.037053731097 -0.0023954721716 -0.0015024331324 0.0027330733519 0.008772206812 0.00036055635066 -0.0049052866122 
-0.0051869854099 -0.013422353029 -0.01137188122 -0.00026271072591 -0.00070493017292 -0.0094529088037 -0.0091497122562 0.0042729637338 
UserDefinedMyName 1 26 double
0.0058932883393 0.011149168143 0.020582028182 0.025338429577 0.0019151690786 0.017740211173 0.019603080758 0.030483959105 0.020024026424 
0.011099621128 0.018936464982 0.03020236211 0.011209471408 0.0024106428744 0.011042176565 0.020917786577 0.0061714301337 0.0094369590779 
0.01797746109 0.021545326487 0.019872471038 0.011703043827 0.0064977593868 0.019414394833 0.011700665835 0.0086580817572 
von%20Mises%20Stress 1 26 double
0.0051997971865 0.010197862603 0.018381291453 0.022131262098 0.001711765522 0.015651098543 0.01744693019 0.026807454314 0.017349493774 
0.010271431265 0.016436285458 0.026598149601 0.010141619831 0.00221557688 0.010449115801 0.018602822841 0.0054793240652 0.0081840891454 
0.015591387182 0.018667903963 0.0172144927 0.010850348816 0.0062090233458 0.016815420359 0.010159513551 0.0083705890662 


In forum, I can not share the .vtk file, so I copy the file content above. Please plaste the data into a file, and name the file to .vtk file, then can use it . Thanks a lot.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: How to adjust the VTK file drawing code in Freecad?

Post by chrisb »

freecadlzh wrote: Thu Jan 27, 2022 12:01 am In forum, I can not share the .vtk file, so I copy the file content above. Please plaste the data into a file, and name the file to .vtk file, then can use it . Thanks a lot.
You can add a zip file.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
freecadlzh
Posts: 138
Joined: Fri Mar 06, 2020 12:52 pm

Re: How to adjust the VTK file drawing code in Freecad?

Post by freecadlzh »

DAHA.zip
(3.53 KiB) Downloaded 27 times
chrisb wrote: Thu Jan 27, 2022 6:16 am
freecadlzh wrote: Thu Jan 27, 2022 12:01 am In forum, I can not share the .vtk file, so I copy the file content above. Please plaste the data into a file, and name the file to .vtk file, then can use it . Thanks a lot.
You can add a zip file.
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: How to adjust the VTK file drawing code in Freecad?

Post by wmayer »

When I load the file then I can choose between two options:
  • load as FEM result VTK file
  • load as FEM mesh file
For both options this error message appears several times:
Warning: In /build/vtk7-w4DzBd/vtk7-7.1.1+dfsg1/IO/Legacy/vtkDataReader.cxx, line 490
vtkDataSetReader (0x49063d0): Reading file version: 4.2 with older reader version 4.1
When loading as result object I get the same visual representation as the OP but loading as mesh shows the cube.
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: How to adjust the VTK file drawing code in Freecad?

Post by wmayer »

When I copy & paste the content inside the code tags then loading the VTK file as mesh causes a segmentation fault. The problem is the empty first line.
This is fixed with: git commit 7ef448572d

After removing this line it works to load as mesh file (but still not as result file).
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: How to adjust the VTK file drawing code in Freecad?

Post by wmayer »

When loading as result object then this is the code line where it happens: https://github.com/FreeCAD/FreeCAD/blob ... e.cpp#L150

The entry point to update the visual representation is: https://github.com/FreeCAD/FreeCAD/blob ... ne.cpp#L62
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: How to adjust the VTK file drawing code in Freecad?

Post by wmayer »

After having loaded the file then the default display mode is set to Outline and that's why you get what you see. So, in the property editor under View change the display mode to e.g. Surface which shows you a blue cube. Afterwards you can change the Field property to set the colouring.
Post Reply