Esempio n. 1
0
        private DbElement SDTE(DbElement cate, string detailText, string skey, DbElement equipment)
        {
            var       equiDesc = equipment.GetAsString(DbAttributeInstance.DESC);
            DbElement sdte     = DbElement.GetElement();

            if (equiDesc == "unset")
            {
                sdte = cate.Members().FirstOrDefault(m => m.ElementType == DbElementTypeInstance.SDTEXT);
                if (sdte == null || sdte.IsValid == false)
                {
                    sdte = cate.CreateLast(DbElementTypeInstance.SDTEXT);
                }
            }
            else
            {
                var sdteName = equipment.Name() + ".SDTE";
                sdte = cate.Members().FirstOrDefault(m => m.ElementType == DbElementTypeInstance.SDTEXT && m.Name() == sdteName);
                if (sdte == null || sdte.IsValid == false)
                {
                    sdte = cate.CreateLast(DbElementTypeInstance.SDTEXT);
                    try {
                        sdte.SetAttribute(DbAttributeInstance.NAME, sdteName);
                        Console.WriteLine("name error for sdte");
                    } catch (Exception e) {
                        Console.WriteLine(e.Message);
                    }
                }
            }
            detailText = detailText.Replace("@SIZE", "' + STRING (PARA[1] ) + '");
            detailText = detailText.Replace("@DESC", equiDesc);
            PMLCommander.RunPMLCommand(sdte, "SKEY", $"'{skey}'", out var error);
            PMLCommander.RunPMLCommandInParentheses(sdte, "RTEXT", $"'{detailText}'", out error);
            Sdte = sdte;
            return(sdte);
        }
Esempio n. 2
0
        public void SEXT(Buildable element)
        {
            var ptcaX = _ptca(element.Direction.X, element.Position);
            var ptcaY = _ptca(element.Direction.Y, element.Position);
            //var ptcaZ = PTCA(element.Direction.Z, element.Position);

            var geom = _gmse.Create(1, DbElementTypeInstance.SEXTRUSION);

            geom.SetAttribute(DbAttributeInstance.TUFL, true);
            var error = string.Empty;

            PMLCommander.RunPMLCommand(geom, "PAAX", $"P{ptcaX.GetAsString(DbAttributeInstance.NUMB)}", out error);
            PMLCommander.RunPMLCommand(geom, "PBAX", $"P{ptcaY.GetAsString(DbAttributeInstance.NUMB)}", out error);
            PMLCommander.RunPMLCommand(geom, "PHEI", element.Size.Height.ToString(), out error);

            // no need to set position, as position is set by PAAX and PBAX
            //PMLCommander.RunPMLCommandInParentheses(geom, "PX", element.Position.X.ToString(), out error);
            //PMLCommander.RunPMLCommandInParentheses(geom, "PY", element.Position.Y.ToString(), out error);
            //PMLCommander.RunPMLCommandInParentheses(geom, "PZ", element.Position.Z.ToString(), out error);

            var sloo = geom.Create(1, DbElementTypeInstance.SLOOP);

            foreach (var vert in element.Verticies)
            {
                var svert = sloo.CreateLast(DbElementTypeInstance.SVERTEX);
                PMLCommander.RunPMLCommandInParentheses(svert, "PX", vert.X.ToString(), out error);
                PMLCommander.RunPMLCommandInParentheses(svert, "PY", vert.Y.ToString(), out error);
            }
        }
Esempio n. 3
0
        public DbElement PTCA(string direction, Position position)
        {
            var error = string.Empty;

            foreach (DbElement p in new DBElementCollection(_ptse, new TypeFilter(DbElementTypeInstance.PTCAR)))
            {
                var pDir = p.GetAsString(DbAttributeInstance.PTCD);
                var pX   = p.GetString(DbAttributeInstance.PX).Clean();
                var pZ   = p.GetAsString(DbAttributeInstance.PZ).Clean();
                var pY   = p.GetString(DbAttributeInstance.PY).Clean();

                if (pDir == direction &&
                    position.XString() == pX &&
                    position.YString() == pY &&
                    position.ZString() == pZ)
                {
                    return(p);
                }
            }
            var ptca = _ptse.Create(1, DbElementTypeInstance.PTCAR);

            int number = _ppointCounter++;

            //ptca.SetAttribute(DbAttributeInstance.NUMB, number);
            PMLCommander.RunPMLCommand(ptca, "NUMB", number.ToString(), out error);

            PMLCommander.RunPMLCommandInParentheses(ptca, "PX", position.XString(), out error);
            PMLCommander.RunPMLCommandInParentheses(ptca, "PY", position.YString(), out error);
            PMLCommander.RunPMLCommandInParentheses(ptca, "PZ", position.ZString(), out error);
            PMLCommander.RunPMLCommand(ptca, "PTCDI", direction, out error);

            return(ptca);
        }
Esempio n. 4
0
        public DbElement ConnectingPTCA(string direction, Position position, double size, int number, string coco)
        {
            var ptca = _ptse.Create(1, DbElementTypeInstance.PTCAR);

            ptca.SetAttribute(DbAttributeInstance.NUMB, number);

            var error = string.Empty;

            PMLCommander.RunPMLCommandInParentheses(ptca, "PX", position.XString(), out error);
            PMLCommander.RunPMLCommandInParentheses(ptca, "PY", position.YString(), out error);
            PMLCommander.RunPMLCommandInParentheses(ptca, "PZ", position.ZString(), out error);

            PMLCommander.RunPMLCommand(ptca, "PBOR", size.ToString(), out error);
            PMLCommander.RunPMLCommand(ptca, "PCON", coco, out error);
            PMLCommander.RunPMLCommand(ptca, "PTCDI", direction, out error);


            return(ptca);
        }
Esempio n. 5
0
        public void LPYR(Buildable element)
        {
            Direction direction = element.Direction;
            Position  position  = element.Position;
            Size      size      = element.Size;
            var       ptcaX     = _ptca(direction.X, position);
            var       ptcaY     = _ptca(direction.Y, position);
            var       ptcaZ     = _ptca(direction.Z, position);
            var       lpyr      = _gmse.Create(1, DbElementTypeInstance.LPYRAMID);

            lpyr.SetAttribute(DbAttributeInstance.TUFL, true);
            string error;

            if (element.SourceType == DbElementTypeInstance.PYRAMID)
            {
                PMLCommander.RunPMLCommandInParentheses(lpyr, "PBTP", size.XTop.ToString("0.##"), out error);
                PMLCommander.RunPMLCommandInParentheses(lpyr, "PCTP", size.YTop.ToString("0.##"), out error);
                PMLCommander.RunPMLCommandInParentheses(lpyr, "PBBT", size.XBottom.ToString("0.##"), out error);
                PMLCommander.RunPMLCommandInParentheses(lpyr, "PCBT", size.YBottom.ToString("0.##"), out error);
                PMLCommander.RunPMLCommandInParentheses(lpyr, "PTDI", size.Height.ToString("0.##"), out error);
                PMLCommander.RunPMLCommandInParentheses(lpyr, "PBOF", size.XOffset.ToString("0.##"), out error);
                PMLCommander.RunPMLCommandInParentheses(lpyr, "PCOF", size.YOffset.ToString("0.##"), out error);
            }
            else
            {
                PMLCommander.RunPMLCommandInParentheses(lpyr, "PBTP", size.XLength.ToString("0.##"), out error);
                PMLCommander.RunPMLCommandInParentheses(lpyr, "PCTP", size.YLength.ToString("0.##"), out error);
                PMLCommander.RunPMLCommandInParentheses(lpyr, "PBBT", size.XLength.ToString("0.##"), out error);
                PMLCommander.RunPMLCommandInParentheses(lpyr, "PCBT", size.YLength.ToString("0.##"), out error);
                PMLCommander.RunPMLCommandInParentheses(lpyr, "PTDI", size.ZLength.ToString("0.##"), out error);
            }


            PMLCommander.RunPMLCommand(lpyr, "PBAX", $"P{ptcaX.GetAsString(DbAttributeInstance.NUMB)}", out error);
            PMLCommander.RunPMLCommand(lpyr, "PCAX", $"P{ptcaY.GetAsString(DbAttributeInstance.NUMB)}", out error);
            PMLCommander.RunPMLCommand(lpyr, "PAAX", $"P{ptcaZ.GetAsString(DbAttributeInstance.NUMB)}", out error);
            PMLCommander.RunPMLCommand(lpyr, "PAAX", $"P{ptcaZ.GetAsString(DbAttributeInstance.NUMB)}", out error);
        }