Skip to main content
Fixed typo
Source Link
Michael E2
  • 244.8k
  • 18
  • 351
  • 774

Export to "VTK" does not handle Arrow, not even Arrow[Tube[..]]; but it can handle Tube and CylinderCone:

$maxlen = 0.08;
$aratio = 4.;
tubeArrow[p : {p1_, p2_}, radius_: 0.05] := Module[{len, v, r},
   v = p2 - p1;
   len = 0.5 Norm[v];
   len = Min[$maxlen, len];
   v = len*Normalize[v];
   r = len/$aratio;
   {Tube[{p1, p2 - v}, 0.5 r], Cone[{p2 - v, p2}, r]}
   ];

VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}] /. 
 Arrow -> tubeArrow

enter image description here

Export["/tmp/foo.vtk", 
 foo = VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}] /. 
   Arrow -> tubeArrow]
(*  "/tmp/foo.vtk"  *)

Import["/tmp/foo.vtk"]

enter image description here

Export to "VTK" does not handle Arrow, not even Arrow[Tube[..]]; but it can handle Tube and Cylinder:

$maxlen = 0.08;
$aratio = 4.;
tubeArrow[p : {p1_, p2_}, radius_: 0.05] := Module[{len, v, r},
   v = p2 - p1;
   len = 0.5 Norm[v];
   len = Min[$maxlen, len];
   v = len*Normalize[v];
   r = len/$aratio;
   {Tube[{p1, p2 - v}, 0.5 r], Cone[{p2 - v, p2}, r]}
   ];

VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}] /. 
 Arrow -> tubeArrow

enter image description here

Export["/tmp/foo.vtk", 
 foo = VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}] /. 
   Arrow -> tubeArrow]
(*  "/tmp/foo.vtk"  *)

Import["/tmp/foo.vtk"]

enter image description here

Export to "VTK" does not handle Arrow, not even Arrow[Tube[..]]; but it can handle Tube and Cone:

$maxlen = 0.08;
$aratio = 4.;
tubeArrow[p : {p1_, p2_}, radius_: 0.05] := Module[{len, v, r},
   v = p2 - p1;
   len = 0.5 Norm[v];
   len = Min[$maxlen, len];
   v = len*Normalize[v];
   r = len/$aratio;
   {Tube[{p1, p2 - v}, 0.5 r], Cone[{p2 - v, p2}, r]}
   ];

VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}] /. 
 Arrow -> tubeArrow

enter image description here

Export["/tmp/foo.vtk", 
 foo = VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}] /. 
   Arrow -> tubeArrow]
(*  "/tmp/foo.vtk"  *)

Import["/tmp/foo.vtk"]

enter image description here

Source Link
Michael E2
  • 244.8k
  • 18
  • 351
  • 774

Export to "VTK" does not handle Arrow, not even Arrow[Tube[..]]; but it can handle Tube and Cylinder:

$maxlen = 0.08;
$aratio = 4.;
tubeArrow[p : {p1_, p2_}, radius_: 0.05] := Module[{len, v, r},
   v = p2 - p1;
   len = 0.5 Norm[v];
   len = Min[$maxlen, len];
   v = len*Normalize[v];
   r = len/$aratio;
   {Tube[{p1, p2 - v}, 0.5 r], Cone[{p2 - v, p2}, r]}
   ];

VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}] /. 
 Arrow -> tubeArrow

enter image description here

Export["/tmp/foo.vtk", 
 foo = VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}] /. 
   Arrow -> tubeArrow]
(*  "/tmp/foo.vtk"  *)

Import["/tmp/foo.vtk"]

enter image description here