P3D.SizeChangeComponent <R P3D.PipelineComponentTag
L0.HasDescription "Component that changes pipe run along main pipeline. (Spec change)" : L0.String
P3D.OffsetComponent<R P3D.PipelineComponentTag
- L0.HasDescription "Component that offsets the center of piperun." : L0.String
+ L0.HasDescription "Component that offsets the center of piperun." : L0.String
+P3D.RotateComponent<R P3D.PipelineComponentTag
+ L0.HasDescription "Inline Component that can be rotated around pipe axis." : L0.String
P3D.CodeComponent <T P3D.PipelineComponentTag
- L0.HasDescription "Compoenent that cannot be added directly by user" : L0.String
+ L0.HasDescription "Component that cannot be added directly by user" : L0.String
P3D.NonVisibleComponent <R P3D.PipelineComponentTag
L0.HasDescription "(Pseudo) Component that cannot bee seen." : L0.String
// L0.HasRange L0.Double
//P3D.HasTurnAngle <R G3D.hasNonTransformation
// L0.HasRange L0.Double
-//P3D.HasRotationAngle <R G3D.hasTransformation
-// L0.HasRange L0.Double
+P3D.HasRotationAngle <R G3D.hasTransformation
+ L0.HasRange L0.Double
//P3D.HasOffset <R L0.HasProperty
// L0.HasRange L0.Double
//HasRelativePosition <R HasProperty
P3D.Builtin.PumpGeometryProvider : P3D.Builtin.GeometryProvider
P3D.Builtin.BallValveGeometryProvider : P3D.Builtin.GeometryProvider
P3D.Builtin.CheckValveGeometryProvider : P3D.Builtin.GeometryProvider
+P3D.Builtin.GateValveGeometryProvider : P3D.Builtin.GeometryProvider
P3D.Builtin.CapGeometryProvider : P3D.Builtin.GeometryProvider
@L0.tag P3D.SizeChangeComponent
@L0.tag P3D.FixedLengthInlineComponent
@L0.tag P3D.DualConnectedComponent
+ @L0.tag P3D.RotateComponent
// HasRotationAngle "0.0" : Double
// HasControlPoint
// _ : SizeChangeControlPoint : OffsettingPoint
L0.HasName "radius" : L0.String
P3D.hasParameterValue 0.1 : L0.Double
+P3D.Builtin.GateValve <T P3D.InlineComponent : P3D.InlineComponent
+ @L0.tag P3D.DualConnectedComponent
+ @L0.tag P3D.FixedLengthInlineComponent
+ @L0.tag P3D.RotateComponent
+ @L0.assert P3D.hasGeometry P3D.Builtin.GateValveGeometryProvider
+ @L0.assert P3D.hasParameter
+ _ :P3D.Parameter
+ L0.HasName "radius" : L0.String
+ P3D.hasParameterValue 0.1 : L0.Double
+
P3D.Builtin.Cap <T P3D.EndComponent : P3D.InlineComponent
@L0.assert P3D.hasGeometry P3D.Builtin.CapGeometryProvider
@L0.assert P3D.hasParameter
public final Resource Builtin_EccentricReducer;
public final Resource Builtin_Elbow;
public final Resource Builtin_ElbowGeometryProvider;
+ public final Resource Builtin_GateValve;
+ public final Resource Builtin_GateValveGeometryProvider;
public final Resource Builtin_GeometryProvider;
public final Resource Builtin_HorizontalTank;
public final Resource Builtin_HorizontalTankGeometryProvider;
public final Resource HasPipeDiameter_Inverse;
public final Resource HasPipeRun;
public final Resource HasPrevious;
+ public final Resource HasRotationAngle;
+ public final Resource HasRotationAngle_Inverse;
public final Resource HasTurnAxis;
public final Resource HasTurnAxis_Inverse;
public final Resource HasTurnRadius;
public final Resource PipelineComponentTag;
public final Resource Plant;
public final Resource PreviousInverse;
+ public final Resource RotateComponent;
public final Resource SingleConnectedComponent;
public final Resource SizeChangeComponent;
public final Resource TurnComponent;
public static final String Builtin_EccentricReducer = "http://www.simantics.org/Plant3D-0.1/Builtin/EccentricReducer";
public static final String Builtin_Elbow = "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow";
public static final String Builtin_ElbowGeometryProvider = "http://www.simantics.org/Plant3D-0.1/Builtin/ElbowGeometryProvider";
+ public static final String Builtin_GateValve = "http://www.simantics.org/Plant3D-0.1/Builtin/GateValve";
+ public static final String Builtin_GateValveGeometryProvider = "http://www.simantics.org/Plant3D-0.1/Builtin/GateValveGeometryProvider";
public static final String Builtin_GeometryProvider = "http://www.simantics.org/Plant3D-0.1/Builtin/GeometryProvider";
public static final String Builtin_HorizontalTank = "http://www.simantics.org/Plant3D-0.1/Builtin/HorizontalTank";
public static final String Builtin_HorizontalTankGeometryProvider = "http://www.simantics.org/Plant3D-0.1/Builtin/HorizontalTankGeometryProvider";
public static final String HasPipeDiameter_Inverse = "http://www.simantics.org/Plant3D-0.1/HasPipeDiameter/Inverse";
public static final String HasPipeRun = "http://www.simantics.org/Plant3D-0.1/HasPipeRun";
public static final String HasPrevious = "http://www.simantics.org/Plant3D-0.1/HasPrevious";
+ public static final String HasRotationAngle = "http://www.simantics.org/Plant3D-0.1/HasRotationAngle";
+ public static final String HasRotationAngle_Inverse = "http://www.simantics.org/Plant3D-0.1/HasRotationAngle/Inverse";
public static final String HasTurnAxis = "http://www.simantics.org/Plant3D-0.1/HasTurnAxis";
public static final String HasTurnAxis_Inverse = "http://www.simantics.org/Plant3D-0.1/HasTurnAxis/Inverse";
public static final String HasTurnRadius = "http://www.simantics.org/Plant3D-0.1/HasTurnRadius";
public static final String PipelineComponentTag = "http://www.simantics.org/Plant3D-0.1/PipelineComponentTag";
public static final String Plant = "http://www.simantics.org/Plant3D-0.1/Plant";
public static final String PreviousInverse = "http://www.simantics.org/Plant3D-0.1/PreviousInverse";
+ public static final String RotateComponent = "http://www.simantics.org/Plant3D-0.1/RotateComponent";
public static final String SingleConnectedComponent = "http://www.simantics.org/Plant3D-0.1/SingleConnectedComponent";
public static final String SizeChangeComponent = "http://www.simantics.org/Plant3D-0.1/SizeChangeComponent";
public static final String TurnComponent = "http://www.simantics.org/Plant3D-0.1/TurnComponent";
Builtin_EccentricReducer = getResourceOrNull(graph, URIs.Builtin_EccentricReducer);
Builtin_Elbow = getResourceOrNull(graph, URIs.Builtin_Elbow);
Builtin_ElbowGeometryProvider = getResourceOrNull(graph, URIs.Builtin_ElbowGeometryProvider);
+ Builtin_GateValve = getResourceOrNull(graph, URIs.Builtin_GateValve);
+ Builtin_GateValveGeometryProvider = getResourceOrNull(graph, URIs.Builtin_GateValveGeometryProvider);
Builtin_GeometryProvider = getResourceOrNull(graph, URIs.Builtin_GeometryProvider);
Builtin_HorizontalTank = getResourceOrNull(graph, URIs.Builtin_HorizontalTank);
Builtin_HorizontalTankGeometryProvider = getResourceOrNull(graph, URIs.Builtin_HorizontalTankGeometryProvider);
HasPipeDiameter_Inverse = getResourceOrNull(graph, URIs.HasPipeDiameter_Inverse);
HasPipeRun = getResourceOrNull(graph, URIs.HasPipeRun);
HasPrevious = getResourceOrNull(graph, URIs.HasPrevious);
+ HasRotationAngle = getResourceOrNull(graph, URIs.HasRotationAngle);
+ HasRotationAngle_Inverse = getResourceOrNull(graph, URIs.HasRotationAngle_Inverse);
HasTurnAxis = getResourceOrNull(graph, URIs.HasTurnAxis);
HasTurnAxis_Inverse = getResourceOrNull(graph, URIs.HasTurnAxis_Inverse);
HasTurnRadius = getResourceOrNull(graph, URIs.HasTurnRadius);
PipelineComponentTag = getResourceOrNull(graph, URIs.PipelineComponentTag);
Plant = getResourceOrNull(graph, URIs.Plant);
PreviousInverse = getResourceOrNull(graph, URIs.PreviousInverse);
+ RotateComponent = getResourceOrNull(graph, URIs.RotateComponent);
SingleConnectedComponent = getResourceOrNull(graph, URIs.SingleConnectedComponent);
SizeChangeComponent = getResourceOrNull(graph, URIs.SizeChangeComponent);
TurnComponent = getResourceOrNull(graph, URIs.TurnComponent);
<resource uri="http://www.simantics.org/Plant3D-0.1/Builtin/CheckValveGeometryProvider"
class="org.simantics.plant3d.geometry.CheckValveGeometryProvider">
<this />
+ </resource>
+ <resource uri="http://www.simantics.org/Plant3D-0.1/Builtin/GateValveGeometryProvider"
+ class="org.simantics.plant3d.geometry.GateValveGeometryProvider">
+ <this />
</resource>
<resource uri="http://www.simantics.org/Plant3D-0.1/Builtin/CapGeometryProvider"
class="org.simantics.plant3d.geometry.CapGeometryProvider">
--- /dev/null
+package org.simantics.plant3d.geometry;
+
+import java.util.Collection;
+import java.util.Collections;
+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 GateValveGeometryProvider extends BuiltinGeometryProvider {
+
+ public GateValveGeometryProvider(Resource resource) {
+ super(resource);
+ }
+
+ private double radius = 0.01;
+
+ @Override
+ public Collection<TopoDS_Shape> getModel() throws Exception {
+
+ 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);
+ TopoDS_Shape con2 = OccTriangulator.makeCone(new double[] {radius, 0.0, 0.0}, new double[] { -1.0, 0.0, 0.0 }, radius, radius*0.1,radius);
+ //TopoDS_Shape sph = OccTriangulator.makeSphere(0, 0, 0, radius*0.75);
+ //TopoDS_Shape cyl = OccTriangulator.makeCylinder(new double[] {0.0, 0.0, 0.0}, new double[] { 0.0, 1.0, 0.0 }, radius*0.75, radius*2);
+ TopoDS_Shape cyl = OccTriangulator.makeFillet(OccTriangulator.makeBox(-radius*0.5, -radius*0.5, -radius*0.75, radius*0.5, radius*1.25, radius*0.75), radius*0.25);
+ //TopoDS_Shape cyl = OccTriangulator.makeChamfer(OccTriangulator.makeBox(-radius*0.5, -radius*0.5, -radius*0.75, radius*0.5, radius*1.25, radius*0.75), radius*0.25);
+ TopoDS_Shape cyl2 = OccTriangulator.makeCylinder(new double[] {0.0, 0.0, 0.0}, new double[] { 0.0, 1.0, 0.0 }, radius*0.125, radius*2);
+ TopoDS_Shape tor = OccTriangulator.makeTorus(new double[] { 0.0, radius*2, 0.0}, new double[] { 0.0, 1.0, 0.0 }, radius*0.5, radius*0.125);
+
+ TopoDS_Shape shape = OccTriangulator.makeCompound(new TopoDS_Shape[] {con,con2,cyl,cyl2,tor});
+ cyl.delete();
+ con.delete();
+ con2.delete();
+ //sph.delete();
+ tor.delete();
+ return Collections.singletonList(shape);
+ }
+
+ @Override
+ public void setProperties(Map<String, Object> props) {
+ if (props.containsKey("radius")) {
+ radius = (Double)props.get("radius");
+ }
+ if (radius < MathTools.NEAR_ZERO)
+ radius = MathTools.NEAR_ZERO;
+
+ }
+
+ @Override
+ public void updateCalculatedProperties(Map<String, Object> returnProps) {
+ returnProps.put("length", radius*2);
+
+ }
+
+
+}
import java.util.Collections;
import java.util.Map;
-import org.jcae.opencascade.jni.BRepBuilderAPI_MakeEdge;
-import org.jcae.opencascade.jni.BRepBuilderAPI_MakeFace;
-import org.jcae.opencascade.jni.BRepBuilderAPI_MakeWire;
-import org.jcae.opencascade.jni.BRepPrimAPI_MakeRevol;
-import org.jcae.opencascade.jni.GC_MakeArcOfCircle;
-import org.jcae.opencascade.jni.GC_MakeSegment;
-import org.jcae.opencascade.jni.TopoDS_Edge;
-import org.jcae.opencascade.jni.TopoDS_Face;
import org.jcae.opencascade.jni.TopoDS_Shape;
-import org.jcae.opencascade.jni.TopoDS_Wire;
import org.simantics.db.Resource;
import org.simantics.opencascade.OccTriangulator;
import java.util.HashMap;
import java.util.Map;
+import org.simantics.g3d.math.MathTools;
+import org.simantics.g3d.property.annotations.GetPropertyValue;
+import org.simantics.g3d.property.annotations.SetPropertyValue;
import org.simantics.g3d.scenegraph.base.ParentNode;
import org.simantics.objmap.graph.annotations.DynamicGraphType;
import org.simantics.objmap.graph.annotations.GetType;
+import org.simantics.objmap.graph.annotations.RelatedGetValue;
+import org.simantics.objmap.graph.annotations.RelatedSetValue;
import org.simantics.objmap.graph.annotations.SetType;
import org.simantics.plant3d.ontology.Plant3D;
import org.simantics.plant3d.scenegraph.controlpoint.ControlPointFactory;
import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint;
+import org.simantics.plant3d.scenegraph.controlpoint.PipingRules;
@DynamicGraphType(Plant3D.URIs.InlineComponent)
public class InlineComponent extends PipelineComponent {
return !controlPoint.isFixed();
}
+ @RelatedGetValue(Plant3D.URIs.HasRotationAngle)
+ @GetPropertyValue(name="Rotation Angle", value=Plant3D.URIs.HasRotationAngle, tabId = "Default")
+ public Double getRotationAngle() {
+ if (!controlPoint.isRotate())
+ return null;
+ Double d = controlPoint.getRotationAngle();
+ if (d == null)
+ return 0.0;
+ return MathTools.radToDeg(d);
+ }
+ @RelatedSetValue(Plant3D.URIs.HasRotationAngle)
+ @SetPropertyValue(value=Plant3D.URIs.HasRotationAngle)
+ public void setRotationAngle(Double angle) {
+ if (!controlPoint.isRotate())
+ return;
+
+ if (angle == null || Double.isInfinite(angle) || Double.isNaN(angle)) {
+ return;
+ }
+ angle = MathTools.degToRad(angle);
+ if (controlPoint.getRotationAngle() != null && Math.abs(controlPoint.getRotationAngle()-angle) < MathTools.NEAR_ZERO)
+ return;
+ controlPoint.setRotationAngle(angle);
+ try {
+ PipingRules.requestUpdate(getControlPoint());
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
@Override
public void updateParameters() {
super.updateParameters();
PipeControlPoint pcp = new PipeControlPoint(component);
pcp.setType(inst.type);
pcp.setFixed(inst.fixed);
+ pcp.setRotate(inst.isRotate);
switch(inst.type) {
case END:
boolean fixed;
boolean isOffset;
boolean isSizeChange;
-
+ boolean isRotate;
}
i.fixed = false;
i.isOffset = false;
i.isSizeChange = false;
+ i.isRotate = false;
i.type = Type.INLINE;
if (graph.isInheritedFrom(res, p3d.Nozzle)) {
i.fixed = true;
if (graph.hasStatement(res,p3d.OffsetComponent)) {
i.isOffset = true;
}
+ if (graph.hasStatement(res,p3d.RotateComponent)) {
+ i.isRotate = true;
+ }
} else if (graph.isInheritedFrom(res, p3d.TurnComponent)) {
i.type = Type.TURN;
private Type type;
private boolean fixed = true;
+ private boolean rotate = false;
private boolean deletable = true;
private boolean sub = false;
this.fixed = fixed;
}
+ @GetPropertyValue(name="Rotate",tabId="Debug",value="rotate")
+ public boolean isRotate() {
+ return rotate;
+ }
+
+
+ public void setRotate(boolean rotate) {
+ this.rotate = rotate;
+ }
+
public void setSub(boolean sub) {
this.sub = sub;
}
types.add(Plant3D.URIs.Builtin_Elbow);
types.add(Plant3D.URIs.Builtin_ConcentricReducer);
types.add(Plant3D.URIs.Builtin_BranchSplitComponent);
-// types.add(Plant3D.URIs.Builtin_EccentricReducer);
+ types.add(Plant3D.URIs.Builtin_EccentricReducer);
for (String typeURI : types) {
load(graph, typeURI);