Ejemplo n.º 1
0
        public EvObject InsertImage(
            string path,
            [Optional] EvPoint pos,
            [Optional] EvSize size,
            [Optional] EnvOptions envOpt)
        {
            // Prepare arguments.
            Dict args = new Dict();

            args.Add("path", path);

            if (pos != null)
            {
                args.Add("pos", new Dict()
                {
                    { "x", pos.X },
                    { "y", pos.Y }
                });
            }

            if (pos != null)
            {
                args.Add("size", new Dict()
                {
                    { "w", size.W },
                    { "h", size.H }
                });
            }

            if (envOpt != null)
            {
                args.Add("env_opt", new Dict()
                {
                    { "units", envOpt.Units }
                });
            }

            // Prepare command.
            Dict cmd = new Dict()
            {
                { "type", "cmd" },
                { "cmd", "insert.image" },
                { "args", args }
            };

            // Issue command.
            Dict output = _conn.IssueCommand(cmd);

            // Process output.
            string id = (string)Convert.ToDictionary(output["obj"])["id"];

            return(new EvObject(id, _conn));
        }
Ejemplo n.º 2
0
        public void SetEnvOptions(EnvOptions envOpt)
        {
            Dict js = new Dict()
            {
                { "type", "cmd" },
                { "cmd", "app.set_env_options" },
                {
                    "args", new Dict()
                    {
                        { "units", envOpt.Units }
                    }
                }
            };

            conn_.IssueCommand(js);
        }
Ejemplo n.º 3
0
        public EvObject Insert3dModel(
            string path,
            [Optional] EvPoint pos,
            [Optional] EvSize size,
            [Optional] Ev3DModelImportOptions options,
            [Optional] List <string> configurations,
            [Optional] EnvOptions envOpt)
        {
            // Prepare arguments.
            Dict args = new Dict();

            args.Add("path", path);

            if (pos != null)
            {
                args.Add("pos", new Dict()
                {
                    { "x", pos.X },
                    { "y", pos.Y }
                });
            }

            if (pos != null)
            {
                args.Add("size", new Dict()
                {
                    { "w", size.W },
                    { "h", size.H }
                });
            }

            if (options != null)
            {
                args.Add("options", new Dict()
                {
                    { "tesselation_quality", options.TesselationQuality },
                    { "use_brep", options.UseBrep },
                    { "fit_to_page", options.FitToPage }
                });
            }

            if (configurations != null)
            {
                args.Add("configurations", configurations);
            }

            if (envOpt != null)
            {
                args.Add("env_opt", new Dict()
                {
                    { "units", envOpt.Units }
                });
            }

            // Prepare command.
            Dict cmd = new Dict()
            {
                { "type", "cmd" },
                { "cmd", "insert.3d_model" },
                { "args", args }
            };

            // Issue command.
            Dict output = _conn.IssueCommand(cmd);

            // Process output.
            string id = (string)Convert.ToDictionary(output["obj"])["id"];

            return(new EvObject(id, _conn));
        }