public DxfAttributeObjectContextData(DxfAttributeDefinition attribute, DxfScale scale) : base((DxfText)attribute, scale) { DxfMText mtext = attribute.method_21(); this.dxfMTextObjectContextData_0 = mtext != null ? new DxfMTextObjectContextData(mtext, scale) : (DxfMTextObjectContextData)null; }
public override void Visit(DxfAttributeDefinition attributeDefinition) { if (!(this.string_0 == attributeDefinition.TagString)) { return; } this.dxfAttributeDefinition_0 = attributeDefinition; }
internal bool method_12() { bool flag = false; foreach (DxfEntity dxfEntity in (DxfHandledObjectCollection <DxfEntity>) this.dxfEntityCollection_0) { DxfAttributeDefinition attributeDefinition = dxfEntity as DxfAttributeDefinition; if (attributeDefinition != null && (attributeDefinition.Flags & AttributeFlags.Constant) == AttributeFlags.None) { flag = true; break; } } return(flag); }
public void Visit(DxfAttributeDefinition attributeDefinition) { this.method_0((DxfEntity)attributeDefinition); }
public override void Visit(DxfAttributeDefinition attributeDefinition) { this.list_0.Add(attributeDefinition); }
public void Visit(DxfAttributeDefinition attributeDefinition) { this.bool_0 = true; }
/// <summary> /// Visits the specified entity. /// See the <see cref="IEntityVisitor"/> for more details. /// </summary> public override void Visit(DxfAttributeDefinition attributeDefinition) { HandleEntity(attributeDefinition); }
static void FindEntities(DxfEntityCollection Entities) { foreach (var entityGroups in Entities) { if (typeof(DxfLine) != entityGroups.GetType() && typeof(DxfLwPolyline) != entityGroups.GetType() && typeof(DxfMText) != entityGroups.GetType() && typeof(DxfText) != entityGroups.GetType() && typeof(DxfCircle) != entityGroups.GetType() && typeof(DxfHatch) != entityGroups.GetType() && typeof(DxfInsert) != entityGroups.GetType() && typeof(DxfSpline) != entityGroups.GetType()) { // Console.WriteLine(entityGroups.GetType()); } dxfType.Add(entityGroups.GetType().Name); if (typeof(DxfLine) == entityGroups.GetType()) { dxfLine = entityGroups as DxfLine; int color; if (dxfLine.Color.ColorType.ToString() == "ByLayer") { color = dxfLine.Layer.Color.Rgb; } else { color = dxfLine.Color.Rgb; } CADLine cADLine = new CADLine { parentHandle = dxfLine.OwnerObjectSoftReference.Handle, type = dxfLine.GetType().Name, color = color, transform = dxfLine.Transform.DebugString, startPoint = dxfLine.Start.ToString(), endPoint = dxfLine.End.ToString(), lineWeight = dxfLine.LineWeight }; cadEntities.Add(cADLine); } if (typeof(DxfLwPolyline) == entityGroups.GetType()) { //Console.WriteLine(dxfLwPolyline); dxfLwPolyline = entityGroups as DxfLwPolyline; string[] arrVertices = new string[dxfLwPolyline.Vertices.Count]; for (int i = 0; i < dxfLwPolyline.Vertices.Count; i++) { arrVertices[i] = dxfLwPolyline.Vertices[i].ToString(); } int color; if (dxfLwPolyline.Color.ColorType.ToString() == "ByLayer") { color = dxfLwPolyline.Layer.Color.Rgb; } else { color = dxfLwPolyline.Color.Rgb; } CADLwPolyLine cADLwPolyLine = new CADLwPolyLine { parentHandle = dxfLwPolyline.OwnerObjectSoftReference.Handle, type = dxfLwPolyline.GetType().Name, color = color, transform = dxfLwPolyline.Transform.DebugString, vertices = arrVertices, closed = dxfLwPolyline.Closed.ToString(), }; cadEntities.Add(cADLwPolyLine); } if (typeof(DxfXLine) == entityGroups.GetType()) { dxfXLine = entityGroups as DxfXLine; } if (typeof(DxfSpline) == entityGroups.GetType()) { dxfSpline = entityGroups as DxfSpline; string[] arrFitPoints = new string[dxfSpline.FitPoints.Count]; for (int i = 0; i < dxfSpline.FitPoints.Count; i++) { arrFitPoints[i] = dxfSpline.FitPoints[i].ToString(); } int color; if (dxfSpline.Color.ColorType.ToString() == "ByLayer") { color = dxfSpline.Layer.Color.Rgb; } else { color = dxfSpline.Color.Rgb; } CADSpline cADSpline = new CADSpline { parentHandle = dxfSpline.OwnerObjectSoftReference.Handle, type = dxfSpline.GetType().Name, color = color, transform = dxfSpline.Transform.DebugString, fitPoints = arrFitPoints, }; cadEntities.Add(cADSpline); } if (typeof(DxfCircle) == entityGroups.GetType()) { dxfCircle = entityGroups as DxfCircle; int color; if (dxfCircle.Color.ColorType.ToString() == "ByLayer") { color = dxfCircle.Layer.Color.Rgb; } else { color = dxfCircle.Color.Rgb; } CADCircle cADCircle = new CADCircle { parentHandle = dxfCircle.OwnerObjectSoftReference.Handle, type = dxfCircle.GetType().Name, color = color, transform = dxfCircle.Transform.DebugString, center = dxfCircle.Center.ToString(), radius = dxfCircle.Radius }; cadEntities.Add(cADCircle); kcircle.Add(dxfCircle); } if (typeof(DxfArc) == entityGroups.GetType()) { dxfArc = entityGroups as DxfArc; int color; if (dxfArc.Color.ColorType.ToString() == "ByLayer") { color = dxfArc.Layer.Color.Rgb; } else { color = dxfArc.Color.Rgb; } CADArc cADArc = new CADArc { parentHandle = dxfArc.OwnerObjectSoftReference.Handle, type = dxfArc.GetType().Name, color = color, transform = dxfArc.Transform.DebugString, center = dxfArc.Center.ToString(), startAngle = dxfArc.StartAngle, endAngle = dxfArc.EndAngle, radius = dxfArc.Radius }; cadEntities.Add(cADArc); } if (typeof(DxfEllipse) == entityGroups.GetType()) { dxfEllipse = entityGroups as DxfEllipse; int color; if (dxfEllipse.Color.ColorType.ToString() == "ByLayer") { color = dxfEllipse.Layer.Color.Rgb; } else { color = dxfEllipse.Color.Rgb; } CADEllipse cADEllipse = new CADEllipse { parentHandle = dxfEllipse.OwnerObjectSoftReference.Handle, type = dxfEllipse.GetType().Name, color = color, transform = dxfEllipse.Transform.DebugString, center = dxfEllipse.Center.ToString(), majorAxisEndPoint = dxfEllipse.MajorAxisEndPoint.ToString(), minorAxisEndPoint = dxfEllipse.MinorAxisEndPoint.ToString(), startParameter = dxfEllipse.StartParameter, endParameter = dxfEllipse.EndParameter }; cadEntities.Add(cADEllipse); } if (typeof(DxfMText) == entityGroups.GetType()) { dxfMText = entityGroups as DxfMText; int color; if (dxfMText.Color.ColorType.ToString() == "ByLayer") { color = dxfMText.Layer.Color.Rgb; } else { color = dxfMText.Color.Rgb; } if (dxfMText.SimplifiedText == "C座一层平面图") { ktls.Add(dxfMText); } CADMText cADMText = new CADMText { parentHandle = dxfMText.OwnerObjectSoftReference.Handle, type = dxfMText.GetType().Name, color = color, transform = dxfMText.Transform.DebugString, simplifiedText = dxfMText.SimplifiedText.ToString(), fontStyle = dxfMText.Style.ToString(), size = dxfMText.Height, attachmentPoint = dxfMText.AttachmentPoint.ToString(), boxHeight = dxfMText.BoxHeight, boxWidth = dxfMText.BoxWidth }; cadEntities.Add(cADMText); if (dxfMText.SimplifiedText.ToString() == "图 纸 目 录") { //Console.WriteLine(222222); ktls.Add(dxfMText); } if (dxfMText.SimplifiedText.ToString() == "JS-T5-302") { //Console.WriteLine(222222); ktls.Add(dxfMText); } } if (typeof(DxfText) == entityGroups.GetType()) { dxfText = entityGroups as DxfText; int color; if (dxfText.Color.ColorType.ToString() == "ByLayer") { color = dxfText.Layer.Color.Rgb; } else { color = dxfText.Color.Rgb; } CADText cADText = new CADText { parentHandle = dxfText.OwnerObjectSoftReference.Handle, type = dxfText.GetType().Name, color = color, transform = dxfText.Transform.DebugString, simplifiedText = dxfText.SimplifiedText.ToString(), fontStyle = dxfText.Style.ToString(), size = dxfText.Height, alignMentPoint1 = dxfText.AlignmentPoint1.ToString(), rotationAngle = dxfText.Rotation, }; if (dxfText.SimplifiedText == "JS-T5-001 ") { ktest.Add(dxfText); } cadEntities.Add(cADText); } if (typeof(DxfInsert) == entityGroups.GetType()) { dxfInsert = entityGroups as DxfInsert; kins.Add(dxfInsert); if (dxfInsert.Block != null) { ulong count; if (dxfInsert.Block != null) { count = dxfInsert.Block.Handle; } else { count = 0; } CADInsert cADInsert = new CADInsert(); cADInsert.parentHandle = dxfInsert.OwnerObjectSoftReference.Handle; cADInsert.type = dxfInsert.GetType().Name; cADInsert.transform = dxfInsert.Transform.DebugString; cADInsert.insertPoint = dxfInsert.InsertionPoint.ToString(); cADInsert.rotationAngle = dxfInsert.Rotation; cADInsert.insertName = dxfInsert.Block.Name; cADInsert.nowHandle = count; cADInsert.insertScale = dxfInsert.ScaleFactor.ToString(); cadEntities.Add(cADInsert); FindEntities(dxfInsert.Block.Entities); } } if (typeof(DxfAttributeDefinition) == entityGroups.GetType()) { dxfAttributeDefinition = entityGroups as DxfAttributeDefinition; //Console.WriteLine(dxfAttributeDefinition); } if (typeof(DxfDimension.Linear) == entityGroups.GetType()) { Console.WriteLine(11111); } } }
private static List <DxfEntity> OffsetToNest(IList <DxfEntity> dxfEntities, DxfPoint pivot, DxfPoint offset, double rotationAngle) { List <DxfEntity> dxfreturn = new List <DxfEntity>(); List <DxfPoint> tmpPts; foreach (DxfEntity entity in dxfEntities) { switch (entity.EntityType) { case DxfEntityType.Arc: DxfArc dxfArc = (DxfArc)entity; dxfArc.Center = RotateLocation(rotationAngle, dxfArc.Center); dxfArc.Center += offset; dxfArc.StartAngle += rotationAngle; dxfArc.EndAngle += rotationAngle; dxfreturn.Add(dxfArc); break; case DxfEntityType.ArcAlignedText: DxfArcAlignedText dxfArcAligned = (DxfArcAlignedText)entity; dxfArcAligned.CenterPoint = RotateLocation(rotationAngle, dxfArcAligned.CenterPoint); dxfArcAligned.CenterPoint += offset; dxfArcAligned.StartAngle += rotationAngle; dxfArcAligned.EndAngle += rotationAngle; dxfreturn.Add(dxfArcAligned); break; case DxfEntityType.Attribute: DxfAttribute dxfAttribute = (DxfAttribute)entity; dxfAttribute.Location = RotateLocation(rotationAngle, dxfAttribute.Location); dxfAttribute.Location += offset; dxfreturn.Add(dxfAttribute); break; case DxfEntityType.AttributeDefinition: DxfAttributeDefinition dxfAttributecommon = (DxfAttributeDefinition)entity; dxfAttributecommon.Location = RotateLocation(rotationAngle, dxfAttributecommon.Location); dxfAttributecommon.Location += offset; dxfreturn.Add(dxfAttributecommon); break; case DxfEntityType.Circle: DxfCircle dxfCircle = (DxfCircle)entity; dxfCircle.Center = RotateLocation(rotationAngle, dxfCircle.Center); dxfCircle.Center += offset; dxfreturn.Add(dxfCircle); break; case DxfEntityType.Ellipse: DxfEllipse dxfEllipse = (DxfEllipse)entity; dxfEllipse.Center = RotateLocation(rotationAngle, dxfEllipse.Center); dxfEllipse.Center += offset; dxfreturn.Add(dxfEllipse); break; case DxfEntityType.Image: DxfImage dxfImage = (DxfImage)entity; dxfImage.Location = RotateLocation(rotationAngle, dxfImage.Location); dxfImage.Location += offset; dxfreturn.Add(dxfImage); break; case DxfEntityType.Leader: DxfLeader dxfLeader = (DxfLeader)entity; tmpPts = new List <DxfPoint>(); foreach (DxfPoint vrt in dxfLeader.Vertices) { var tmppnt = RotateLocation(rotationAngle, vrt); tmppnt += offset; tmpPts.Add(tmppnt); } dxfLeader.Vertices.Clear(); dxfLeader.Vertices.Concat(tmpPts); dxfreturn.Add(dxfLeader); break; case DxfEntityType.Line: DxfLine dxfLine = (DxfLine)entity; dxfLine.P1 = RotateLocation(rotationAngle, dxfLine.P1); dxfLine.P2 = RotateLocation(rotationAngle, dxfLine.P2); dxfLine.P1 += offset; dxfLine.P2 += offset; dxfreturn.Add(dxfLine); break; case DxfEntityType.LwPolyline: DxfPolyline dxfPoly = (DxfPolyline)entity; foreach (DxfVertex vrt in dxfPoly.Vertices) { vrt.Location = RotateLocation(rotationAngle, vrt.Location); vrt.Location += offset; } dxfreturn.Add(dxfPoly); break; case DxfEntityType.MLine: DxfMLine mLine = (DxfMLine)entity; tmpPts = new List <DxfPoint>(); mLine.StartPoint += offset; mLine.StartPoint = RotateLocation(rotationAngle, mLine.StartPoint); foreach (DxfPoint vrt in mLine.Vertices) { var tmppnt = RotateLocation(rotationAngle, vrt); tmppnt += offset; tmpPts.Add(tmppnt); } mLine.Vertices.Clear(); mLine.Vertices.Concat(tmpPts); dxfreturn.Add(mLine); break; case DxfEntityType.Polyline: DxfPolyline polyline = (DxfPolyline)entity; List <DxfVertex> verts = new List <DxfVertex>(); foreach (DxfVertex vrt in polyline.Vertices) { var tmppnt = vrt; tmppnt.Location = RotateLocation(rotationAngle, tmppnt.Location); tmppnt.Location += offset; verts.Add(tmppnt); } DxfPolyline polyout = new DxfPolyline(verts); polyout.Location = polyline.Location + offset; polyout.IsClosed = polyline.IsClosed; polyout.Layer = polyline.Layer; dxfreturn.Add(polyout); break; case DxfEntityType.Body: case DxfEntityType.DgnUnderlay: case DxfEntityType.Dimension: case DxfEntityType.DwfUnderlay: case DxfEntityType.Face: case DxfEntityType.Helix: case DxfEntityType.Insert: case DxfEntityType.Light: case DxfEntityType.ModelerGeometry: case DxfEntityType.MText: case DxfEntityType.OleFrame: case DxfEntityType.Ole2Frame: case DxfEntityType.PdfUnderlay: case DxfEntityType.Point: case DxfEntityType.ProxyEntity: case DxfEntityType.Ray: case DxfEntityType.Region: case DxfEntityType.RText: case DxfEntityType.Section: case DxfEntityType.Seqend: case DxfEntityType.Shape: case DxfEntityType.Solid: case DxfEntityType.Spline: case DxfEntityType.Text: case DxfEntityType.Tolerance: case DxfEntityType.Trace: case DxfEntityType.Underlay: case DxfEntityType.Vertex: case DxfEntityType.WipeOut: case DxfEntityType.XLine: throw new ArgumentException("unsupported entity type: " + entity.EntityType); } } return(dxfreturn); }
public override void Visit(DxfAttributeDefinition attributeDefinition) { attributeDefinition.method_19(); }