Ejemplo n.º 1
0
 public _Mark(TSD.Mark mark, TSM.ModelObject part, TSD.ModelObject DRpart, TSD.ViewBase view)
 {
     _mark   = mark;
     _part   = part;
     _DRpart = DRpart;
     _view   = view;
 }
Ejemplo n.º 2
0
        public void GetSize(TSM.ModelObject obj)
        {
            var assembly = obj as TSM.Assembly;
            var mainPart = assembly.GetMainPart() as TSM.Part;

            var reportPropertySize = "SIZE";
            var size123            = 0.0;
            var size124            = 0.0;

            if (obj is TSM.Assembly)
            {
                var reinforcement = mainPart.GetReinforcements();
                var reinf         = reinforcement.Current as TSM.Reinforcement;

                if (reinf.Class.Equals(123))
                {
                    reinf.GetReportProperty(reportPropertySize, ref size123);
                    Size123 = size123;
                }
                else if (reinf.Class.Equals(124))
                {
                    reinf.GetReportProperty(reportPropertySize, ref size124);
                    Size124 = size124;
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>Get int report property from this model object</summary>
        /// <param name="name">Name of the report property</param>
        /// <returns>Return value of report property or int.MinValue if not fided report property</returns>
        public static int GetIntegerReportProperty(this TSM.ModelObject modelObject, string name)
        {
            int value = int.MinValue;

            modelObject.GetReportProperty(name, ref value);
            return(value);
        }
Ejemplo n.º 4
0
        public void GetNumber(TSM.ModelObject obj)
        {
            var assembly = obj as TSM.Assembly;
            var mainPart = assembly.GetMainPart() as TSM.Part;

            var reportPropertyNumber = "NUMBER";
            var numberOfStrands123   = 0;
            var numberOfStrands124   = 0;

            if (obj is TSM.Assembly)
            {
                var reinforcement = mainPart.GetReinforcements();

                while (reinforcement.MoveNext())
                {
                    var reinf = reinforcement.Current as TSM.Reinforcement;

                    if (reinf.Class.Equals(123))
                    {
                        reinf.GetReportProperty(reportPropertyNumber, ref numberOfStrands123);
                        SumStrands123 += numberOfStrands123;
                    }
                    else if (reinf.Class.Equals(124))
                    {
                        reinf.GetReportProperty(reportPropertyNumber, ref numberOfStrands124);
                        SumStrands124 += numberOfStrands124;
                    }
                }
            }
        }
        /// <summary>
        /// Create pad footing, column on a given position and create base plate connection between those
        /// </summary>
        /// <param name="PositionX">X-coordination of the position</param>
        /// <param name="PositionY">Y-coordination of the position</param>
        private void CreateFootingAndColumn(double PositionX, double PositionY)
        {
            ModelObject PadFooting = CreatePadFooting(PositionX, PositionY, double.Parse(FootingSize.Text));
            ModelObject Column     = CreateColumn(PositionX, PositionY);

            CreateBasePlate(Column, PadFooting);
        }
Ejemplo n.º 6
0
        /// <summary>Get double report property from this model object</summary>
        /// <param name="name">Name of the report property</param>
        /// <returns>Return value of report property or int.MinValue if not fided report property</returns>
        public static double GetDoubleReportProperty(this TSM.ModelObject modelObject, string name)
        {
            double value = int.MinValue;

            modelObject.GetReportProperty(name, ref value);
            return(value);
        }
Ejemplo n.º 7
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            try
            {
                Model          model          = new Model();
                DrawingHandler drawingHandler = new DrawingHandler();

                ArrayList ModelObjectArray = new ArrayList();

                if (drawingHandler.GetActiveDrawing() != null)
                {
                    DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();
                    while (drawingObjectEnum.MoveNext())
                    {
                        Tekla.Structures.Drawing.ModelObject dModelObject = (Tekla.Structures.Drawing.ModelObject)drawingObjectEnum.Current;
                        ModelObjectArray.Add(model.SelectModelObject(dModelObject.ModelIdentifier));
                    }
                }
                else
                {
                    ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();
                    while (modelObjectEnum.MoveNext())
                    {
                        Tekla.Structures.Model.ModelObject modelObject = (Tekla.Structures.Model.ModelObject)modelObjectEnum.Current;
                        ModelObjectArray.Add(model.SelectModelObject(modelObject.Identifier));
                    }
                }

                Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector();
                modelObjectSelector.Select(ModelObjectArray);
                akit.Callback("acmdCreateViewBySelectedObjectsExtrema", "", "main_frame");
                akit.Callback("acmd_interrupt", "", "main_frame");
            }
            catch { }
        }
        /// <summary>
        /// Create rebar on the given object to given position using FootingSize from dialog.
        /// Polygon for the rebar is calculated from position and FootingSize from dialog, Polygon could also
        /// be calculated using PadFooting's extrema.
        /// </summary>
        /// <param name="PadFooting">Father of the rebar</param>
        /// <param name="PositionX">X-coordination</param>
        /// <param name="PositionY"></param>
        /// <returns></returns>
        private void CreateRebar(ModelObject PadFooting, double PositionX, double PositionY)
        {
            RebarGroup Rebar         = new RebarGroup();
            Polygon    RebarPolygon1 = new Polygon();

            double MyFootingSize = double.Parse(FootingSize.Text);

            //use given position and footing size
            RebarPolygon1.Points.Add(new Point(PositionX - MyFootingSize / 2.0, PositionY - MyFootingSize / 2.0, 0));
            RebarPolygon1.Points.Add(new Point(PositionX + MyFootingSize / 2.0, PositionY - MyFootingSize / 2.0, 0));
            RebarPolygon1.Points.Add(new Point(PositionX + MyFootingSize / 2.0, PositionY + MyFootingSize / 2.0, 0));
            RebarPolygon1.Points.Add(new Point(PositionX - MyFootingSize / 2.0, PositionY + MyFootingSize / 2.0, 0));
            RebarPolygon1.Points.Add(new Point(PositionX - MyFootingSize / 2.0, PositionY - MyFootingSize / 2.0, 0));
            Rebar.Polygons.Add(RebarPolygon1);

            //or calculate by rebar's solid's Axis Aligned Bounding Box
            //Rebar.Polygons.Add(GetPolygonBySolidsAABB(PadFooting as Beam));

            Rebar.StartPoint.X          = PositionX;
            Rebar.StartPoint.Y          = PositionY;
            Rebar.StartPoint.Z          = 0.0;
            Rebar.EndPoint.X            = PositionX;
            Rebar.EndPoint.Y            = PositionY;
            Rebar.EndPoint.Z            = -500.0;
            Rebar.Father                = PadFooting;
            Rebar.EndPointOffsetType    = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS;
            Rebar.EndPointOffsetValue   = 20.0;
            Rebar.StartPointOffsetType  = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS;
            Rebar.StartPointOffsetValue = 20.0;
            Rebar.Class = 3;
            Rebar.Name  = "FootingRebar";
            Rebar.Grade = GradeTextBox.Text;
            Rebar.Size  = SizeTextBox.Text;

            char[]   Separator = { ' ' };
            string[] Radiuses  = BendingRadiusTextBox.Text.Split(Separator, StringSplitOptions.RemoveEmptyEntries);
            foreach (string Item in Radiuses)
            {
                Rebar.RadiusValues.Add(Convert.ToDouble(Item));
            }

            Rebar.SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE;
            Rebar.Spacings.Add(100.0);
            Rebar.ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_BOTH;
            Rebar.NumberingSeries.StartNumber = 0;
            Rebar.NumberingSeries.Prefix      = "Group";
            Rebar.OnPlaneOffsets.Add(25.0);
            Rebar.FromPlaneOffset = 40;

            //Adding hooks to make rebar stronger
            Rebar.StartHook.Shape = RebarHookData.RebarHookShapeEnum.HOOK_90_DEGREES;
            Rebar.EndHook.Shape   = RebarHookData.RebarHookShapeEnum.HOOK_90_DEGREES;
            Rebar.OnPlaneOffsets.Add(10.0);
            Rebar.OnPlaneOffsets.Add(25.0);

            if (!Rebar.Insert())
            {
                Console.WriteLine("Inserting of rebar failed.");
            }
        }
Ejemplo n.º 9
0
        /// <summary>Get string report property from this model object</summary>
        /// <param name="name">Name of the report property</param>
        /// <returns>Return value of report property or string.Empty if not fided report property</returns>
        public static string GetStringReportProperty(this TSM.ModelObject modelObject, string name)
        {
            string value = string.Empty;

            modelObject.GetReportProperty(name, ref value);
            return(value);
        }
Ejemplo n.º 10
0
        public void GetPull(TSM.ModelObject obj)
        {
            var assembly = obj as TSM.Assembly;
            var mainPart = assembly.GetMainPart() as TSM.Part;

            var reportPropertyPull = "STRAND_PULL_FORCE";
            var pull123            = 0;
            var pull124            = 0;

            if (obj is TSM.Assembly)
            {
                var reinforcement = mainPart.GetReinforcements();
                var reinf         = reinforcement.Current as TSM.Reinforcement;

                if (reinf.Class.Equals(123))
                {
                    reinf.GetReportProperty(reportPropertyPull, ref pull123);
                    Pull123 = Pull123;
                }
                else if (reinf.Class.Equals(124))
                {
                    reinf.GetReportProperty(reportPropertyPull, ref pull124);
                    Pull124 = pull124;
                }
            }
        }
        private void AddsSecondariesDrawingObjectsToTreeNode(Assembly assembly, List <SZMK.TeklaInteraction.Shared.Models.Detail> Details, int CountMarks)
        {
            string Error = "Ошибка написания позиции детали";

            try
            {
                ArrayList secondaries = assembly.GetSecondaries();

                string _position = "";

                for (int i = 0; i < secondaries.Count; i++)
                {
                    ModelObject modelObject = secondaries[i] as ModelObject;

                    modelObject.GetReportProperty("PART_POS", ref _position);
                    long CountDetail = 0;

                    if (Details.Where(p => p.Position == _position).Count() > 0)
                    {
                        CountDetail = Details.Where(p => p.Position == _position).FirstOrDefault().Count *CountMarks;

                        Details.RemoveAll(p => p.Position == _position);
                    }

                    Details.Add(GetDetailAttribute(assembly, modelObject, CountDetail + 1));
                }
            }
            catch (Exception E)
            {
                throw new Exception(Error, E);
            }
        }
        private String GetNameDetail(Assembly assembly, ModelObject modelObject)
        {
            string _name = "";

            modelObject.GetReportProperty("ADVANCED_OPTION.XS_DRAWING_PLOT_FILE_NAME_W", ref _name);

            string temp = _name;

            while (true)
            {
                temp = temp.Remove(0, _name.IndexOf('%') + 1);

                string parm = temp.Substring(0, temp.IndexOf('%'));

                _name = _name.Replace($"%{parm}%", GetParametersDetail(assembly, modelObject, parm));

                temp = _name;

                if (temp.IndexOf('%') == -1)
                {
                    break;
                }
            }

            return(_name);
        }
Ejemplo n.º 13
0
        private void GetInfoFromDrawing(DrawingObject pickedObject)
        {
            modelObjectTextBox.Clear();

            if (pickedObject != null)
            {
                TSD.ModelObject modelObjectInDrawing = pickedObject as TSD.ModelObject;
                if (modelObjectInDrawing != null)
                {
                    TSM.ModelObject modelObjectInModel = model.SelectModelObject(modelObjectInDrawing.ModelIdentifier);
                    if (modelObjectInModel is TSM.Part)
                    {
                        Beam beam = modelObjectInModel as Beam;
                        if (beam != null)
                        {
                            GetBeamInfo(beam);
                        }
                        PolyBeam polyBeam = modelObjectInModel as PolyBeam;
                        if (polyBeam != null)
                        {
                            GetPolyBeamInfo(polyBeam);
                        }
                        ContourPlate contourPlate = modelObjectInModel as ContourPlate;
                        if (contourPlate != null)
                        {
                            GetContourPlateInfo(contourPlate);
                        }
                    }
                }
            }
        }
 internal static TSM.ModelObject SelectModelObject(int objectId)
 {
     TSM.ModelObject result      = null;
     TSM.ModelObject modelObject =
         new TSM.Model().SelectModelObject(new Identifier(objectId));
     result = modelObject;
     return(result);
 }
Ejemplo n.º 15
0
        /// <summary>
        /// 初始化;
        /// </summary>
        protected void Init()
        {
            if (mViewBase == null)
            {
                return;
            }
            CDimTools dimTools = CDimTools.GetInstance();

            //初始化视图包围盒;
            dimTools.InitViewBox();

            //获取所有螺钉的数据字典;
            Dictionary <Identifier, TSD.Bolt> dicIdentifierBolt = dimTools.GetAllBoltInDrawing(mViewBase);

            //获取所有Drawing视图中的Part;
            List <TSD.Part> partList = dimTools.GetAllPartInDrawing(mViewBase);

            foreach (TSD.Part partInDrawing in partList)
            {
                //1.获取部件的信息;
                TSM.ModelObject modelObjectInModel = dimTools.TransformDrawingToModel(partInDrawing);
                TSM.Part        partInModel        = modelObjectInModel as TSM.Part;
                CMrPart         mrPart             = null;

                if (CMrMainBeam.GetInstance().mPartInModel.Identifier.GUID == partInModel.Identifier.GUID)
                {
                    mrPart    = CMrMainBeam.GetInstance();
                    mMainBeam = CMrMainBeam.GetInstance();
                    mMainBeam.mPartInDrawing = partInDrawing;
                }
                else
                {
                    mrPart = new CMrPart(partInModel, partInDrawing);
                }

                dimTools.InitMrPart(modelObjectInModel, mViewBase, mrPart);
                AppendMrPart(mrPart);
                InitMrPart(mrPart);

                mrPart.GetBeamTopViewInfo().InitMrPartTopViewInfo();

                //2.获取部件中的所有螺钉组;
                List <BoltArray> boltArrayList = dimTools.GetAllBoltArray(partInModel);

                foreach (BoltArray boltArray in boltArrayList)
                {
                    TSD.Bolt boltInDrawing = dicIdentifierBolt[boltArray.Identifier];

                    CMrBoltArray mrBoltArray = new CMrBoltArray(boltArray, boltInDrawing);
                    dimTools.InitMrBoltArray(boltArray, mViewBase, mrBoltArray);
                    InitMrBoltArray(mrBoltArray);
                    mrPart.AppendMrBoltArray(mrBoltArray);
                }
                dimTools.UpdateViewBox(mrPart);
            }
            CMrMarkManager.GetInstance().Clear();
        }
Ejemplo n.º 16
0
        private void ApplyChangeManagementUDA(bool Added, TSM.ModelObject obj)
        {
            Phase objPhase;

            if (Added)
            {
                int number;
                if (Int32.TryParse(txb_AddedPhase.Text, out number))
                {
                    //set object phase
                    objPhase = new Phase(number);
                    obj.SetPhase(objPhase);

                    //get phase back with full information
                    obj.GetPhase(out objPhase);

                    //save info, trim and apply to object
                    string phaseName = objPhase.PhaseName;
                    phaseName = phaseName.Trim();
                    if (phaseName.LastIndexOf(" ") > 0)
                    {
                        phaseName = phaseName.Substring(0, phaseName.LastIndexOf(" ", phaseName.Length));
                    }
                    obj.SetUserProperty("SDLT_CH_REF", phaseName);
                }
                obj.SetUserProperty("SDLT_MOD_TYPE", 1);
            }
            else
            {
                int number;
                if (Int32.TryParse(txb_DeletedPhase.Text, out number))
                {
                    //set object phase
                    objPhase = new Phase(number);
                    obj.SetPhase(objPhase);

                    //get phase back with full information
                    obj.GetPhase(out objPhase);

                    //save info, trim and apply to object
                    string phaseName = objPhase.PhaseName;
                    phaseName = phaseName.Trim();
                    if (phaseName.LastIndexOf(" ") > 0)
                    {
                        phaseName = phaseName.Substring(0, phaseName.LastIndexOf(" ", phaseName.Length));
                    }
                    obj.SetUserProperty("SDLT_CH_REF", phaseName);
                }
                obj.SetUserProperty("SDLT_MOD_TYPE", 0);
            }

            obj.SetUserProperty("SDLT_CH_TYPE", cb_ChangeType.SelectedIndex - 1);
            obj.SetUserProperty("SDLT_CH_BY_ORG", cb_RaisedBy.SelectedIndex - 1);
            obj.SetUserProperty("SDLT_CH_MODEL_BY", "ATKINS");
            obj.SetUserProperty("SDLT_CH_DATE", DateTime.Today.Date.ToString("dd'.'MM'.'yyyy"));
            obj.SetUserProperty("SDLT_CH_REV", txb_ChangeRevision.Text);
        }
Ejemplo n.º 17
0
 private string getPhaseNameFromReinforcement(ReinforcementBase drawingObject)
 {
     TSDrg.ReinforcementBase dwgRebar = drawingObject as TSDrg.ReinforcementBase;
     TSM.Model       MyModel          = new TSM.Model();
     TSM.ModelObject modelRebar       = MyModel.SelectModelObject(dwgRebar.ModelIdentifier);
     TSM.Phase       rebarPhase       = new TSM.Phase();
     modelRebar.GetPhase(out rebarPhase);
     return(rebarPhase.PhaseName);
 }
Ejemplo n.º 18
0
        private void btn_createUstirrup_Click(object sender, EventArgs e)
        {
            //기본객체 생성
            RebarGroup rebarGroup = new RebarGroup();
            Picker     picker     = new Picker();

            //부재선택
            TSM.ModelObject mainpart = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "철근을 삽입할 부재를 선택하세요.");
            TSM.Beam        Beam     = mainpart as TSM.Beam;
            rebarGroup.Father = Beam;

            //철근 형태를 결정할 Point 선택
            ArrayList shapePoints = picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON, "철근 형태를 결정할 포인트를 선택하세요.");

            TSM.Polygon polygon = new TSM.Polygon();
            for (int i = 0; i < shapePoints.Count; i++)
            {
                polygon.Points.Add(shapePoints[i]);
            }
            rebarGroup.Polygons.Add(polygon);

            //철근 생성 위치를 결정할 Point 선택
            ArrayList locationPoints = picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON, "철근 생성 위치를 결정할 포인트를 선택하세요.");

            rebarGroup.StartPoint = (TSG.Point)locationPoints[0];
            rebarGroup.EndPoint   = (TSG.Point)locationPoints[1];

            //RebarInfo 클래스에서 불러올 값
            rebarGroup.Name  = "Rebar";
            rebarGroup.Size  = "13";
            rebarGroup.Grade = "SD400";
            rebarGroup.RadiusValues.Add(60.00);
            rebarGroup.Class = 11;

            //Form에서 설정
            rebarGroup.StartHook.Shape = RebarHookData.RebarHookShapeEnum.HOOK_180_DEGREES;
            rebarGroup.EndHook.Shape   = RebarHookData.RebarHookShapeEnum.HOOK_180_DEGREES;

            rebarGroup.OnPlaneOffsets.Add(25.00);
            rebarGroup.FromPlaneOffset       = 25;
            rebarGroup.StartPointOffsetValue = 25;
            rebarGroup.EndPointOffsetValue   = 25;

            rebarGroup.SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE;
            rebarGroup.Spacings.Add(200);
            rebarGroup.ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_NONE;
            rebarGroup.StirrupType = RebarGroup.RebarGroupStirrupTypeEnum.STIRRUP_TYPE_POLYGONAL;

            if (!rebarGroup.Insert())
            {
                Console.WriteLine("insert failed");
            }
            else
            {
                model.CommitChanges();
            }
        }
Ejemplo n.º 19
0
        private static void swapEndForces(TSM.ModelObject part)
        {
            var originalEnd1 = string.Empty;
            var originalEnd2 = string.Empty;

            part.GetUserProperty("BM_FORCE1", ref originalEnd1);
            part.GetUserProperty("BM_FORCE2", ref originalEnd2);
            part.SetUserProperty("BM_FORCE1", originalEnd2);
            part.SetUserProperty("BM_FORCE2", originalEnd1);
        }
Ejemplo n.º 20
0
        private void btn_action_Click(object sender, EventArgs e)
        {
            // kết nối với model đang hiện hành.
            tsm.Model model = new tsm.Model();
            if (!model.GetConnectionStatus())
            {
                MessageBox.Show("Tekla is not connected!! @@");
                return;
            }
            // kiểm tra xem đã kết nối được với model chưa.
            //--------------------------------
            // Nhặt 2 đối tượng Rebar group
            tsm.RebarGroup rebargroup0 = null;
            tsm.RebarGroup rebargroup1 = null;
            // Khởi tạo picker
            mui.Picker picker = new mui.Picker();
            string     mess   = "";

            while (rebargroup0 == null & rebargroup1 == null)
            {
                try
                {
                    tsm.ModelObject obj0 = picker.PickObject(mui.Picker.PickObjectEnum.PICK_ONE_OBJECT, mess + "pick a group Rebar 0");
                    if (obj0 as tsm.RebarGroup != null)
                    {
                        rebargroup0 = obj0 as tsm.RebarGroup;
                        mess        = "";
                    }
                    else
                    {
                        mess = "Object is not a Rebar group. ";
                    }
                    tsm.ModelObject obj1 = picker.PickObject(mui.Picker.PickObjectEnum.PICK_ONE_OBJECT, mess + "pick a group Rebar 1");
                    if (obj1 as tsm.RebarGroup != null)
                    {
                        rebargroup1 = obj1 as tsm.RebarGroup;
                        mess        = "";
                    }
                    else
                    {
                        mess = "Object is not a Rebar group. ";
                    }
                }
                catch
                {
                    Operation.DisplayPrompt("not select");
                    return;
                }
            }
        }
Ejemplo n.º 21
0
        private List <string> readBarInformation(ReinforcementBase dwgRebar)
        {
            List <string> info = new List <string>();

            TSM.Model       MyModel    = new TSM.Model();
            TSM.ModelObject modelRebar = MyModel.SelectModelObject(dwgRebar.ModelIdentifier);
            TSM.Phase       rebarPhase = new TSM.Phase();
            modelRebar.GetPhase(out rebarPhase);
            info.Add(rebarPhase.PhaseName);
            string shapeCode   = null;
            bool   gotProperty = modelRebar.GetReportProperty("REBAR_POS", ref shapeCode);

            info.Add(shapeCode);
            return(info);
        }
Ejemplo n.º 22
0
        //This method gets the pciked object ID and selecs it in the model, showing
        //some of its information in the form
        private void GetInfoFromDrawing(DrawingObject pickedObject)
        {
            modelObjectTextBox.Clear();

            if (pickedObject != null)
            {
                TSD.ModelObject modelObjectInDrawing = pickedObject as TSD.ModelObject;
                if (modelObjectInDrawing != null)
                {
                    TSM.ModelObject modelObjectInModel = _model.SelectModelObject(modelObjectInDrawing.ModelIdentifier);
                    if (modelObjectInModel is TSM.RebarGroup || modelObjectInModel is TSM.Reinforcement)
                    {
                        Reinforcement beam = modelObjectInModel as Reinforcement;
                        if (beam != null)
                        {
                            double radius = double.Parse(beam.RadiusValues[0].ToString());

                            Solid  sol  = beam.GetSolid();
                            double maxX = sol.MaximumPoint.X;
                            double maxY = sol.MaximumPoint.Y;
                            double maxZ = sol.MaximumPoint.Z;

                            double minX = sol.MinimumPoint.X;
                            double minY = sol.MinimumPoint.Y;
                            double minZ = sol.MinimumPoint.Z;
                            // start vẽ polyline
                            Polyline  MyPolyline;
                            PointList PolygonPoints = new PointList();
                            for (double i = maxY - radius; i <= maxY; i += 1)
                            {
                                PolygonPoints.Add(new g3d.Point(i, i));
                            }

                            DrawingObjectEnumerator views = _drawingHandler.GetActiveDrawing().GetSheet().GetAllViews();
                            while (views.MoveNext())
                            {
                                MyPolyline = new Polyline(views.Current as ViewBase, PolygonPoints);
                                MyPolyline.Insert();
                            }
                            GetBeamInfo(beam);
                            //end vẽ đường thẳng
                        }
                    }
                }
            }
        }
        /// <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.");
            }
        }
 private String GetDiscriptrion(ModelObject modelObject)
 {
     try
     {
         int IntAnswer = 0;
         modelObject.GetReportProperty("HAS_HOLES", ref IntAnswer);
         if (IntAnswer == 0)
         {
             return("");
         }
         else
         {
             return("Отв. ");
         }
     }
     catch (Exception E)
     {
         throw new Exception(E.Message, E);
     }
 }
Ejemplo n.º 25
0
        private void btnSeleccionarMuro_Click(object sender, EventArgs e)
        {
            Picker Picker = new Picker();

            try
            {
                Tekla.Structures.Model.ModelObject objeto = Picker.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT);
                if (!(objeto is Beam))
                {
                    MessageBox.Show("debe seleccionar un muro...");
                    return;
                }
                muro = (Beam)objeto;
                this.lblMuroSeleccionado.Text = muro.Name + " " + muro.Material.MaterialString;
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
 private String GetMethodOfPainting(ModelObject modelObject)
 {
     try
     {
         string StringAnswer = "";
         modelObject.GetReportProperty("ASSEMBLY.MAINPART.FINISH", ref StringAnswer);
         if (StringAnswer == "")
         {
             modelObject.GetReportProperty("USERDEFINED.Obrabotka", ref StringAnswer);
             return(StringAnswer);
         }
         else
         {
             return(StringAnswer);
         }
     }
     catch (Exception E)
     {
         throw new Exception(E.Message, E);
     }
 }
        private List <Shared.Models.Detail> AddMainDetailDrawingObjects(AssemblyDrawing parentDrawing, int CountMark)
        {
            try
            {
                List <Shared.Models.Detail> Details = new List <SZMK.TeklaInteraction.Shared.Models.Detail>();

                Assembly assembly = model.SelectModelObject(parentDrawing.AssemblyIdentifier) as Assembly;

                ModelObject modelObject = assembly.GetMainPart();

                Details.Add(GetDetailAttribute(assembly, modelObject, 1));

                AddsSecondariesDrawingObjectsToTreeNode(assembly, Details, CountMark);

                return(Details);
            }
            catch (Exception E)
            {
                throw new Exception(E.Message, E);
            }
        }
 private String GetMachining(ModelObject modelObject)
 {
     try
     {
         string StringAnswer = "";
         modelObject.GetReportProperty("PROFILE_TYPE", ref StringAnswer);
         string tempA = "";
         string tempB = "";
         if (StringAnswer == "B")
         {
             modelObject.GetReportProperty("VOLUME", ref tempA);
             modelObject.GetReportProperty("VOLUME_NET", ref tempB);
             if (tempA == tempB)
             {
                 StringAnswer = "";
             }
             else
             {
                 StringAnswer = "Фаска/Стр. ";
             }
         }
         else
         {
             StringAnswer = "";
         }
         modelObject.GetReportProperty("USERDEFINED.comment", ref tempA);
         if (tempA == "0")
         {
             return(StringAnswer += "");
         }
         else
         {
             return(StringAnswer += tempA);
         }
     }
     catch (Exception E)
     {
         throw new Exception(E.Message, E);
     }
 }
Ejemplo n.º 29
0
        /// <summary>
        /// 显示拾取对象的信息;
        /// </summary>
        /// <param name="pickedObject"></param>
        private void ShowDrawingObjectInfo(DrawingObject pickedObject, TSD.ViewBase viewBase)
        {
            if (null == pickedObject)
            {
                return;
            }
            if (pickedObject is TSD.ModelObject)
            {
                TSD.ModelObject modelObjectInDrawing = pickedObject as TSD.ModelObject;
                TSM.ModelObject modelObject          = CDimTools.GetInstance().TransformDrawingToModel(modelObjectInDrawing);

                if (modelObject is TSM.Part)
                {
                    TSM.Part partInModel   = modelObject as TSM.Part;
                    TSD.Part partInDrawing = modelObjectInDrawing as TSD.Part;

                    CMrPart mrPart = new CMrPart(partInModel, partInDrawing);

                    CDimTools.GetInstance().InitMrPart(partInModel, viewBase as TSD.View, mrPart);

                    UpdateUIInfo(mrPart);
                }
            }
        }
Ejemplo n.º 30
-1
        private void markHandler(TSD.Mark currentMark)
        {
            if (currentMark.Attributes.Content.Count > 0)
            {
                System.Type[] Types = new System.Type[1];
                Types.SetValue(typeof(TSD.ModelObject), 0);
                TSD.DrawingObjectEnumerator markObjects = currentMark.GetRelatedObjects(Types);

                foreach (TSD.ModelObject currentDO in markObjects)
                {
                    TSM.Model       myModel     = new TSM.Model();
                    TSM.ModelObject modelObject = myModel.SelectModelObject(currentDO.ModelIdentifier);

                    if (modelObject != null)
                    {
                        if (modelObject is TSM.Beam)
                        {
                            TSM.Beam currentMO = modelObject as TSM.Beam;
                            markBeams.Add(new _Mark_Beam(currentMark, currentMO, currentDO, this.view));
                        }
                        else if (modelObject is TSM.PolyBeam)
                        {
                            TSM.PolyBeam currentMO = modelObject as TSM.PolyBeam;
                            markPolyBeams.Add(new _Mark_PolyBeam(currentMark, currentMO, currentDO, this.view));
                        }
                        else if (modelObject is TSM.ContourPlate)
                        {
                            TSM.ContourPlate currentMO = modelObject as TSM.ContourPlate;
                            markContourPlates.Add(new _Mark_ContourPlate(currentMark, currentMO, currentDO, this.view));
                        }
                        else if (modelObject is TSM.SingleRebar)
                        {
                            TSM.SingleRebar currentMO = modelObject as TSM.SingleRebar;
                            markSingleRebars.Add(new _Mark_SingleRebar(currentMark, currentMO, currentDO, this.view));
                        }
                        else if (modelObject is TSM.RebarGroup)
                        {
                            TSM.BaseRebarGroup currentMO = modelObject as TSM.RebarGroup;
                            markRebarBases.Add(new _Mark_RebarGroup(currentMark, currentMO, currentDO, this.view));
                        }
                        else if (modelObject is TSM.BoltGroup)
                        {
                            TSM.BoltGroup currentMO = modelObject as TSM.BoltGroup;
                            markBoltGroup.Add(new _Mark_BoltGroup(currentMark, currentMO, currentDO, this.view));
                        }
                    }
                }
            }
        }