コード例 #1
0
ファイル: EntityCounter.cs プロジェクト: 15831944/WW
 public void Visit(DxfXLine xline)
 {
     this.method_0((DxfEntity)xline);
 }
コード例 #2
0
 /// <summary>
 /// Visits the specified entity.
 /// See the <see cref="IEntityVisitor"/> for more details.
 /// </summary>
 public override void Visit(DxfXLine xline)
 {
     HandleEntity(xline);
 }
コード例 #3
0
 public void Visit(DxfXLine xline)
 {
     this.bool_0 = true;
 }
コード例 #4
0
        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);
                }
            }
        }