public override void Build(CadDocumentBuilder builder) { base.Build(builder); Insert insert = this.CadObject as Insert; if (builder.TryGetCadObject(this.BlockHeaderHandle, out BlockRecord block)) { insert.Block = block; } if (this.FirstAttributeHandle.HasValue) { var attributes = getEntitiesCollection <Entities.AttributeEntity>(builder, FirstAttributeHandle.Value, EndAttributeHandle.Value); insert.Attributes.AddRange(attributes); } else { foreach (ulong handle in this.OwnedHandles) { var att = builder.GetCadObject <Entities.AttributeEntity>(handle); insert.Attributes.Add(att); } } //TODO: DwgInsertTemplate SeqendHandle?? }
public void Build(CadDocumentBuilder builder) { if (this.LinetypeHandle.HasValue) { this.Element.LineType = builder.GetCadObject <LineType>(this.LinetypeHandle.Value); } else if (this.LinetypeIndex.HasValue) { if (this.LinetypeIndex == short.MaxValue) { this.Element.LineType = builder.LineTypes["ByLayer"]; } else if (this.LinetypeIndex == (short.MaxValue - 1)) { this.Element.LineType = builder.LineTypes["ByBlock"]; } else { try { //It can be assigned but is not checked this.Element.LineType = builder.LineTypes.ElementAt(this.LinetypeIndex.Value).Value; } catch (System.Exception) { //TODO: Implement get linetype by index builder.NotificationHandler?.Invoke( this.Element, new NotificationEventArgs($"Linetype not assigned, index {LinetypeIndex}")); } } } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); foreach (ulong handle in this.EntryHandles) { if (!builder.TryGetCadObject <T>(handle, out T entry)) { continue; } try { this.CadObject.Add(entry); } catch (ArgumentException ex) { builder.NotificationHandler?.Invoke( entry, new NotificationEventArgs(ex.Message)); } catch (Exception) { builder.NotificationHandler?.Invoke( entry, new NotificationEventArgs($"Entry not found [handle : {handle}] [type : {typeof(T)}]")); } } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); if (builder.TryGetCadObject(this.LayoutHandle, out Layout layout)) { this.CadObject.Layout = layout; } if (this.FirstEntityHandle.HasValue) { var entities = this.getEntitiesCollection <Entity>(builder, this.FirstEntityHandle.Value, this.LastEntityHandle.Value); this.CadObject.Entities.AddRange(entities); } else { foreach (ulong handle in this.OwnedObjectsHandlers) { if (builder.TryGetCadObject <Entity>(handle, out Entity child)) { this.CadObject.Entities.Add(child); } } } }
protected IEnumerable <T> getEntitiesCollection <T>(CadDocumentBuilder builder, ulong firstHandle, ulong endHandle) where T : Entity { List <T> collection = new List <T>(); CadEntityTemplate template = builder.GetObjectTemplate <CadEntityTemplate>(firstHandle); while (template != null) { collection.Add((T)template.CadObject); if (template.CadObject.Handle == endHandle) { break; } if (template.NextEntity.HasValue) { template = builder.GetObjectTemplate <CadEntityTemplate>(template.NextEntity.Value); } else { template = builder.GetObjectTemplate <CadEntityTemplate>(template.CadObject.Handle + 1); } } return(collection); }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); if (builder.TryGetCadObject(this.PaperSpaceBlockHandle, out BlockRecord record)) { this.CadObject.AssociatedBlock = record; } if (builder.TryGetCadObject(this.ActiveViewportHandle, out Viewport viewport)) { this.CadObject.Viewport = viewport; } if (builder.TryGetCadObject(this.BaseUcsHandle, out UCS ucs)) { this.CadObject.UCS = ucs; } if (builder.TryGetCadObject(this.NamesUcsHandle, out UCS nameducs)) { this.CadObject.UCS = nameducs; } foreach (var handle in this.ViewportHandles) { this.CadObject.Viewports.Add(builder.GetCadObject <Viewport>(handle)); } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); foreach (var item in this.ElementTemplates) { item.Build(builder); } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); foreach (CadBoundaryPathTemplate t in PathTempaltes) { (this.CadObject as Hatch).Paths.Add(t.Path); t.Build(builder); } }
public void Build(CadDocumentBuilder builder) { foreach (var handle in Handles) { if (builder.TryGetCadObject(handle, out Entity entity)) { Path.Entities.Add(entity); } } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); if (this.LtypeControlHandle.HasValue && this.LtypeControlHandle.Value > 0) { builder.NotificationHandler?.Invoke( this.CadObject, new NotificationEventArgs($"LtypeControlHandle not assigned : {this.LtypeControlHandle}")); } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); MLine mLine = this.CadObject as MLine; if (builder.TryGetCadObject <MLStyle>(this.MLineStyleHandle, out MLStyle style)) { mLine.MLStyle = style; } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); foreach (var handle in this.Handles) { CadObject member = builder.GetCadObject(handle); if (member != null) { this.CadObject.Members.Add(handle, member); } } }
public override void Build(CadDocumentBuilder builder) { //TODO: finish the build for the layer base.Build(builder); var a = builder.GetCadObject(this.LayerControlHandle); //this.CadObject.PlotStyleName = builder.GetCadObject(PlotStyleHandle); var c = builder.GetCadObject(this.MaterialHandle); this.CadObject.LineType = builder.GetCadObject <LineType>(this.LineTypeHandle); }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); if (builder.TryGetCadObject <BlockRecord>(this.ModelSpaceHandle, out BlockRecord modelSpace)) { this.CadObject.Add(modelSpace); } if (builder.TryGetCadObject <BlockRecord>(this.PaperSpaceHandle, out BlockRecord paperSpace)) { this.CadObject.Add(paperSpace); } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); Dimension dimension = this.CadObject as Dimension; if (builder.TryGetCadObject <DimensionStyle>(StyleHandle, out DimensionStyle style)) { dimension.Style = style; } if (builder.TryGetCadObject <Block>(BlockHandle, out Block block)) { dimension.Block = block; } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); switch (this.CadObject) { case TextEntity text: text.Style = builder.GetCadObject <TextStyle>(this.StyleHandle); break; case MText mtext: mtext.Style = builder.GetCadObject <TextStyle>(this.StyleHandle); break; default: throw new System.ArgumentException("Unknown type"); } }
public void SetBlockToRecord(CadDocumentBuilder builder) { if (builder.TryGetCadObject(this.BeginBlockHandle, out Block block)) { this.CadObject.Name = block.Name; block.Flags = this.CadObject.BlockEntity.Flags; block.BasePoint = this.CadObject.BlockEntity.BasePoint; block.XrefPath = this.CadObject.BlockEntity.XrefPath; block.Comments = this.CadObject.BlockEntity.Comments; this.CadObject.BlockEntity = block; } if (builder.TryGetCadObject(this.EndBlockHandle, out BlockEnd blockEnd)) { this.CadObject.BlockEnd = blockEnd; } }
public override void Build(CadDocumentBuilder builder) { //TODO: implement DwgVPortTemplate base.Build(builder); if (this.BaseUcsHandle.HasValue) { this.CadObject.BaseUcs = builder.GetCadObject <UCS>(this.BaseUcsHandle.Value); } if (this.NamedUcsHandle.HasValue) { this.CadObject.NamedUcs = builder.GetCadObject <UCS>(this.NamedUcsHandle.Value); } if (builder.TryGetCadObject(StyleHandle, out CadObject style)) { } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); foreach (ulong handle in this.EntryHandles) { try { Viewport entry = builder.GetCadObject <Viewport>(handle); if (entry != null) { this.CadObject.Add(builder.GetCadObject <Viewport>(handle)); } } catch (Exception) { //TODO: report the exceptions in the NotificationEventHandler } } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); //TODO: implement the dimension template for the names instead of handles if (this.DIMTXSTY.HasValue && builder.TryGetCadObject(this.DIMTXSTY.Value, out TextStyle style)) { this.CadObject.Style = style; } if (this.DIMLDRBLK.HasValue && builder.TryGetCadObject(this.DIMLDRBLK.Value, out Block leaderArrow)) { this.CadObject.LeaderArrow = leaderArrow; } if (this.DIMBLK1.HasValue && builder.TryGetCadObject(this.DIMBLK1.Value, out Block dimArrow1)) { this.CadObject.DimArrow1 = dimArrow1; } if (this.DIMBLK2.HasValue && builder.TryGetCadObject(this.DIMBLK2.Value, out Block dimArrow2)) { this.CadObject.DimArrow2 = dimArrow2; } if (!string.IsNullOrWhiteSpace(DIMBL_Name)) { builder.NotificationHandler?.Invoke(this.CadObject, new NotificationEventArgs($"DwgDimensionStyleTemplate does not implement the dimension block for : {DIMBL_Name}")); } if (!string.IsNullOrWhiteSpace(DIMBLK1_Name)) { builder.NotificationHandler?.Invoke(this.CadObject, new NotificationEventArgs($"DwgDimensionStyleTemplate does not implement the dimension block for : {DIMBLK1_Name}")); } if (!string.IsNullOrWhiteSpace(DIMBLK2_Name)) { builder.NotificationHandler?.Invoke(this.CadObject, new NotificationEventArgs($"DwgDimensionStyleTemplate does not implement the dimension block for : {DIMBLK2_Name}")); } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); if (this.OwnerHandle.HasValue && this.OwnerHandle == 0) { builder.DocumentToBuild.RootDictionary = this.CadObject; } //else if (builder.TryGetCadObject(this.OwnerHandle, out CadObject co)) //{ // co.XDictionary = this.CadObject; //} foreach (var item in this.Entries) { if (builder.TryGetCadObject(item.Value, out CadObject entry)) { this.CadObject.Add(item.Key, entry); } } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); Polyline polyLine = this.CadObject as Polyline; if (this.FirstVertexHandle.HasValue) { IEnumerable <Vertex> vertices = this.getEntitiesCollection <Vertex>(builder, this.FirstVertexHandle.Value, this.LastVertexHandle.Value); polyLine.Vertices.AddRange(vertices); } else { foreach (var handle in this.VertexHandles) { polyLine.Vertices.Add(builder.GetCadObject <Vertex>(handle)); } } //TODO: DwgPolyLineTemplate SeqendHandle?? }
public virtual void Build(CadDocumentBuilder builder) { if (false) { if (this.OwnerHandle.HasValue) { if (builder.TryGetCadObject(this.OwnerHandle.Value, out CadObject owner)) { this.CadObject.Owner = owner; } } } if (builder.TryGetCadObject(this.XDictHandle, out CadDictionary cadDictionary)) { this.CadObject.XDictionary = cadDictionary; } else if (this.XDictHandle.HasValue && this.XDictHandle.Value != 0) { builder.NotificationHandler?.Invoke(this.CadObject, new NotificationEventArgs($"Dictionary couldn't be found, handle : {this.XDictHandle}")); } foreach (ulong handle in this.ReactorsHandles) { if (builder.TryGetCadObject(handle, out CadObject reactor)) { this.CadObject.Reactors.Add(handle, reactor); } } foreach (KeyValuePair <ulong, ExtendedData> item in this.EDataTemplate) { if (builder.TryGetCadObject(item.Key, out AppId app)) { } } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); Viewport viewport = this.CadObject as Viewport; if (this.ViewportHeaderHandle.HasValue && this.ViewportHeaderHandle > 0) { builder.NotificationHandler?.Invoke(null, new NotificationEventArgs($"ViewportHeaderHandle not implemented for Viewport, handle {this.ViewportHeaderHandle}")); } if (this.BoundaryHandle.HasValue && this.BoundaryHandle > 0) { var entity = builder.GetCadObject<Entity>(this.BoundaryHandle.Value); if (entity != null) viewport.Boundary = entity; } if (this.NamedUcsHandle.HasValue && this.NamedUcsHandle > 0) { builder.NotificationHandler?.Invoke(null, new NotificationEventArgs($"Named ucs not implemented for Viewport, handle {this.NamedUcsHandle}")); } if (this.BaseUcsHandle.HasValue && this.BaseUcsHandle > 0) { builder.NotificationHandler?.Invoke(null, new NotificationEventArgs($"Base ucs not implemented for Viewport, handle {this.BaseUcsHandle}")); } foreach (var handle in this.FrozenLayerHandles) { var layer = builder.GetCadObject<Layer>(handle); if (layer != null) viewport.FrozenLayers.Add(layer); } }
private void applyLineType(CadDocumentBuilder builder) { this.CadObject.LineType = builder.GetCadObject <LineType>(this.LineTypeHandle.Value); }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); if (this.LayerHandle.HasValue && builder.TryGetCadObject <Layer>(this.LayerHandle.Value, out Layer layer)) { this.CadObject.Layer = layer; } //Handle the line type for this entity if (this.LtypeFlags.HasValue) { switch (this.LtypeFlags) { case 0: //Get the linetype by layer this.CadObject.LineType = builder.LineTypes["ByLayer"]; break; case 1: //Get the linetype by block this.CadObject.LineType = builder.LineTypes["ByBlock"]; break; case 2: //Get the linetype by continuous this.CadObject.LineType = builder.LineTypes["Continuous"]; break; case 3: if (this.LineTypeHandle.HasValue) { applyLineType(builder); } break; } } else if (this.LineTypeHandle.HasValue) { applyLineType(builder); } else { //TODO: Dxf sets the linetype by name // this.CadObject.LineType = builder.LineTypes["ByLayer"]; } if (this.ColorHandle.HasValue) { var dwgColor = builder.GetCadObject <DwgColorTemplate.DwgColor>(this.ColorHandle.Value); if (dwgColor != null) { this.CadObject.Color = dwgColor.Color; } } else { //TODO: Set color by name, only for dxf? } }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); //TODO: Finish shape template }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); }
public override void Build(CadDocumentBuilder builder) { base.Build(builder); throw new NotImplementedException(); }