Ejemplo n.º 1
0
        private void AssignHandles(DwgObjectMap objectMap)
        {
            BlockHeaders.ClearHandles();
            Layers.ClearHandles();
            Styles.ClearHandles();
            LineTypes.ClearHandles();
            Views.ClearHandles();
            UCSs.ClearHandles();
            ViewPorts.ClearHandles();
            AppIds.ClearHandles();
            DimStyles.ClearHandles();
            ViewPortEntityHeaders.ClearHandles();
            GroupDictionary.ClearHandles();
            MLineStyleDictionary.ClearHandles();
            NamedObjectDictionary.ClearHandles();

            BlockHeaders.AssignHandles(objectMap);
            Layers.AssignHandles(objectMap);
            Styles.AssignHandles(objectMap);
            LineTypes.AssignHandles(objectMap);
            Views.AssignHandles(objectMap);
            UCSs.AssignHandles(objectMap);
            ViewPorts.AssignHandles(objectMap);
            AppIds.AssignHandles(objectMap);
            DimStyles.AssignHandles(objectMap);
            ViewPortEntityHeaders.AssignHandles(objectMap);
            GroupDictionary.AssignHandles(objectMap);
            MLineStyleDictionary.AssignHandles(objectMap);
            NamedObjectDictionary.AssignHandles(objectMap);

            Variables.BlockControlObjectHandle                = new DwgHandleReference(DwgHandleReferenceCode.SoftPointer, BlockHeaders.Handle.HandleOrOffset);
            Variables.LayerControlObjectHandle                = new DwgHandleReference(DwgHandleReferenceCode.SoftPointer, Layers.Handle.HandleOrOffset);
            Variables.StyleObjectControlHandle                = new DwgHandleReference(DwgHandleReferenceCode.SoftPointer, Styles.Handle.HandleOrOffset);
            Variables.LineTypeObjectControlHandle             = new DwgHandleReference(DwgHandleReferenceCode.SoftPointer, LineTypes.Handle.HandleOrOffset);
            Variables.ViewControlObjectHandle                 = new DwgHandleReference(DwgHandleReferenceCode.SoftPointer, Views.Handle.HandleOrOffset);
            Variables.UcsControlObjectHandle                  = new DwgHandleReference(DwgHandleReferenceCode.SoftPointer, UCSs.Handle.HandleOrOffset);
            Variables.ViewPortControlObjectHandle             = new DwgHandleReference(DwgHandleReferenceCode.SoftPointer, ViewPorts.Handle.HandleOrOffset);
            Variables.AppIdControlObjectHandle                = new DwgHandleReference(DwgHandleReferenceCode.SoftPointer, AppIds.Handle.HandleOrOffset);
            Variables.DimStyleControlObjectHandle             = new DwgHandleReference(DwgHandleReferenceCode.SoftPointer, DimStyles.Handle.HandleOrOffset);
            Variables.ViewPortEntityHeaderControlObjectHandle = new DwgHandleReference(DwgHandleReferenceCode.SoftPointer, ViewPortEntityHeaders.Handle.HandleOrOffset);
            Variables.GroupDictionaryHandle        = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, GroupDictionary.Handle.HandleOrOffset);
            Variables.MLineStyleDictionaryHandle   = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, MLineStyleDictionary.Handle.HandleOrOffset);
            Variables.NamedObjectsDictionaryHandle = new DwgHandleReference(DwgHandleReferenceCode.SoftPointer, NamedObjectDictionary.Handle.HandleOrOffset);

            Variables.PaperSpaceBlockRecordHandle = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, PaperSpaceBlockRecord.Handle.HandleOrOffset);
            Variables.ModelSpaceBlockRecordHandle = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, ModelSpaceBlockRecord.Handle.HandleOrOffset);
            Variables.ByLayerLineTypeHandle       = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, ByLayerLineType.Handle.HandleOrOffset);
            Variables.ByBlockLineTypeHandle       = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, ByBlockLineType.Handle.HandleOrOffset);
            Variables.ContinuousLineTypeHandle    = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, ContinuousLineType.Handle.HandleOrOffset);
            Variables.CurrentViewPortEntityHandle = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, CurrentViewPort?.Handle.HandleOrOffset ?? 0);
            Variables.CurrentLayerHandle          = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, CurrentLayer.Handle.HandleOrOffset);
            Variables.TextStyleHandle             = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, TextStyle.Handle.HandleOrOffset);
            Variables.CurrentEntityLineTypeHandle = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, CurrentEntityLineType.Handle.HandleOrOffset);
            Variables.DimensionStyleHandle        = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, DimensionStyle.Handle.HandleOrOffset);
            Variables.CurrentMultiLineStyleHandle = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, CurrentMultiLineStyle.Handle.HandleOrOffset);
            Variables.PaperSpaceCurrentUCSHandle  = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, PaperSpaceCurrentUCS?.Handle.HandleOrOffset ?? 0);
            Variables.CurrentUCSHandle            = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, CurrentUCS?.Handle.HandleOrOffset ?? 0);
            Variables.DimensionTextStyleHandle    = new DwgHandleReference(DwgHandleReferenceCode.SoftOwner, DimensionTextStyle.Handle.HandleOrOffset);

            objectMap.SetNextAvailableHandle(Variables);
        }