Exemplo n.º 1
0
        public override void ExecuteCmd(string szContent, ref GenContext Context, ref ArrayList Output, ref Object Tag)
        {
            base.ExecuteCmd(szContent, ref Context, ref Output, ref Tag);
            if (!(Tag is SceneTree))
            {
                throw new Exception("ExtrudeZCommand::ExecuteCmd:The last parameter must be a SceneTree instance");
            }
            SceneTree sct = (SceneTree)Tag;

            int iPos = -1;

            string szPar1 = GenContext.GetFirstParam(szContent, ref iPos, ','); //SourceKeyname
            string szPar2 = GenContext.GetNextParam(szContent, ref iPos, ',');  //z
            string szPar3 = GenContext.GetNextParam(szContent, ref iPos, ',');  //nLat
            string szPar4 = GenContext.GetNextParam(szContent, ref iPos, ',');  //Type abs/rel
            string szPar5 = GenContext.GetNextParam(szContent, ref iPos, ',');  //TargetKeyname
            float  z      = (float)Convert.ToDouble(szPar2);

            if (Convert.ToInt32(szPar3) < 2)
            {
                throw new Exception("ExtrudeZCommand:nLat must greater than 1 to create mayesurface");
            }
            if (GenContext.GetNextParam(szContent, ref iPos, ',') != "")
            {
                throw new Exception("ExtrudeZCommand:Invalid argument list.");
            }

            int iCount = sct.m_Object3DList.Count + 1;

            if (szPar5 == "")
            {
                szPar5 = "\"ExtrudeZ" + iCount.ToString() + "\"";
            }
            Object3D    ob       = sct.GetObject3D(Context.EvalText(szPar1));
            MayeArc     arc      = null;
            MayeSurface mayesurf = null;

            if (!(ob is MayeArc))
            {
                throw new Exception("ExtrudeZCommand::ExecuteCmd:Only a MayeArc object can be extruded");
            }
            //sct.DeleteObject3D(ref ob);
            Object3D tob = sct.GetObject3D(Context.EvalText(szPar5));

            if (tob != null)
            {
                throw new Exception("ExtrudeZCommand:ExecuteCmd:Cannot extrude in a existing target object.");
            }

            arc      = (MayeArc)ob;
            mayesurf = new MayeSurface(Convert.ToInt32(szPar3), arc.m_nLong, ob.m_Color, Context.EvalText(szPar5), false);
            //            mayeLine = new Line3D(new Vector3(x1, y1, z1 ), new Vector3(x2, y2, z2), Convert.ToInt32(szPar7),             System.Drawing.Color.FromArgb(Int32.Parse(szPar8, System.Globalization.NumberStyles.HexNumber)), szPar10, false);
            arc.ExtrudeZ(z, 0, ref mayesurf);
            Scene3D sc = (Scene3D)sct.m_MainSceneNode.m_Scene3DRef;

            sct.AddObject3D(sc.m_Keyname, mayesurf);
        }
Exemplo n.º 2
0
        public override void ExecuteCmd(string szContent, ref GenContext Context, ref ArrayList Output, ref Object Tag)
        {
            base.ExecuteCmd(szContent, ref Context, ref Output, ref Tag);
            if (!(Tag is SceneTree))
            {
                throw new Exception("Translate::ExecuteCmd:The last parameter must be a SceneTree instance");
            }
            SceneTree sct = (SceneTree)Tag;

            int iPos = -1;

            string szPar1 = GenContext.GetFirstParam(szContent, ref iPos, ','); //x
            string szPar2 = GenContext.GetNextParam(szContent, ref iPos, ',');  //y
            string szPar3 = GenContext.GetNextParam(szContent, ref iPos, ',');  //z
            string szPar4 = GenContext.GetNextParam(szContent, ref iPos, ',');  //keyname

            if (GenContext.GetNextParam(szContent, ref iPos, ',') != "")
            {
                throw new Exception("Translate:Invalid argument list.");
            }

            Object3D ob = sct.GetObject3D(Context.EvalText(szPar4));

            if (ob == null)
            {
                throw new Exception("Translate:Object " + szPar4 + " does not exist!");
            }
            float x = (float)Context.EvalFloat(szPar1);
            float y = (float)Context.EvalFloat(szPar2);
            float z = (float)Context.EvalFloat(szPar3);

            ob.Translate(x, y, z);
        }
Exemplo n.º 3
0
        public override void ExecuteCmd(string szContent, ref GenContext Context, ref ArrayList Output, ref Object Tag)
        {
            base.ExecuteCmd(szContent, ref Context, ref Output, ref Tag);
            if (!(Tag is SceneTree))
            {
                throw new Exception("LineCommand::ExecuteCmd:The last parameter must be a SceneTree instance");
            }
            SceneTree sct = (SceneTree)Tag;

            int iPos = -1;

            string szPar1  = GenContext.GetFirstParam(szContent, ref iPos, ','); //x1
            string szPar2  = GenContext.GetNextParam(szContent, ref iPos, ',');  //y1
            string szPar3  = GenContext.GetNextParam(szContent, ref iPos, ',');  //z1
            string szPar4  = GenContext.GetNextParam(szContent, ref iPos, ',');  //a
            string szPar5  = GenContext.GetNextParam(szContent, ref iPos, ',');  //b
            string szPar6  = GenContext.GetNextParam(szContent, ref iPos, ',');  //phi0
            string szPar7  = GenContext.GetNextParam(szContent, ref iPos, ',');  //phi1
            string szPar8  = GenContext.GetNextParam(szContent, ref iPos, ',');  //nLong
            string szPar9  = GenContext.GetNextParam(szContent, ref iPos, ',');  //color
            string szPar10 = GenContext.GetNextParam(szContent, ref iPos, ',');  //type obsolete (for compatibility)
            string szPar11 = GenContext.GetNextParam(szContent, ref iPos, ',');  //keyname

            if (GenContext.GetNextParam(szContent, ref iPos, ',') != "")
            {
                throw new Exception("ArcCommand:Invalid argument list.");
            }

            if (szPar8 == "")
            {
                szPar8 = "6";
            }
            if (((Convert.ToInt32(szPar8)) % 2) == 1)
            {
                throw new Exception("The amount of segment must be an 'even' value");
            }
            if (szPar9 == "")
            {
                szPar9 = "ffffff";
            }
            szPar10 = "0"; //type
            int iCount = sct.m_Object3DList.Count + 1;

            if (szPar11 == "")
            {
                szPar11 = "\"Arc" + iCount.ToString() + "\"";
            }
            Object3D ob      = sct.GetObject3D(szPar11);
            Arc3D    mayeArc = null;

            if (ob != null)
            {
                if (!(ob is Arc3D))
                {
                    throw new Exception("ArcCommand::ExecuteCmd:A 3DObject is already called like this");
                }
                sct.DeleteObject3D(ref ob);
            }
            float x1 = (float)Context.EvalFloat(szPar1);
            float y1 = (float)Context.EvalFloat(szPar2);
            float z1 = (float)Context.EvalFloat(szPar3);

            float rx   = (float)Context.EvalFloat(szPar4);
            float rz   = (float)Context.EvalFloat(szPar5);
            float phi0 = (float)Context.EvalFloat(szPar6);
            float phi1 = (float)Context.EvalFloat(szPar7);

            szPar11 = Context.EvalText(szPar11);

            int nLong = Convert.ToInt32(szPar8); // Multiply by 2 to get enough point for the primitives

            mayeArc = new Arc3D(new Vector3(x1, y1, z1), rx, rz, phi0, phi1, nLong, System.Drawing.Color.FromArgb(Int32.Parse(szPar9, System.Globalization.NumberStyles.HexNumber)), szPar11, false);
            Scene3D sc = (Scene3D)sct.m_MainSceneNode.m_Scene3DRef;

            sct.AddObject3D(sc.m_Keyname, mayeArc);
        }
Exemplo n.º 4
0
        public override void ExecuteCmd(string szContent, ref GenContext Context, ref ArrayList Output, ref Object Tag)
        {
            base.ExecuteCmd(szContent, ref Context, ref Output, ref Tag);
            if (!(Tag is SceneTree))
            {
                throw new Exception("LineCommand::ExecuteCmd:The last parameter must be a SceneTree instance");
            }
            SceneTree sct = (SceneTree)Tag;

            int iPos = -1;

            string szPar1  = GenContext.GetFirstParam(szContent, ref iPos, ','); //x
            string szPar2  = GenContext.GetNextParam(szContent, ref iPos, ',');  //y
            string szPar3  = GenContext.GetNextParam(szContent, ref iPos, ',');  //z
            string szPar4  = GenContext.GetNextParam(szContent, ref iPos, ',');  //rx
            string szPar5  = GenContext.GetNextParam(szContent, ref iPos, ',');  //ry
            string szPar6  = GenContext.GetNextParam(szContent, ref iPos, ',');  //rz
            string szPar7  = GenContext.GetNextParam(szContent, ref iPos, ',');  //nLong
            string szPar8  = GenContext.GetNextParam(szContent, ref iPos, ',');  //nLat
            string szPar9  = GenContext.GetNextParam(szContent, ref iPos, ',');  //color
            string szPar10 = GenContext.GetNextParam(szContent, ref iPos, ',');  //type obsolete (for compatibility)
            string szPar11 = GenContext.GetNextParam(szContent, ref iPos, ',');  //keyname

            if (GenContext.GetNextParam(szContent, ref iPos, ',') != "")
            {
                throw new Exception("EllipsoidCommand:Invalid argument list.");
            }
            if (szPar7 == "")
            {
                szPar7 = "20";
            }
            if (szPar8 == "")
            {
                szPar8 = "20";
            }
            if (szPar9 == "")
            {
                szPar9 = "ffffff";
            }
            int iCount = sct.m_Object3DList.Count + 1;

            if (szPar11 == "")
            {
                szPar11 = "\"Ellipsoid" + iCount.ToString() + "\"";
            }
            Object3D    ob            = sct.GetObject3D(szPar11);
            Ellipsoid3D mayeEllipsoid = null;

            if (ob != null)
            {
                if (!(ob is Ellipsoid3D))
                {
                    throw new Exception("EllipsoidCommand::ExecuteCmd:A 3DObject is already called like this");
                }
                sct.DeleteObject3D(ref ob);
            }

            float x = (float)Context.EvalFloat(szPar1);
            float y = (float)Context.EvalFloat(szPar2);
            float z = (float)Context.EvalFloat(szPar3);

            float rx = (float)Context.EvalFloat(szPar4);
            float ry = (float)Context.EvalFloat(szPar5);
            float rz = (float)Context.EvalFloat(szPar6);

            szPar11 = Context.EvalText(szPar11);


            mayeEllipsoid = new Ellipsoid3D(new Vector3(0, 0, 0), rx, ry, rz, Convert.ToInt32(szPar7), Convert.ToInt32(szPar8), System.Drawing.Color.FromArgb(Int32.Parse(szPar9, System.Globalization.NumberStyles.HexNumber)), szPar11, false);
            //Line3D(new Vector3(x1, y1, z1), new Vector3(x2, y2, z2), Convert.ToInt32(szPar7), System.Drawing.Color.FromArgb(Int32.Parse(szPar8, System.Globalization.NumberStyles.HexNumber)), szPar10, false);
            mayeEllipsoid.Translate(x, y, z);

            Scene3D sc = (Scene3D)sct.m_MainSceneNode.m_Scene3DRef;

            sct.AddObject3D(sc.m_Keyname, mayeEllipsoid);
        }
Exemplo n.º 5
0
        public override void ExecuteCmd(string szContent, ref GenContext Context, ref ArrayList Output, ref Object Tag)
        {
            base.ExecuteCmd(szContent, ref Context, ref Output, ref Tag);
            if (!(Tag is SceneTree))
            {
                throw new Exception("LineCommand::ExecuteCmd:The last parameter must be a SceneTree instance");
            }
            SceneTree sct = (SceneTree)Tag;

            int iPos = -1;

            string szPar1  = GenContext.GetFirstParam(szContent, ref iPos, ','); //x1
            string szPar2  = GenContext.GetNextParam(szContent, ref iPos, ',');  //y1
            string szPar3  = GenContext.GetNextParam(szContent, ref iPos, ',');  //z1
            string szPar4  = GenContext.GetNextParam(szContent, ref iPos, ',');  //x2
            string szPar5  = GenContext.GetNextParam(szContent, ref iPos, ',');  //y2
            string szPar6  = GenContext.GetNextParam(szContent, ref iPos, ',');  //z2
            string szPar7  = GenContext.GetNextParam(szContent, ref iPos, ',');  //nLong
            string szPar8  = GenContext.GetNextParam(szContent, ref iPos, ',');  //color
            string szPar9  = GenContext.GetNextParam(szContent, ref iPos, ',');  //type obsolete (for compatibility)
            string szPar10 = GenContext.GetNextParam(szContent, ref iPos, ',');  //keyname

            if (GenContext.GetNextParam(szContent, ref iPos, ',') != "")
            {
                throw new Exception("LineCommand:Invalid argument list.");
            }

            if (szPar7 == "")
            {
                szPar7 = "6";
            }
            if (((Convert.ToInt32(szPar7))) <= 1)
            {
                throw new Exception("The amount of point must be at least 2");
            }
            if (szPar8 == "")
            {
                szPar8 = "ffffff";
            }
            szPar9 = "0";
            int iCount = sct.m_Object3DList.Count + 1;

            if (szPar10 == "")
            {
                szPar10 = "\"Line" + iCount.ToString() + "\"";
            }
            Object3D ob       = sct.GetObject3D(szPar10);
            Line3D   mayeLine = null;

            if (ob != null)
            {
                if (!(ob is Line3D))
                {
                    throw new Exception("LineCommand::ExecuteCmd:A 3DObject is already called like this");
                }
                sct.DeleteObject3D(ref ob);
            }
            float x1 = (float)Context.EvalFloat(szPar1);
            float y1 = (float)Context.EvalFloat(szPar2);
            float z1 = (float)Context.EvalFloat(szPar3);

            float x2 = (float)Context.EvalFloat(szPar4);
            float y2 = (float)Context.EvalFloat(szPar5);
            float z2 = (float)Context.EvalFloat(szPar6);

            szPar10 = Context.EvalText(szPar10);


            mayeLine = new Line3D(new Vector3(x1, y1, z1), new Vector3(x2, y2, z2), Convert.ToInt32(szPar7), System.Drawing.Color.FromArgb(Int32.Parse(szPar8, System.Globalization.NumberStyles.HexNumber)), szPar10, false);
            Scene3D sc = (Scene3D)sct.m_MainSceneNode.m_Scene3DRef;

            sct.AddObject3D(sc.m_Keyname, mayeLine);
        }
Exemplo n.º 6
0
        public override void ExecuteCmd(string szContent, ref GenContext Context, ref ArrayList Output, ref Object Tag)
        {
            base.ExecuteCmd(szContent, ref Context, ref Output, ref Tag);
            if (!(Tag is SceneTree))
            {
                throw new Exception("LineCommand::ExecuteCmd:The last parameter must be a SceneTree instance");
            }
            SceneTree sct = (SceneTree)Tag;

            int iPos = -1;

            string szPar1  = GenContext.GetFirstParam(szContent, ref iPos, ','); //x0
            string szPar2  = GenContext.GetNextParam(szContent, ref iPos, ',');  //y0
            string szPar3  = GenContext.GetNextParam(szContent, ref iPos, ',');  //z0
            string szPar4  = GenContext.GetNextParam(szContent, ref iPos, ',');  //x1
            string szPar5  = GenContext.GetNextParam(szContent, ref iPos, ',');  //y1
            string szPar6  = GenContext.GetNextParam(szContent, ref iPos, ',');  //z1
            string szPar7  = GenContext.GetNextParam(szContent, ref iPos, ',');  //nLong
            string szPar8  = GenContext.GetNextParam(szContent, ref iPos, ',');  //nLat
            string szPar9  = GenContext.GetNextParam(szContent, ref iPos, ',');  //color
            string szPar10 = GenContext.GetNextParam(szContent, ref iPos, ',');  //type obsolete (for compatibility)
            string szPar11 = GenContext.GetNextParam(szContent, ref iPos, ',');  //keyname

            //TODO:Change the nLong and nLat
            if (GenContext.GetNextParam(szContent, ref iPos, ',') != "")
            {
                throw new Exception("FrameboxCommand:Invalid argument list.");
            }
            if (szPar7 == "")
            {
                szPar7 = "2";
            }
            if (szPar8 == "")
            {
                szPar8 = "2";
            }
            if (szPar9 == "")
            {
                szPar9 = "ffffff";
            }
            int iCount = sct.m_Object3DList.Count + 1;

            if (szPar11 == "")
            {
                szPar11 = "\"FrameBox" + iCount.ToString() + "\"";
            }
            Object3D   ob           = sct.GetObject3D(szPar11);
            FrameBox3D mayeFramebox = null;

            if (ob != null)
            {
                if (!(ob is Ellipsoid3D))
                {
                    throw new Exception("Framebox::ExecuteCmd:A 3DObject is already called like this");
                }
                sct.DeleteObject3D(ref ob);
            }

            float x0 = (float)Context.EvalFloat(szPar1);
            float y0 = (float)Context.EvalFloat(szPar2);
            float z0 = (float)Context.EvalFloat(szPar3);

            float x1 = (float)Context.EvalFloat(szPar4);
            float y1 = (float)Context.EvalFloat(szPar5);
            float z1 = (float)Context.EvalFloat(szPar6);

            szPar11 = Context.EvalText(szPar11);


            mayeFramebox = new FrameBox3D(x0, y0, z0, x1, y1, z1, Convert.ToInt32(szPar7), Convert.ToInt32(szPar8), System.Drawing.Color.FromArgb(Int32.Parse(szPar9, System.Globalization.NumberStyles.HexNumber)), szPar11, false);

            Scene3D sc = (Scene3D)sct.m_MainSceneNode.m_Scene3DRef;

            sct.AddObject3D(sc.m_Keyname, mayeFramebox);
        }