1 package org.simantics.plant3d.geometry;
3 import java.util.Collection;
4 import java.util.Collections;
7 import org.jcae.opencascade.jni.TopoDS_Shape;
8 import org.simantics.db.Resource;
9 import org.simantics.g3d.math.MathTools;
10 import org.simantics.opencascade.OccTriangulator;
12 public class CheckValveGeometryProvider extends BuiltinGeometryProvider {
14 public CheckValveGeometryProvider(Resource resource) {
18 private double radius = 0.01;
21 public Collection<TopoDS_Shape> getModel() throws Exception {
22 if (radius < MathTools.NEAR_ZERO)
23 return Collections.emptyList();
24 double l = radius*0.2;
25 TopoDS_Shape cyl = OccTriangulator.makeCylinder(new double[] {radius-l, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius, l);
26 TopoDS_Shape con = OccTriangulator.makeCone(new double[] {-radius, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius, radius*0.1,radius*2);
27 TopoDS_Shape shape = OccTriangulator.makeFuse(cyl, con);
30 return Collections.singletonList(shape);
34 public void setProperties(Map<String, Object> props) {
35 if (props.containsKey("radius")) {
36 radius = (Double)props.get("radius");
38 if (radius < MathTools.NEAR_ZERO)
39 radius = MathTools.NEAR_ZERO;
44 public void updateCalculatedProperties(Map<String, Object> returnProps) {
45 returnProps.put("length", radius*2);