Beispiel #1
0
        public static void getWorldExtents(ref Autodesk.AutoCAD.Geometry.Vector3d wMin, ref Autodesk.AutoCAD.Geometry.Vector3d wMax, ref double winw, ref double winh)
        {
            double worldcx = 0, worldcy = 0, worldcz = 0; //世界中心点
            double worldh = 0;                            //世界纵向长度

            var _screensize =
                (Autodesk.AutoCAD.Geometry.Point2d)Application.GetSystemVariable("SCREENSIZE");

            winw = _screensize.X;
            winh = _screensize.Y;


            var _viewcenter =
                (Autodesk.AutoCAD.Geometry.Point3d)Application.GetSystemVariable("VIEWCTR");

            worldcx = _viewcenter.X;
            worldcy = _viewcenter.Y;
            worldcz = _viewcenter.Z;


            var _viewsize = (double)Application.GetSystemVariable("VIEWSIZE");

            worldh = _viewsize;

            wMin = new Autodesk.AutoCAD.Geometry.Vector3d(worldcx - (worldh * (winw / winh) / 2), worldcy - (worldh / 2), 0);
            wMax = new Autodesk.AutoCAD.Geometry.Vector3d(worldcx + (worldh * (winw / winh) / 2), worldcy + (worldh / 2), 0);
        }
Beispiel #2
0
        public bool setImgPosition(double _x, double _y, double _z)
        {
            DocumentLock doclock = null;

            try
            {
                Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
                doclock = doc.LockDocument();

                RasterImage pAcDbRasterImage;           // Entity

                Database db = HostApplicationServices.WorkingDatabase;
                Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager;

                using (Transaction t = tm.StartTransaction())
                {
                    try
                    {
                        pAcDbRasterImage = (RasterImage)t.GetObject(parEntityId, OpenMode.ForWrite);

                        if (pAcDbRasterImage != null)
                        {
                            Autodesk.AutoCAD.Geometry.Vector3d ptag = new Autodesk.AutoCAD.Geometry.Vector3d(_x, _y, _z);

                            Autodesk.AutoCAD.Geometry.Matrix3d mat = new Autodesk.AutoCAD.Geometry.Matrix3d();

                            mat = Autodesk.AutoCAD.Geometry.Matrix3d.Displacement(ptag);



                            pAcDbRasterImage.TransformBy(mat);

                            // Close object.
                            pAcDbRasterImage.Close();
                        }
                    }
                    catch (Autodesk.AutoCAD.Runtime.Exception eex)
                    { }
                    catch (System.Exception ex) { }
                    t.Commit();
                }
            }
            catch (Autodesk.AutoCAD.Runtime.Exception eex)
            { return(false); }
            catch (System.Exception ex) { return(false); }
            finally
            {
                doclock.Dispose();
            }


            return(true);
        }
Beispiel #3
0
 Vector3d(string label, Autodesk.AutoCAD.Geometry.Vector3d val)
     :   base(label)
 {
     m_val = val;
 }
Beispiel #4
0
        // ************************************************************

        public override void WriteVector3d(Autodesk.AutoCAD.Geometry.Vector3d value)
        {
        }