示例#1
0
 public static dynamic GetTSObject(DwgObject dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
示例#2
0
        internal void AssignHandle(DwgObject obj)
        {
            if (!obj.Handle.IsEmpty)
            {
                return;
            }

            var next = _nextHandle++;

            obj.Handle = new DwgHandleReference(DwgHandleReferenceCode.Declaration, next);
        }
示例#3
0
        public void Example1()
        {
            DrawingHandler MyDrawingHandler = new DrawingHandler();
            ViewBase _view = MyDrawingHandler.GetActiveDrawing().GetSheet().GetAllViews().Current as ViewBase;

            EmbeddedObjectAttributes attributes = new EmbeddedObjectAttributes();
            attributes.XScale = 0.5;
            attributes.YScale = 0.5;
            DwgObject dxf = new DwgObject(_view, new Point(100, 100),
                                          Path.GetFullPath("my_dxf.dxf"), attributes);
            dxf.Insert();
        }
示例#4
0
        public DwgObject GetObject(BitReader reader, int handle, bool allowNull = false)
        {
            if (_handleToObject.TryGetValue(handle, out var obj))
            {
                return(obj);
            }

            if (_handleToOffset.TryGetValue(handle, out var offset))
            {
                obj = DwgObject.Parse(reader.FromOffset(offset), this, _version);
                if (obj == null && !allowNull)
                {
                    throw new DwgReadException($"Unsupported object from handle {handle} at offset {offset}.");
                }

                _handleToObject.Add(handle, obj);
                return(obj);
            }

            throw new DwgReadException($"Object with handle {handle} not found in object map.");
        }