--- /dev/null
+import "Plant3d/Utils/P3DUtil"
+import "Simantics/DB"
+import "Plant3d/Utils/Loader"
+import "G3D/SCLUtil"
+import "JavaBuiltin"
+import "G3D/Math/Tuple3d" as T3D
+import "G3D/Math/Vector3d" as V3D
+import "G3D/Scenegraph/G3DNode" as G3D
+import "Plant3d/Scenegraph/P3DRootNode" as P3R
+import "Plant3d/Scenegraph/P3DNode" as P3N
+import "Plant3d/Scenegraph/Equipment" as E
+import "Plant3d/Scenegraph/PipelineComponent" as PC
+import "Plant3d/Scenegraph/EndComponent" as EC
+import "Plant3d/Scenegraph/InlineComponent" as IC
+import "Plant3d/Scenegraph/TurnComponent" as TC
+import "Plant3d/Utils/P3DScriptNodeMap" as P3S
+import "Plant3d/Utils/P3DUtil" as P3DUtil
+import "Plant3d/Utils/ComponentUtils" as CU
+import "http://www.simantics.org/Layer0-1.1" as L0
+
+doTest :: <Proc> ()
+doTest = do
+
+ myModel = syncWrite(\_ -> do
+ myModel = P3DUtil.createModel "Test1"
+ claim (resource "http://Projects/Development%20Project") L0.ConsistsOf myModel
+ myModel)
+ p3dmap = load myModel
+ rootMaybe = javaSafeCoerce (P3S.getRootNode p3dmap) :: Maybe P3R.P3DRootNode
+ root = fromJust rootMaybe
+ pump = CU.createEquipmentWithURI root "http://www.simantics.org/Plant3D-0.1/Builtin/Pump"
+ P3N.setName pump "My Pump"
+ P3S.commit p3dmap "Created a pump"
+ P3S.update p3dmap
+ n1 = CU.createDefaultNozzle root pump
+ P3S.commit p3dmap "Created a nozzle"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce n1) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 1.0)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+ elbow = CU.addComponent root (unsafeCoerce pipe) (CU.createFixedTurn "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow90" PC.NEXT PC.NEXT)
+ TC.setRotationAngle (unsafeCoerce elbow) (Just 90.0)
+ P3S.commit p3dmap "Created a elbow"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce elbow) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 2.0)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+ elbow = CU.addComponent root (unsafeCoerce pipe) (CU.createFixedTurn "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow90" PC.NEXT PC.NEXT)
+ TC.setRotationAngle (unsafeCoerce elbow) (Just 180.0)
+ P3S.commit p3dmap "Created a elbow"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce elbow) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 1.0)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+ elbow = CU.addComponent root (unsafeCoerce pipe) (CU.createFixedTurn "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow90" PC.NEXT PC.NEXT)
+ TC.setRotationAngle (unsafeCoerce elbow) (Just 180.0)
+ P3S.commit p3dmap "Created a elbow"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce elbow) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 4.0)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+ elbow = CU.addComponent root (unsafeCoerce pipe) (CU.createFixedTurn "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow90" PC.NEXT PC.NEXT)
+ TC.setRotationAngle (unsafeCoerce elbow) (Just 180.0)
+ P3S.commit p3dmap "Created a elbow"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce elbow) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 4.0)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+ elbow = CU.addComponent root (unsafeCoerce pipe) (CU.createFixedTurn "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow90" PC.NEXT PC.NEXT)
+ TC.setRotationAngle (unsafeCoerce elbow) (Just 270.0)
+ P3S.commit p3dmap "Created a elbow"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce elbow) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 1.85)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+ elbow = CU.addComponent root (unsafeCoerce pipe) (CU.createFixedTurn "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow90" PC.NEXT PC.NEXT)
+ TC.setRotationAngle (unsafeCoerce elbow) (Just 270.0)
+ P3S.commit p3dmap "Created a elbow"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce elbow) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 1.0)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+
+ tank = CU.createEquipmentWithURI root "http://www.simantics.org/Plant3D-0.1/Builtin/HorizontalTank"
+ P3N.setName tank "My Tank"
+ G3D.setPosition tank (V3D.createVector3d 0.0 0.0 3.0)
+ P3S.commit p3dmap "Created a tank"
+ P3S.update p3dmap
+ n2 = CU.createDefaultNozzle root tank
+ G3D.setPosition n2 (V3D.createVector3d 0.6 0.3 0.0)
+ P3S.commit p3dmap "Created a nozzle"
+ P3S.update p3dmap
+
+ CU.connect pipe (unsafeCoerce n2)
+ P3S.commit p3dmap "Connected a pipe to a nozzle"
+ P3S.update p3dmap
+ ()
\ No newline at end of file
--- /dev/null
+import "Plant3d/Utils/P3DUtil"
+import "Simantics/DB"
+import "Plant3d/Utils/Loader"
+import "G3D/SCLUtil"
+import "JavaBuiltin"
+import "G3D/Math/Tuple3d" as T3D
+import "G3D/Math/Vector3d" as V3D
+import "G3D/Scenegraph/G3DNode" as G3D
+import "Plant3d/Scenegraph/P3DRootNode" as P3R
+import "Plant3d/Scenegraph/P3DNode" as P3N
+import "Plant3d/Scenegraph/Equipment" as E
+import "Plant3d/Scenegraph/PipelineComponent" as PC
+import "Plant3d/Scenegraph/EndComponent" as EC
+import "Plant3d/Scenegraph/InlineComponent" as IC
+import "Plant3d/Scenegraph/TurnComponent" as TC
+import "Plant3d/Utils/P3DScriptNodeMap" as P3S
+import "Plant3d/Utils/P3DUtil" as P3DUtil
+import "Plant3d/Utils/ComponentUtils" as CU
+import "http://www.simantics.org/Layer0-1.1" as L0
+
+
+doTest :: ()
+doTest = do
+
+ myModel = syncWrite(\_ -> do
+ myModel = P3DUtil.createModel "Test1b"
+ claim (resource "http://Projects/Development%20Project") L0.ConsistsOf myModel
+ myModel)
+ p3dmap = load myModel
+ rootMaybe = javaSafeCoerce (P3S.getRootNode p3dmap) :: Maybe P3R.P3DRootNode
+ root = fromJust rootMaybe
+ pump = CU.createEquipmentWithURI root "http://www.simantics.org/Plant3D-0.1/Builtin/Pump"
+ P3N.setName pump "My Pump"
+ P3S.commit p3dmap "Created a pump"
+ P3S.update p3dmap
+ n1 = CU.createDefaultNozzle root pump
+ P3S.commit p3dmap "Created a nozzle"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce n1) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 1.0)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+ elbow = CU.addComponent root (unsafeCoerce pipe) (CU.createFixedTurn "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow90" PC.NEXT PC.NEXT)
+ TC.setRotationAngle (unsafeCoerce elbow) (Just 90.0)
+ P3S.commit p3dmap "Created a elbow"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce elbow) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 2.0)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+ elbow = CU.addComponent root (unsafeCoerce pipe) (CU.createFixedTurn "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow90" PC.NEXT PC.NEXT)
+ TC.setRotationAngle (unsafeCoerce elbow) (Just 180.0)
+ P3S.commit p3dmap "Created a elbow"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce elbow) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 1.0)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+ elbow = CU.addComponent root (unsafeCoerce pipe) (CU.createFixedTurn "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow90" PC.NEXT PC.NEXT)
+ TC.setRotationAngle (unsafeCoerce elbow) (Just 180.0)
+ P3S.commit p3dmap "Created a elbow"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce elbow) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 4.0)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+ elbow = CU.addComponent root (unsafeCoerce pipe) (CU.createFixedTurn "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow90" PC.NEXT PC.NEXT)
+ TC.setRotationAngle (unsafeCoerce elbow) (Just 180.0)
+ P3S.commit p3dmap "Created a elbow"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce elbow) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 4.0)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+ elbow = CU.addComponent root (unsafeCoerce pipe) (CU.createFixedTurn "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow90" PC.NEXT PC.NEXT)
+ TC.setRotationAngle (unsafeCoerce elbow) (Just 270.0)
+ P3S.commit p3dmap "Created a elbow"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce elbow) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 1.85)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+ elbow = CU.addComponent root (unsafeCoerce pipe) (CU.createFixedTurn "http://www.simantics.org/Plant3D-0.1/Builtin/Elbow90" PC.NEXT PC.NEXT)
+ TC.setRotationAngle (unsafeCoerce elbow) (Just 270.0)
+ P3S.commit p3dmap "Created a elbow"
+ P3S.update p3dmap
+ pipe = CU.addComponent root (unsafeCoerce elbow) (CU.createVariableLength "http://www.simantics.org/Plant3D-0.1/Builtin/Straight" PC.NEXT PC.NEXT 1.0)
+ P3S.commit p3dmap "Created a pipe"
+ P3S.update p3dmap
+
+ tank = CU.createEquipmentWithURI root "http://www.simantics.org/Plant3D-0.1/Builtin/HorizontalTank"
+ P3N.setName tank "My Tank"
+ G3D.setPosition tank (V3D.createVector3d 0.0 0.0 3.0)
+ P3S.commit p3dmap "Created a tank"
+ P3S.update p3dmap
+ n2 = CU.createDefaultNozzle root tank
+ G3D.setPosition n2 (V3D.createVector3d 0.6 0.3 0.0)
+ P3S.commit p3dmap "Created a nozzle"
+ P3S.update p3dmap
+
+ CU.connect (unsafeCoerce n2) pipe
+ P3S.commit p3dmap "Connected a pipe to a nozzle"
+ P3S.update p3dmap
+ ()
\ No newline at end of file