Exemple #1
0
        public void AcceptLayout(IHeadsApplication app)
        {
            if (this.LastAppliedLayout != null && this.LastAppliedLayoutID != 0)
            {
                IHdEntity entity = app.ActiveDocument.GetObjectById(this.LastAppliedLayoutID);
                if (entity != null && entity.EntityName == "POLYLINE3D")
                {
                    IHdPolyline3D polyline = (IHdPolyline3D)entity;
                    CPoint3D[]    cords    = polyline.Coordinates;
                    CPoint3D      pt1      = null;
                    CPoint3D      pt2      = null;

                    if (cords.Length > 7)
                    {
                        pt1 = cords[0];
                        pt2 = cords[1];
                        this.LastAppliedLayout.angle = ViewerUtils.GetAngle(pt1, pt2, false);
                        pt1 = cords[5];
                        this.LastAppliedLayout.startX = pt1.X;
                        this.LastAppliedLayout.startY = pt1.Y;

                        StreamWriter sw      = new StreamWriter(Path.Combine(app.AppDataPath, "Layout.fil"), true);
                        string       strTemp = string.Format("{0:f3} {1:f3} {2:f3} {3:f3} {4:f3} {5:f3} {6:f3} {7:f3} {8:f3} {9:f3} "
                                                             , this.LastAppliedLayout.startX
                                                             , this.LastAppliedLayout.startY
                                                             , this.LastAppliedLayout.angle
                                                             , this.LastAppliedLayout.sheetWidth
                                                             , this.LastAppliedLayout.sheetLength
                                                             , this.LastAppliedLayout.layOutScale
                                                             , this.LastAppliedLayout.bottomM
                                                             , this.LastAppliedLayout.rightM
                                                             , this.LastAppliedLayout.topM
                                                             , this.LastAppliedLayout.leftM);
                        sw.WriteLine(strTemp);
                        sw.Close();
                    }
                }

                //this.LastAppliedLayout = null;
                this.LastAppliedLayoutID = 0;
            }
        }