Пример #1
0
        //ref
        public bool CreateConnection(Beam primary, Beam secondary)
        {
            var beamsize = GetSecondaryBeamProfile(secondary);

            //var attribute = string.Concat(code, "_", beamsize);
            try
            {
                Tekla.Structures.Model.Connection C = new Tekla.Structures.Model.Connection();
                C.Name   = "Test End Plate";
                C.Number = 141;
                C.LoadAttributesFromFile("standard");

                C.SetPrimaryObject(primary);
                C.SetSecondaryObject(secondary);

                if (!C.Insert())
                {
                    Console.WriteLine("Connection Insert failed ");
                    return(false);
                }
                else
                {
                    Console.WriteLine(C.Identifier.ID);
                }

                return(true);
            }
            catch (Exception x)
            {
                Console.WriteLine(x.GetBaseException().Message);
                return(false);
            }
        }
        private void ConvertComponent(TSM.BaseComponent component)
        {
            //Update component from database
            component.Select();
            component.GetPhase(out TSM.Phase phase);

            //Check if is connection
            TSM.Connection connetion = null;
            TSM.Detail     detail    = null;
            T3D.Vector     upVector  = null;

            if (component is TSM.Connection)
            {
                connetion = component as TSM.Connection;
                upVector  = connetion.UpVector;
            }
            else if (component is TSM.Detail)
            {
                detail   = component as TSM.Detail;
                upVector = detail.UpVector;
            }

            //Select component in model
            new TSM.UI.ModelObjectSelector().Select(new System.Collections.ArrayList()
            {
                component
            });

            //Convert component
            var akit = new TS.MacroBuilder();

            akit.Callback("acmdChangeJointTypeToCallback", "DETAIL", "main_frame");
            akit.Run();

            component.Select();

            //After conversion some connections changes its direction so we need to repair that connections
            if (connetion != null)
            {
                connetion.Select();
                connetion.AutoDirectionType = TS.AutoDirectionTypeEnum.AUTODIR_NA;
                connetion.UpVector          = upVector;
            }

            //After conversion some details changes its direction so we need to repair that details
            if (detail != null)
            {
                detail.Select();
                detail.AutoDirectionType = TS.AutoDirectionTypeEnum.AUTODIR_NA;
                detail.UpVector          = upVector;
            }

            //After conversion components change its phase to current we need to repait it
            component.SetPhase(phase);
            component.Modify();
        }
Пример #3
0
        public Connection GetDefaultConnection2()
        {
            var connection = new TSM.Connection
            {
                Name   = "Cranked Beam",
                Number = 41,
            };

            connection.LoadAttributesFromFile("standard");
            connection.UpVector          = new TSG.Vector(0, 1000, 0);
            connection.AutoDirectionType = Tekla.Structures.AutoDirectionTypeEnum.AUTODIR_DIAGONAL;
            connection.PositionType      = Tekla.Structures.PositionTypeEnum.COLLISION_PLANE;

            return(connection);
        }
Пример #4
0
        public Connection GetDefaultConnection3()
        {
            var connection = new TSM.Connection
            {
                Name   = "Apex haunch",
                Number = 106,
            };

            connection.LoadAttributesFromFile("standard");
            connection.UpVector          = new TSG.Vector(0, 0, 1000);
            connection.PositionType      = Tekla.Structures.PositionTypeEnum.COLLISION_PLANE;
            connection.AutoDirectionType = Tekla.Structures.AutoDirectionTypeEnum.AUTODIR_GLOBAL_Z;

            return(connection);
        }
Пример #5
0
        public bool CreateConnection(Beam primary, ArrayList secondaries, int component, string code, int boltweldstype, int angletype)
        {
            var beamsize  = GetSecondaryBeamProfile(((Beam)secondaries[0]));
            var attribute = string.Concat(code, "_", beamsize);

            try
            {
                Tekla.Structures.Model.Connection C = new Tekla.Structures.Model.Connection();
                // C.Name = "Test End Plate";
                C.Number = component;
                C.LoadAttributesFromFile(attribute);

                C.SetPrimaryObject(primary);
                C.SetSecondaryObjects(secondaries);

                C.PositionType = PositionTypeEnum.COLLISION_PLANE;

                if (component == 141)
                {
                    C.SetAttribute("btab5", angletype);     //angle
                    C.SetAttribute("atab1", boltweldstype); //bolts/welds
                }


                //C.SetAttribute("btab5",angletype);//angle
                //C.SetAttribute("atab1",boltweldstype);//bolts/welds


                if (!C.Insert())
                {
                    Console.WriteLine("Connection Insert failed ");
                    return(false);
                }
                else
                {
                    Console.WriteLine(C.Identifier.ID);
                }

                return(true);
            }
            catch (Exception x)
            {
                Console.WriteLine(x.GetBaseException().Message);
                return(false);
            }
        }
        /// <summary>
        /// Method that creates connection (1004) between two given objects
        /// </summary>
        /// <param name="PrimaryObject"></param>
        /// <param name="SecondaryObject"></param>
        private static void CreateBasePlate(ModelObject PrimaryObject, ModelObject SecondaryObject)
        {
            Connection BasePlate = new Connection();

            BasePlate.Name   = "Stiffened Base Plate";
            BasePlate.Number = 1014;
            BasePlate.LoadAttributesFromFile("standard");
            BasePlate.UpVector     = new Vector(0, 0, 1000);
            BasePlate.PositionType = PositionTypeEnum.COLLISION_PLANE;

            BasePlate.SetPrimaryObject(PrimaryObject);
            BasePlate.SetSecondaryObject(SecondaryObject);
            BasePlate.SetAttribute("cut", 1);  //Enable anchor rods

            if (!BasePlate.Insert())
            {
                Console.WriteLine("Insertion of stiffened base plate failed.");
            }
        }
Пример #7
0
        public bool CreateConnection(Beam primary, Beam secondary, string code)
        {
            var beamsize = GetSecondaryBeamProfile(secondary);

            //var attribute = string.Concat(code, "_", beamsize);
            try
            {
                Tekla.Structures.Model.Connection C = new Tekla.Structures.Model.Connection();
                C.Name   = "Test End Plate";
                C.Number = 143;
                C.LoadAttributesFromFile("standard");
                //C.LoadAttributesFromFile(attribute);
                //C.UpVector = new Vector(0, 0, 1000);
                //C.PositionType = PositionTypeEnum.COLLISION_PLANE;

                C.SetPrimaryObject(primary);
                C.SetSecondaryObject(secondary);


                //C.SetAttribute("e2", 10.0);
                //C.SetAttribute("e1", 10.0);

                if (!C.Insert())
                {
                    Console.WriteLine("Connection Insert failed ");
                    return(false);
                }
                else
                {
                    Console.WriteLine(C.Identifier.ID);
                }

                return(true);
            }
            catch (Exception x)
            {
                Console.WriteLine(x.GetBaseException().Message);
                return(false);
            }
        }
Пример #8
0
 public FormPanel()
 {
     InitializeComponent();
     model = new Model();
     con   = new Tekla.Structures.Model.Connection();
 }