Exemple #1
0
		static void Main(string[] args)
		{
			msgCore.InitKernel();
			msg3DObject.AutoTriangulate(true, msgTriangulationTypeEnum.SG_DELAUNAY_TRIANGULATION);

			msgCircleStruct circleStruct = new msgCircleStruct();
			msgPointStruct p1 = new msgPointStruct();
			p1.x = 0;
			p1.y = 0;
			p1.z = 0;

			msgPointStruct p2 = new msgPointStruct();
			p2.x = 1;
			p2.y = 1;
			p2.z = 1;

			msgPointStruct p3 = new msgPointStruct();
			p3.x = 0;
			p3.y = 0;
			p3.z = 1;
			circleStruct.FromThreePoints(p1, p2, p3);

			msgCircle circle = msgCircle.Create(circleStruct);

			msgCore.FreeKernel();
		}
Exemple #2
0
        static void Main(string[] args)
        {
            msgCore.InitKernel();
            msg3DObject.AutoTriangulate(true, msgTriangulationTypeEnum.SG_DELAUNAY_TRIANGULATION);

            msgCircleStruct circleStruct = new msgCircleStruct();
            msgPointStruct  p1           = new msgPointStruct();

            p1.x = 0;
            p1.y = 0;
            p1.z = 0;

            msgPointStruct p2 = new msgPointStruct();

            p2.x = 1;
            p2.y = 1;
            p2.z = 1;

            msgPointStruct p3 = new msgPointStruct();

            p3.x = 0;
            p3.y = 0;
            p3.z = 1;
            circleStruct.FromThreePoints(p1, p2, p3);

            msgCircle circle = msgCircle.Create(circleStruct);

            msgCore.FreeKernel();
        }
Exemple #3
0
        public static void CreateExtrudeBody()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(30.0, 25.0, -2.0, 0.0, -2.0);

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl2 = msgSplineStruct.Create();
            int             fl   = 0;

            for (double i = 0.0; i < 2.0 * 3.14159265; i += 0.13)
            {
                tmpPnt.x = ((double)(fl % 3 + 2)) * Math.Cos(i);
                tmpPnt.y = ((double)(fl % 3 + 2)) * Math.Sin(i);
                tmpPnt.z = 0.0;
                spl2.AddKnot(tmpPnt, fl);
                fl++;
            }
            spl2.Close();

            msgSpline spl2_obj = msgSpline.Create(spl2);

            msgSplineStruct.Delete(spl2);
            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgCircleStruct cirGeo = new msgCircleStruct();
            msgPointStruct  cirC   = new msgPointStruct(0.0, 0.0, 0.0);
            msgVectorStruct cirNor = new msgVectorStruct(0.0, 0.0, 1.0);

            cirGeo.FromCenterRadiusNormal(cirC, 1.6, cirNor);
            msg2DObject cir = msgCircle.Create(cirGeo);

            scene.AttachObject(cir);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgVectorStruct extVec = new msgVectorStruct(1, -2, 5);

            msg3DObject exO = (msg3DObject)msgKinematic.Extrude(spl2_obj, new msg2DObject[] { cir }, extVec, true);

            scene.AttachObject(exO);
            exO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 30);

            msgVectorStruct transV1 = new msgVectorStruct(-7, 0, 0);

            exO.InitTempMatrix().Translate(transV1);
            exO.ApplyTempMatrix();
            exO.DestroyTempMatrix();
        }
Exemple #4
0
        public static void CreateExtrudeBody()
        {
            msgScene scene = msgScene.GetScene();
            scene.Clear();

            Utils.AddFloorInScene(30.0, 25.0, -2.0, 0.0, -2.0);

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl2 = msgSplineStruct.Create();
            int fl=0;
            for (double i=0.0;i<2.0*3.14159265;i+=0.13)
            {
                tmpPnt.x = ((double)(fl%3+2))*Math.Cos(i);
                tmpPnt.y = ((double)(fl%3+2))*Math.Sin(i);
                tmpPnt.z = 0.0;
                spl2.AddKnot(tmpPnt,fl);
                fl++;
            }
            spl2.Close();

            msgSpline spl2_obj = msgSpline.Create(spl2);
            msgSplineStruct.Delete(spl2);
            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgCircleStruct cirGeo = new msgCircleStruct();
            msgPointStruct cirC = new msgPointStruct(0.0, 0.0, 0.0);
            msgVectorStruct cirNor = new msgVectorStruct(0.0, 0.0, 1.0);
            cirGeo.FromCenterRadiusNormal(cirC,1.6, cirNor);
            msg2DObject cir = msgCircle.Create(cirGeo);
            scene.AttachObject(cir);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgVectorStruct extVec = new msgVectorStruct(1,-2,5);

            msg3DObject exO = (msg3DObject)msgKinematic.Extrude(spl2_obj, new msg2DObject[] { cir }, extVec,true);

            scene.AttachObject(exO);
            exO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 30);

            msgVectorStruct transV1 = new msgVectorStruct( -7, 0, 0 );
            exO.InitTempMatrix().Translate(transV1);
            exO.ApplyTempMatrix();
            exO.DestroyTempMatrix();
        }
Exemple #5
0
        public static void CreateSpiralBody()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgCircleStruct cirGeo1 = new msgCircleStruct();
            msgPointStruct  cirC1   = new msgPointStruct(2.0, -2.0, 0.0);
            msgVectorStruct cirNor1 = new msgVectorStruct(0.0, 0.0, 1.0);

            cirGeo1.FromCenterRadiusNormal(cirC1, 3.0, cirNor1);
            msg2DObject cir1 = msgCircle.Create(cirGeo1);

            scene.AttachObject(cir1);
            cir1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cir1.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgCircleStruct cirGeo2 = new msgCircleStruct();
            msgPointStruct  cirC2   = new msgPointStruct(2.0, -2.3, 0.0);
            msgVectorStruct cirNor2 = new msgVectorStruct(0.0, 0.0, 1.0);

            cirGeo2.FromCenterRadiusNormal(cirC2, 1.5, cirNor2);
            msg2DObject cir2 = msgCircle.Create(cirGeo2);

            scene.AttachObject(cir2);
            cir2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cir2.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgPointStruct axeP1 = new msgPointStruct(6.0, -3.0, 0.0);
            msgPointStruct axeP2 = new msgPointStruct(6.0, 3.0, 0.0);

            msg3DObject spirO = (msg3DObject)msgKinematic.Spiral(cir1, new msg2DObject[] { cir2 }, axeP1, axeP2, 12, 30, 16, true);

            scene.AttachObject(spirO);
            spirO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 56);

            msgVectorStruct transV1 = new msgVectorStruct(0, 7, 0);

            spirO.InitTempMatrix().Translate(transV1);
            spirO.ApplyTempMatrix();
            spirO.DestroyTempMatrix();
        }
Exemple #6
0
        public static void CreateFace()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl2 = msgSplineStruct.Create();

            tmpPnt.x = -1.0; tmpPnt.y = -3.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 0);
            tmpPnt.x = -3.0; tmpPnt.y = 0.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 1);
            tmpPnt.x = -1.0; tmpPnt.y = -1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 2);
            tmpPnt.x = 0.0; tmpPnt.y = 1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 3);
            tmpPnt.x = -1.0; tmpPnt.y = 4.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 4);
            tmpPnt.x = 3.0; tmpPnt.y = 1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 5);
            tmpPnt.x = 2.0; tmpPnt.y = -3.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 6);
            tmpPnt.x = 1.0; tmpPnt.y = -1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 7);
            tmpPnt.x = 1.0; tmpPnt.y = -4.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 8);
            spl2.Close();

            msgSpline spl2_obj = msgSpline.Create(spl2);

            msgSplineStruct.Delete(spl2);
            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);

            msg2DObject[] holes = new msg2DObject[3];

            msgCircleStruct cirGeo = new msgCircleStruct();
            msgPointStruct  cirC   = new msgPointStruct(0.8, 1.0, 0.0);
            msgVectorStruct cirNor = new msgVectorStruct(0.0, 0.0, 1.0);

            cirGeo.FromCenterRadiusNormal(cirC, 0.8, cirNor);
            holes[0] = msgCircle.Create(cirGeo);
            scene.AttachObject(holes[0]);
            holes[0].SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            holes[0].SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);

            cirC.x = 1.6; cirC.y = -1.0;
            cirGeo.FromCenterRadiusNormal(cirC, 0.2, cirNor);
            holes[1] = msgCircle.Create(cirGeo);
            scene.AttachObject(holes[1]);
            holes[1].SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            holes[1].SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);


            cirC.x = 0.0; cirC.y = -1.0;
            cirGeo.FromCenterRadiusNormal(cirC, 0.4, cirNor);
            holes[2] = msgCircle.Create(cirGeo);
            scene.AttachObject(holes[2]);
            holes[2].SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            holes[2].SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);

            msg3DObject fcO = (msg3DObject)msgSurfaces.Face(spl2_obj, holes);

            scene.AttachObject(fcO);
            fcO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 50);

            msgVectorStruct transV1 = new msgVectorStruct(-5, 0, 0);

            fcO.InitTempMatrix().Translate(transV1);
            fcO.ApplyTempMatrix();
            fcO.DestroyTempMatrix();
        }
Exemple #7
0
        public static void CreateLinear()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(30.0, 30.0, 2.0, 5.0, -2.0);

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl1 = msgSplineStruct.Create();
            int             fl   = 0;

            for (double i = 0.0; i < 2.0 * 3.14159265; i += 0.4)
            {
                tmpPnt.x = ((double)(fl % 3 + 2)) * Math.Cos(i);
                tmpPnt.y = ((double)(fl % 3 + 2)) * Math.Sin(i);
                tmpPnt.z = 0.0;
                spl1.AddKnot(tmpPnt, fl);
                fl++;
            }
            spl1.Close();

            msgSpline spl1_obj = msgSpline.Create(spl1);

            scene.AttachObject(spl1_obj);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgSplineStruct.Delete(spl1);

            msgCircleStruct cirGeo = new msgCircleStruct();

            cirGeo.center.x = 2.0; cirGeo.center.y = -2.0; cirGeo.center.z = 8.0;
            cirGeo.normal.x = 0.0; cirGeo.normal.y = 0.0; cirGeo.normal.z = 1.0;
            cirGeo.radius   = 1.5;
            msgCircle cir = msgCircle.Create(cirGeo);

            scene.AttachObject(cir);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msg3DObject linO1 = (msg3DObject)msgSurfaces.LinearSurfaceFromSections(spl1_obj,
                                                                                   cir, 0.5f, false);

            scene.AttachObject(linO1);
            linO1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 90);

            msgVectorStruct transV1 = new msgVectorStruct(0, 7, 0);

            linO1.InitTempMatrix().Translate(transV1);
            linO1.ApplyTempMatrix();
            linO1.DestroyTempMatrix();


            msg3DObject linO2 = (msg3DObject)msgSurfaces.LinearSurfaceFromSections(spl1_obj,
                                                                                   cir, 0.7f, true);

            scene.AttachObject(linO2);
            linO2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 150);

            transV1.x = 8.0; transV1.y = 0.0;
            linO2.InitTempMatrix().Translate(transV1);
            linO2.ApplyTempMatrix();
            linO2.DestroyTempMatrix();


            msg3DObject linO3 = (msg3DObject)msgSurfaces.LinearSurfaceFromSections(spl1_obj,
                                                                                   cir, 0.3f, false);

            scene.AttachObject(linO3);
            linO3.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 30);

            transV1.x = -8.0; transV1.y = 0.0;
            linO3.InitTempMatrix().Translate(transV1);
            linO3.ApplyTempMatrix();
            linO3.DestroyTempMatrix();
        }
Exemple #8
0
        public static void CreateLinear()
        {
            msgScene scene = msgScene.GetScene();
            scene.Clear();

            Utils.AddFloorInScene(30.0, 30.0, 2.0, 5.0, -2.0);

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl1 = msgSplineStruct.Create();
            int fl=0;
            for (double i=0.0;i<2.0*3.14159265;i+=0.4)
            {
                tmpPnt.x = ((double)(fl%3+2))*Math.Cos(i);
                tmpPnt.y = ((double)(fl%3+2))*Math.Sin(i);
                tmpPnt.z = 0.0;
                spl1.AddKnot(tmpPnt,fl);
                fl++;
            }
            spl1.Close();

            msgSpline spl1_obj = msgSpline.Create(spl1);
            scene.AttachObject(spl1_obj);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgSplineStruct.Delete(spl1);

            msgCircleStruct cirGeo = new msgCircleStruct();
            cirGeo.center.x = 2.0; cirGeo.center.y = -2.0; cirGeo.center.z = 8.0;
            cirGeo.normal.x = 0.0; cirGeo.normal.y = 0.0; cirGeo.normal.z = 1.0;
            cirGeo.radius = 1.5;
            cirGeo.FromCenterRadiusNormal(cirGeo.center, cirGeo.radius, cirGeo.normal);
            msgCircle cir = msgCircle.Create(cirGeo);
            scene.AttachObject(cir);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msg3DObject linO1 = (msg3DObject)msgSurfaces.LinearSurfaceFromSections(spl1_obj,
                cir, 0.5f ,false);

            scene.AttachObject(linO1);
            linO1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 90);

            msgVectorStruct transV1 = new msgVectorStruct(0,7,0);
            linO1.InitTempMatrix().Translate(transV1);
            linO1.ApplyTempMatrix();
            linO1.DestroyTempMatrix();

            msg3DObject linO2 = (msg3DObject)msgSurfaces.LinearSurfaceFromSections(spl1_obj,
                cir, 0.7f, true);

            scene.AttachObject(linO2);
            linO2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 150);

            transV1.x = 8.0; transV1.y = 0.0;
            linO2.InitTempMatrix().Translate(transV1);
            linO2.ApplyTempMatrix();
            linO2.DestroyTempMatrix();

            msg3DObject linO3 = (msg3DObject)msgSurfaces.LinearSurfaceFromSections(spl1_obj,
                cir, 0.3f, false);

            scene.AttachObject(linO3);
            linO3.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 30);

            transV1.x = -8.0; transV1.y = 0.0;
            linO3.InitTempMatrix().Translate(transV1);
            linO3.ApplyTempMatrix();
            linO3.DestroyTempMatrix();
        }
Exemple #9
0
        public static void CreateFace()
        {
            msgScene scene = msgScene.GetScene();
            scene.Clear();

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl2 = msgSplineStruct.Create();

            tmpPnt.x = -1.0; tmpPnt.y = -3.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt,0);
            tmpPnt.x = -3.0; tmpPnt.y = 0.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt,1);
            tmpPnt.x = -1.0; tmpPnt.y = -1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt,2);
            tmpPnt.x = 0.0; tmpPnt.y = 1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt,3);
            tmpPnt.x = -1.0; tmpPnt.y = 4.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt,4);
            tmpPnt.x =3.0; tmpPnt.y = 1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt,5);
            tmpPnt.x =2.0; tmpPnt.y = -3.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt,6);
            tmpPnt.x =1.0; tmpPnt.y = -1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt,7);
            tmpPnt.x =1.0; tmpPnt.y = -4.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt,8);
            spl2.Close();

            msgSpline spl2_obj = msgSpline.Create(spl2);
            msgSplineStruct.Delete(spl2);
            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);

            msg2DObject[] holes = new msg2DObject[3];

            msgCircleStruct cirGeo = new msgCircleStruct();
            msgPointStruct cirC = new msgPointStruct(0.8, 1.0, 0.0);
            msgVectorStruct cirNor = new msgVectorStruct(0.0, 0.0, 1.0);
            cirGeo.FromCenterRadiusNormal(cirC,0.8, cirNor);
            holes[0] = msgCircle.Create(cirGeo);
            scene.AttachObject(holes[0]);
            holes[0].SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            holes[0].SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);

            cirC.x = 1.6; cirC.y = -1.0;
            cirGeo.FromCenterRadiusNormal(cirC,0.2, cirNor);
            holes[1] = msgCircle.Create(cirGeo);
            scene.AttachObject(holes[1]);
            holes[1].SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            holes[1].SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);

            cirC.x = 0.0; cirC.y = -1.0;
            cirGeo.FromCenterRadiusNormal(cirC,0.4, cirNor);
            holes[2] = msgCircle.Create(cirGeo);
            scene.AttachObject(holes[2]);
            holes[2].SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            holes[2].SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);

            msg3DObject fcO = (msg3DObject)msgSurfaces.Face(spl2_obj,holes);

            scene.AttachObject(fcO);
            fcO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 50);

            msgVectorStruct transV1 = new msgVectorStruct(-5,0,0);
            fcO.InitTempMatrix().Translate(transV1);
            fcO.ApplyTempMatrix();
            fcO.DestroyTempMatrix();
        }
Exemple #10
0
		public static void CreatePipeBody()
		{
			msgScene scene = msgScene.GetScene();
			scene.Clear();

			msgObject[] objcts = new msgObject[5];

			msgPointStruct ArP1 = new msgPointStruct();
			msgPointStruct ArP2 = new msgPointStruct();
			msgPointStruct ArP3 = new msgPointStruct();
			msgArcStruct ArcGeo = new msgArcStruct();

			ArP1.x = 0.0; ArP1.y = -2.0; ArP1.z = 0.0;
			ArP2.x = 1.0; ArP2.y = -1.0; ArP2.z = 0.0;
			ArP3.x = 0.4; ArP3.y = -1.2; ArP3.z = 0.0;
			ArcGeo.FromThreePoints(ArP1,ArP2,ArP3,false);
			objcts[0] = msgArc.Create(ArcGeo);

			ArP1.x = 1.0; ArP1.y = -1.0; ArP1.z = 0.0;
			ArP2.x = 2.0; ArP2.y = 0.0; ArP2.z = 0.0;
			ArP3.x = 1.9; ArP3.y = -0.5; ArP3.z = 0.0;
			ArcGeo.FromThreePoints(ArP1,ArP2,ArP3,false);
			objcts[1] = msgArc.Create(ArcGeo);

			ArP1.x = 2.0; ArP1.y = 0.0; ArP1.z = 0.0;
			ArP2.x = 1.0; ArP2.y = 1.0; ArP2.z = 0.0;
			ArP3.x = 1.6; ArP3.y = 0.8; ArP3.z = 0.0;
			ArcGeo.FromThreePoints(ArP1,ArP2,ArP3,false);
			objcts[2] = msgArc.Create(ArcGeo);

			objcts[3] = msgLine.Create(1.0, 1.0, 0.0, -1.0, 1.0, 0.0);

			ArP1.x = -1.0; ArP1.y = 1.0; ArP1.z = 0.0;
			ArP2.x = -1.0; ArP2.y = 0.0; ArP2.z = 1.0;
			ArP3.x = -1.1; ArP3.y = 1.0; ArP3.z = 0.0;
			ArcGeo.FromThreePoints(ArP1,ArP2,ArP3,false);
			objcts[4] = msgArc.Create(ArcGeo);

			msgContour cnt1 = msgContour.CreateContour(objcts);
			scene.AttachObject(cnt1);
			cnt1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
			cnt1.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

			ArP1.x = -0.2; ArP1.y = -0.2; ArP1.z = 0.0;
			ArP2.x = -0.1; ArP2.y = 0.2; ArP2.z = 0.0;
			ArP3.x = -0.3; ArP3.y = 0.1; ArP3.z = 0.0;
			ArcGeo.FromThreePoints(ArP1,ArP2,ArP3,false);
			objcts[0] = msgArc.Create(ArcGeo);


			ArP1.x = -0.1; ArP1.y = 0.2; ArP1.z = 0.0;
			ArP2.x = 0.3; ArP2.y = 0.5; ArP2.z = 0.0;
			ArP3.x = 0.2; ArP3.y = 0.6; ArP3.z = 0.0;
			ArcGeo.FromThreePoints(ArP1,ArP2,ArP3,false);
			objcts[1] = msgArc.Create(ArcGeo);

			ArP1.x = 0.3; ArP1.y = 0.5; ArP1.z = 0.0;
			ArP2.x = -0.2; ArP2.y = -0.2; ArP2.z = 0.0;
			ArP3.x = 0.6; ArP3.y = -0.4; ArP3.z = 0.0;
			ArcGeo.FromThreePoints(ArP1,ArP2,ArP3,false);
			objcts[2] = msgArc.Create(ArcGeo);

			msgObject[] objcts2 = null;
			Array.Copy(objcts, objcts2, 3);
			msgContour cnt2 = msgContour.CreateContour(objcts2);
			scene.AttachObject(cnt2);
			cnt2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
			cnt2.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

			msgCircleStruct cirGeo = new msgCircleStruct();
			msgPointStruct cirC = new msgPointStruct(0.3, -0.1, 0.0);
			msgVectorStruct cirNor = new msgVectorStruct(0.0, 0.0, 1.0);
			cirGeo.FromCenterRadiusNormal(cirC,0.31, cirNor);
			msg2DObject cir = msgCircle.Create(cirGeo);
			scene.AttachObject(cir);
			cir.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
			cir.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

			msgPointStruct point_in_plane = new msgPointStruct(0.0,0.0,0.0);

			bool  close = true;
			msg3DObject pipO = (msg3DObject)msgKinematic.Pipe(cnt2, new msg2DObject[] { cir }, cnt1, point_in_plane, 0.0, ref close);

			scene.AttachObject(pipO);
			pipO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 25);

			msgVectorStruct transV1 = new msgVectorStruct(3.0, 1.0, 0);
			pipO.InitTempMatrix().Translate(transV1);
			pipO.ApplyTempMatrix();
			pipO.DestroyTempMatrix();
		}
Exemple #11
0
		public static void CreateSpiralBody()
		{
			msgScene scene = msgScene.GetScene();
			scene.Clear();

			msgCircleStruct cirGeo1 = new msgCircleStruct();
			msgPointStruct cirC1 = new msgPointStruct(2.0, -2.0, 0.0);
			msgVectorStruct cirNor1 = new msgVectorStruct(0.0, 0.0, 1.0);
			cirGeo1.FromCenterRadiusNormal(cirC1,3.0, cirNor1);
			msg2DObject cir1 = msgCircle.Create(cirGeo1);
			scene.AttachObject(cir1);
			cir1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
			cir1.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

			msgCircleStruct cirGeo2 = new msgCircleStruct();
			msgPointStruct cirC2 = new msgPointStruct(2.0, -2.3, 0.0);
			msgVectorStruct cirNor2 = new msgVectorStruct(0.0, 0.0, 1.0);
			cirGeo2.FromCenterRadiusNormal(cirC2,1.5, cirNor2);
			msg2DObject cir2 = msgCircle.Create(cirGeo2);
			scene.AttachObject(cir2);
			cir2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
			cir2.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

			msgPointStruct axeP1 = new msgPointStruct(6.0, -3.0, 0.0);
			msgPointStruct axeP2 = new msgPointStruct(6.0, 3.0, 0.0);

			msg3DObject spirO = (msg3DObject)msgKinematic.Spiral(cir1, new msg2DObject[] { cir2 }, axeP1,axeP2,12,30,16,true);

			scene.AttachObject(spirO);
			spirO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 56);

			msgVectorStruct transV1 = new msgVectorStruct( 0, 7, 0 );
			spirO.InitTempMatrix().Translate(transV1);
			spirO.ApplyTempMatrix();
			spirO.DestroyTempMatrix();
		}
Exemple #12
0
        public static void CreatePipeBody()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgObject[] objcts = new msgObject[5];

            msgPointStruct ArP1   = new msgPointStruct();
            msgPointStruct ArP2   = new msgPointStruct();
            msgPointStruct ArP3   = new msgPointStruct();
            msgArcStruct   ArcGeo = new msgArcStruct();

            ArP1.x = 0.0; ArP1.y = -2.0; ArP1.z = 0.0;
            ArP2.x = 1.0; ArP2.y = -1.0; ArP2.z = 0.0;
            ArP3.x = 0.4; ArP3.y = -1.2; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[0] = msgArc.Create(ArcGeo);

            ArP1.x = 1.0; ArP1.y = -1.0; ArP1.z = 0.0;
            ArP2.x = 2.0; ArP2.y = 0.0; ArP2.z = 0.0;
            ArP3.x = 1.9; ArP3.y = -0.5; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[1] = msgArc.Create(ArcGeo);

            ArP1.x = 2.0; ArP1.y = 0.0; ArP1.z = 0.0;
            ArP2.x = 1.0; ArP2.y = 1.0; ArP2.z = 0.0;
            ArP3.x = 1.6; ArP3.y = 0.8; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[2] = msgArc.Create(ArcGeo);

            objcts[3] = msgLine.Create(1.0, 1.0, 0.0, -1.0, 1.0, 0.0);

            ArP1.x = -1.0; ArP1.y = 1.0; ArP1.z = 0.0;
            ArP2.x = -1.0; ArP2.y = 0.0; ArP2.z = 1.0;
            ArP3.x = -1.1; ArP3.y = 1.0; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[4] = msgArc.Create(ArcGeo);

            msgContour cnt1 = msgContour.CreateContour(objcts);

            scene.AttachObject(cnt1);
            cnt1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cnt1.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            ArP1.x = -0.2; ArP1.y = -0.2; ArP1.z = 0.0;
            ArP2.x = -0.1; ArP2.y = 0.2; ArP2.z = 0.0;
            ArP3.x = -0.3; ArP3.y = 0.1; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[0] = msgArc.Create(ArcGeo);


            ArP1.x = -0.1; ArP1.y = 0.2; ArP1.z = 0.0;
            ArP2.x = 0.3; ArP2.y = 0.5; ArP2.z = 0.0;
            ArP3.x = 0.2; ArP3.y = 0.6; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[1] = msgArc.Create(ArcGeo);

            ArP1.x = 0.3; ArP1.y = 0.5; ArP1.z = 0.0;
            ArP2.x = -0.2; ArP2.y = -0.2; ArP2.z = 0.0;
            ArP3.x = 0.6; ArP3.y = -0.4; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[2] = msgArc.Create(ArcGeo);

            msgObject[] objcts2 = null;
            Array.Copy(objcts, objcts2, 3);
            msgContour cnt2 = msgContour.CreateContour(objcts2);

            scene.AttachObject(cnt2);
            cnt2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cnt2.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgCircleStruct cirGeo = new msgCircleStruct();
            msgPointStruct  cirC   = new msgPointStruct(0.3, -0.1, 0.0);
            msgVectorStruct cirNor = new msgVectorStruct(0.0, 0.0, 1.0);

            cirGeo.FromCenterRadiusNormal(cirC, 0.31, cirNor);
            msg2DObject cir = msgCircle.Create(cirGeo);

            scene.AttachObject(cir);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgPointStruct point_in_plane = new msgPointStruct(0.0, 0.0, 0.0);

            bool        close = true;
            msg3DObject pipO  = (msg3DObject)msgKinematic.Pipe(cnt2, new msg2DObject[] { cir }, cnt1, point_in_plane, 0.0, ref close);

            scene.AttachObject(pipO);
            pipO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 25);

            msgVectorStruct transV1 = new msgVectorStruct(3.0, 1.0, 0);

            pipO.InitTempMatrix().Translate(transV1);
            pipO.ApplyTempMatrix();
            pipO.DestroyTempMatrix();
        }