]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/geometry/NozzleGeometryProvider.java
Add units to ComponentSelectionDialog
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / geometry / NozzleGeometryProvider.java
index cdfe73ccd4bcd1ab31ea829e3f0e86bdcba87e8d..0b0f4884a1554a9fe45bca11123530aa888973d9 100644 (file)
@@ -6,6 +6,7 @@ import java.util.Map;
 
 import org.jcae.opencascade.jni.TopoDS_Shape;
 import org.simantics.db.Resource;
+import org.simantics.g3d.math.MathTools;
 import org.simantics.opencascade.OccTriangulator;
 
 public class NozzleGeometryProvider extends BuiltinGeometryProvider  {
@@ -19,6 +20,8 @@ public class NozzleGeometryProvider extends BuiltinGeometryProvider  {
        
        @Override
        public Collection<TopoDS_Shape> getModel() throws Exception {
+               if (radius < MathTools.NEAR_ZERO || length < MathTools.NEAR_ZERO)
+                       return Collections.emptyList();
                TopoDS_Shape shape = OccTriangulator.makeCylinder(new double[] {-length, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius, length);
                TopoDS_Shape shape2 = OccTriangulator.makeCylinder(new double[] {-length*0.25, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius*1.2, length*0.25);
                TopoDS_Shape shape3 = OccTriangulator.makeCompound(new TopoDS_Shape[]{shape,shape2});