コード例 #1
0
ファイル: Form1.cs プロジェクト: Nguyenduc2317/Flex-Box
        //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
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Nguyenduc2317/Flex-Box
        private void GetBeamInfo(Reinforcement beam)
        {
            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;

            modelObjectTextBox.Text = TSM.ModelObject.ModelObjectEnum.BEAM.ToString() + Environment.NewLine +
                                      "Name: " + beam.Name + Environment.NewLine +
                                      "Id: " + beam.Identifier.ID.ToString() + Environment.NewLine +
                                      "maxX: " + maxX + Environment.NewLine +
                                      "maxY: " + maxY + Environment.NewLine +
                                      "maxZ: " + maxZ + Environment.NewLine +

                                      "minX: " + minX + Environment.NewLine +
                                      "minY: " + minY + Environment.NewLine +
                                      "minZ: " + minZ + Environment.NewLine;
        }