Ejemplo n.º 1
0
        private CadTemplate readDictionary()
        {
            CadDictionary         cadDictionary = new CadDictionary();
            CadDictionaryTemplate template      = new CadDictionaryTemplate(cadDictionary);

            string lastKey = null;

            //Jump the 0 marker
            this._reader.ReadNext();

            this.readCommonObjectData(template);

            System.Diagnostics.Debug.Assert(DxfSubclassMarker.Dictionary == this._reader.LastValueAsString);

            //Jump the 100 marker
            this._reader.ReadNext();

            while (this._reader.LastDxfCode != DxfCode.Start)
            {
                switch (this._reader.LastCode)
                {
                case 280:
                    cadDictionary.HardOwnerFlag = this._reader.LastValueAsBool;
                    break;

                case 281:
                    cadDictionary.ClonningFlags = (DictionaryCloningFlags)this._reader.LastValue;
                    break;

                case 3:
                    lastKey = this._reader.LastValueAsString;
                    template.Entries.Add(lastKey, null);
                    break;

                case 350:                         // Soft-owner ID/handle to entry object
                case 360:                         // Hard-owner ID/handle to entry object
                    template.Entries[lastKey] = this._reader.LastValueAsHandle;
                    break;

                default:
                    this._notification?.Invoke(null, new NotificationEventArgs($"Group Code not handled {this._reader.LastGroupCodeValue} for {typeof(CadDictionary)}, code : {this._reader.LastCode} | value : {this._reader.LastValueAsString}"));
                    break;
                }

                this._reader.ReadNext();
            }

            return(template);
        }
Ejemplo n.º 2
0
        internal CadDocument(bool createDefaults)
        {
            this._cadObjects.Add(this.Handle, this);

            //Initalize viewports only for management
            //this.Viewports = new ViewportCollection(this);

            if (createDefaults)
            {
                //Header and summary
                this.Header      = new CadHeader();
                this.SummaryInfo = new CadSummaryInfo();

                //Initialize tables
                this.BlockRecords    = new BlockRecordsTable(this);
                this.AppIds          = new AppIdsTable(this);
                this.DimensionStyles = new DimensionStylesTable(this);
                this.Layers          = new LayersTable(this);
                this.LineTypes       = new LineTypesTable(this);
                this.TextStyles      = new TextStylesTable(this);
                this.UCSs            = new UCSTable(this);
                this.Views           = new ViewsTable(this);
                this.VPorts          = new VPortsTable(this);

                //Root dictionary
                this.RootDictionary = CadDictionary.CreateRoot();

                //Entries
                (this.RootDictionary[CadDictionary.AcadLayout] as CadDictionary).Add(Layout.LayoutModelName, Layout.Default);

                //Default variables
                this.AppIds.Add(AppId.Default);

                this.BlockRecords.Add(BlockRecord.ModelSpace);
                this.BlockRecords.Add(BlockRecord.PaperSpace);

                this.LineTypes.Add(LineType.ByLayer);
                this.LineTypes.Add(LineType.ByBlock);
                this.LineTypes.Add(LineType.Continuous);

                this.Layers.Add(Layer.Default);

                this.TextStyles.Add(TextStyle.Default);

                this.DimensionStyles.Add(DimensionStyle.Default);

                this.VPorts.Add(VPort.Default);
            }
        }
Ejemplo n.º 3
0
 public DwgDictionaryTemplate(CadDictionary dictionary) : base(dictionary)
 {
 }