Example #1
0
        } // End Sub ExportToSvg

        // For better visibility when testing.
        public static void OverwriteStrokeWidth(System.Xml.XmlTextWriter w, WW.Cad.Model.Entities.DxfEntity entity)
        {
            w.WriteAttributeString("stroke-width", "5");
        } // End Sub OverwriteStrokeWidth
Example #2
0
        } // End Sub OverwriteStrokeWidth

        public static void AdditionalAttribute(System.Xml.XmlTextWriter w, WW.Cad.Model.Entities.DxfEntity entity)
        {
            /*
             * if (System.StringComparer.OrdinalIgnoreCase.Equals("FM_OBJEKT_RAUM", entity.Layer.Name))
             *  System.Console.WriteLine(entity.Layer);
             *
             *
             * WW.Cad.Model.DxfHandledObject abc = (WW.Cad.Model.DxfHandledObject)entity;
             * if (abc.ExtendedDataCollection.Count > 0)
             * {
             *  System.Console.WriteLine(abc.ExtendedDataCollection);
             *  foreach (WW.Cad.Model.DxfExtendedData data in abc.ExtendedDataCollection)
             *  {
             *
             *
             *
             *      foreach (WW.Cad.Model.IExtendedDataValue x in data.Values)
             *      {
             *          System.Type t = x.GetType();
             *
             *          // https://www.woutware.com/doc/cadlib3.5/html/8afa4797-7737-1192-ac52-da39a3c02d4e.htm
             *          // https://www.woutware.com/Forum/Topic/1039/retrieving-attributes?returnUrl=%2FForum%2FUserPosts%3FuserId%3D1963963672
             *          if (object.ReferenceEquals(t, typeof(WW.Cad.Model.DxfExtendedData.String)))
             *          {
             *              WW.Cad.Model.DxfExtendedData.String xx = (WW.Cad.Model.DxfExtendedData.String)x;
             *              System.Console.WriteLine(xx);
             *          }
             *          else if (object.ReferenceEquals(t, typeof(WW.Cad.Model.DxfExtendedData.Int16)))
             *          {
             *              WW.Cad.Model.DxfExtendedData.Int16 xx = (WW.Cad.Model.DxfExtendedData.Int16)x;
             *              System.Console.WriteLine(xx);
             *          }
             *          else if (object.ReferenceEquals(t, typeof(WW.Cad.Model.DxfExtendedData.Int32)))
             *          {
             *              WW.Cad.Model.DxfExtendedData.Int32 xx = (WW.Cad.Model.DxfExtendedData.Int32)x;
             *              System.Console.WriteLine(xx);
             *          }
             *          else if (object.ReferenceEquals(t, typeof(WW.Cad.Model.DxfExtendedData.DatabaseHandle)))
             *          {
             *              if (x != null)
             *              {
             *                  WW.Cad.Model.DxfExtendedData.DatabaseHandle xx = (WW.Cad.Model.DxfExtendedData.DatabaseHandle)x;
             *                  if(xx != null)
             *                      System.Console.WriteLine(xx);
             *              }
             *          }
             *          else
             *          {
             *              System.Console.WriteLine(t);
             *          }
             *
             *
             *      }
             *
             *
             *
             *  }
             * }
             */

            // if (abc.ExtensionDictionary != null && abc.ExtensionDictionary.Entries.Count > 0)
            //     System.Console.WriteLine(abc.ExtensionDictionary.Entries);


            //// https://www.woutware.com/Forum/Topic/1039/retrieving-attributes?returnUrl=%2FForum%2FUserPosts%3FuserId%3D1963963672
            //if (entity.AcClass == "AcDbMInsertBlock")
            //{
            //    WW.Cad.Model.Entities.DxfInsert blockref = (WW.Cad.Model.Entities.DxfInsert)entity;
            //    System.Console.WriteLine(blockref.Block.Name);

            //    foreach (WW.Cad.Model.Entities.DxfAttribute attr in blockref.Attributes)
            //    {
            //        System.Console.WriteLine("\t" + attr.TagString);
            //        System.Console.WriteLine("\t\t" + attr.Text);
            //    } // Next attr
            //} // End if (entity.AcClass == "AcDbMInsertBlock")

            w.WriteAttributeString("data-handle", entity.Handle.ToString(System.Globalization.CultureInfo.InvariantCulture));
        } // End Sub AdditionalAttribute
Example #3
0
        public static void FixDoubleLines(WW.Cad.Model.DrawingCodePage drawingCodePage, WW.Cad.Model.Entities.DxfEntity entity)
        {
            //if (System.StringComparer.OrdinalIgnoreCase.Equals("FM_OBJEKT_RAUM", model.Entities[i].Layer.Name))
            //{
            //    //System.Console.WriteLine(model.Entities[i].AcClass);
            //    //System.Console.WriteLine(model.Entities[i].LineWeight);
            //    //System.Console.WriteLine(model.Entities[i].EntityType);
            //    //System.Console.WriteLine(model.Entities[i].LineType);
            //    //System.Console.WriteLine(model.Entities[i].LineTypeScale);
            //    //System.Console.WriteLine(model.Entities[i].Layer.Name);
            //} //End if (System.StringComparer.OrdinalIgnoreCase.Equals("FM_OBJEKT_RAUM", model.Entities[i].Layer.Name))


            if (entity is WW.Cad.Model.Entities.DxfInsert)
            {
                WW.Cad.Model.Entities.DxfInsert ins = (WW.Cad.Model.Entities.DxfInsert)entity;
                for (int i = 0; i < ins.Block.Entities.Count; ++i)
                {
                    FixDoubleLines(drawingCodePage, ins.Block.Entities[i]);
                } // Next i
            }     // End if (entity is WW.Cad.Model.Entities.DxfInsert)
            // https://www.woutware.com/Forum/Topic/1388/svg-export-path-goes-2x-around?returnUrl=%2FForum%2FBoard%2F2%2Fquestions-and-general-support&page=1
            else if (entity is WW.Cad.Model.Entities.DxfPolyline2D)
            {
                WW.Cad.Model.Entities.DxfPolyline2D dxfPolyline = (WW.Cad.Model.Entities.DxfPolyline2D)entity;
                dxfPolyline.DefaultStartWidth = 0.0;
                dxfPolyline.DefaultEndWidth   = 0.0;

                foreach (WW.Cad.Model.Entities.DxfVertex2D thisVertex in dxfPolyline.Vertices)
                {
                    thisVertex.StartWidth = 0.0;
                    thisVertex.EndWidth   = 0.0;
                } // Next thisVertex
            }
            else if (entity is WW.Cad.Model.Entities.DxfLwPolyline)
            {
                WW.Cad.Model.Entities.DxfLwPolyline dwgPolyLine = (WW.Cad.Model.Entities.DxfLwPolyline)entity;

                // https://www.woutware.com/Forum/Topic/20/generating-thick-lines?returnUrl=%2FForum%2FUserPosts%3FuserId%3D743420688
                // set the property ConstantWidth. Don't confuse it with property Thickness though: the thickness is the extrusion along its z-axis
                dwgPolyLine.ConstantWidth = 0.0;
                dwgPolyLine.LineWeight    = 0;
                dwgPolyLine.Thickness     = 0.0;

                foreach (WW.Cad.Model.Entities.DxfLwPolyline.Vertex thisVertex in dwgPolyLine.Vertices)
                {
                    thisVertex.StartWidth = 0.0;
                    thisVertex.EndWidth   = 0.0;
                } // Next tVertex
            }     // End else if (entity is WW.Cad.Model.Entities.DxfLwPolyline)
#if  COMPENSATE_TEIGHA_BUG
            else if (entity is WW.Cad.Model.Entities.DxfText)
            {
                WW.Cad.Model.Entities.DxfText dxtext = (WW.Cad.Model.Entities.DxfText)entity;

                string corrected = null;
                if (FixTextWithWrongEncoding(drawingCodePage, dxtext.Text, ref corrected))
                {
                    dxtext.Text = corrected;
                } // End if (FixBrokenText(drawingCodePage, dxtext.Text, ref corrected))
            }     // End else if (entity is WW.Cad.Model.Entities.DxfText)
#endif
        }         // End Sub FixDoubleLines