コード例 #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));
        }
コード例 #2
0
        public EvDocument New([Optional] string name, [Optional] EvSize size)
        {
            // Prepare arguments.
            Dict args = new Dict();

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

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

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

            if (args.Count > 0)
            {
                cmd.Add("args", args);
            }

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

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

            return(new EvDocument(id, conn_));
        }
コード例 #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));
        }