<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Adding the numeric contents in the  next text in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/adding-the-numeric-contents-in-the-next-text/m-p/12776723#M3943</link>
    <description>&lt;P&gt;using Autodesk.AutoCAD.Runtime;&lt;BR /&gt;using Autodesk.AutoCAD.ApplicationServices;&lt;BR /&gt;using Autodesk.AutoCAD.EditorInput;&lt;BR /&gt;using Autodesk.AutoCAD.DatabaseServices;&lt;BR /&gt;using Autodesk.AutoCAD.Geometry;&lt;BR /&gt;using System;&lt;BR /&gt;using System.Collections.Generic;&lt;BR /&gt;using System.Linq;&lt;/P&gt;&lt;P&gt;namespace YourAutoCADPluginNamespace&lt;BR /&gt;{&lt;BR /&gt;public class TextProcessingCommands&lt;BR /&gt;{&lt;BR /&gt;[CommandMethod("ExtractAndSumText")]&lt;BR /&gt;public void ExtractAndSumText()&lt;BR /&gt;{&lt;BR /&gt;Document doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;Database db = doc.Database;&lt;BR /&gt;Editor ed = doc.Editor;&lt;/P&gt;&lt;P&gt;PromptSelectionResult selRes = ed.GetSelection();&lt;BR /&gt;if (selRes.Status != PromptStatus.OK)&lt;BR /&gt;{&lt;BR /&gt;ed.WriteMessage("\nError in getting selection.");&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;using (Transaction tr = db.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;BR /&gt;double totalCfm = 0.0;&lt;/P&gt;&lt;P&gt;SelectionSet selSet = selRes.Value;&lt;BR /&gt;foreach (SelectedObject selObj in selSet)&lt;BR /&gt;{&lt;BR /&gt;if (selObj.ObjectId.ObjectClass.Name != "AcDbText")&lt;BR /&gt;continue;&lt;/P&gt;&lt;P&gt;DBText txt = tr.GetObject(selObj.ObjectId, OpenMode.ForRead) as DBText;&lt;BR /&gt;if (txt != null)&lt;BR /&gt;{&lt;BR /&gt;string textContents = txt.TextString;&lt;BR /&gt;string[] splitText = textContents.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);&lt;/P&gt;&lt;P&gt;foreach (string item in splitText)&lt;BR /&gt;{&lt;BR /&gt;double numericValue;&lt;BR /&gt;if (double.TryParse(item, out numericValue))&lt;BR /&gt;{&lt;BR /&gt;totalCfm += numericValue;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Create new text entity with the total CFM&lt;BR /&gt;Point3d insertPt = new Point3d(0, 0, 0); // You need to define the insertion point&lt;BR /&gt;using (DBText totalTxt = new DBText())&lt;BR /&gt;{&lt;BR /&gt;totalTxt.TextString = totalCfm.ToString();&lt;BR /&gt;totalTxt.Position = insertPt;&lt;/P&gt;&lt;P&gt;BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;&lt;BR /&gt;BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;&lt;/P&gt;&lt;P&gt;btr.AppendEntity(totalTxt);&lt;BR /&gt;tr.AddNewlyCreatedDBObject(totalTxt, true);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;tr.Commit();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am having above code to create the automate calculate the total cfm.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example&amp;nbsp; ; 1000 CFM and 2000 CFM = 3000 CFM&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Thu, 16 May 2024 04:57:22 GMT</pubDate>
    <dc:creator>vivekanandanXVLYD</dc:creator>
    <dc:date>2024-05-16T04:57:22Z</dc:date>
    <item>
      <title>Adding the numeric contents in the  next text</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-the-numeric-contents-in-the-next-text/m-p/12776723#M3943</link>
      <description>&lt;P&gt;using Autodesk.AutoCAD.Runtime;&lt;BR /&gt;using Autodesk.AutoCAD.ApplicationServices;&lt;BR /&gt;using Autodesk.AutoCAD.EditorInput;&lt;BR /&gt;using Autodesk.AutoCAD.DatabaseServices;&lt;BR /&gt;using Autodesk.AutoCAD.Geometry;&lt;BR /&gt;using System;&lt;BR /&gt;using System.Collections.Generic;&lt;BR /&gt;using System.Linq;&lt;/P&gt;&lt;P&gt;namespace YourAutoCADPluginNamespace&lt;BR /&gt;{&lt;BR /&gt;public class TextProcessingCommands&lt;BR /&gt;{&lt;BR /&gt;[CommandMethod("ExtractAndSumText")]&lt;BR /&gt;public void ExtractAndSumText()&lt;BR /&gt;{&lt;BR /&gt;Document doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;Database db = doc.Database;&lt;BR /&gt;Editor ed = doc.Editor;&lt;/P&gt;&lt;P&gt;PromptSelectionResult selRes = ed.GetSelection();&lt;BR /&gt;if (selRes.Status != PromptStatus.OK)&lt;BR /&gt;{&lt;BR /&gt;ed.WriteMessage("\nError in getting selection.");&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;using (Transaction tr = db.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;BR /&gt;double totalCfm = 0.0;&lt;/P&gt;&lt;P&gt;SelectionSet selSet = selRes.Value;&lt;BR /&gt;foreach (SelectedObject selObj in selSet)&lt;BR /&gt;{&lt;BR /&gt;if (selObj.ObjectId.ObjectClass.Name != "AcDbText")&lt;BR /&gt;continue;&lt;/P&gt;&lt;P&gt;DBText txt = tr.GetObject(selObj.ObjectId, OpenMode.ForRead) as DBText;&lt;BR /&gt;if (txt != null)&lt;BR /&gt;{&lt;BR /&gt;string textContents = txt.TextString;&lt;BR /&gt;string[] splitText = textContents.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);&lt;/P&gt;&lt;P&gt;foreach (string item in splitText)&lt;BR /&gt;{&lt;BR /&gt;double numericValue;&lt;BR /&gt;if (double.TryParse(item, out numericValue))&lt;BR /&gt;{&lt;BR /&gt;totalCfm += numericValue;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Create new text entity with the total CFM&lt;BR /&gt;Point3d insertPt = new Point3d(0, 0, 0); // You need to define the insertion point&lt;BR /&gt;using (DBText totalTxt = new DBText())&lt;BR /&gt;{&lt;BR /&gt;totalTxt.TextString = totalCfm.ToString();&lt;BR /&gt;totalTxt.Position = insertPt;&lt;/P&gt;&lt;P&gt;BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;&lt;BR /&gt;BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;&lt;/P&gt;&lt;P&gt;btr.AppendEntity(totalTxt);&lt;BR /&gt;tr.AddNewlyCreatedDBObject(totalTxt, true);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;tr.Commit();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am having above code to create the automate calculate the total cfm.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example&amp;nbsp; ; 1000 CFM and 2000 CFM = 3000 CFM&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 04:57:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-the-numeric-contents-in-the-next-text/m-p/12776723#M3943</guid>
      <dc:creator>vivekanandanXVLYD</dc:creator>
      <dc:date>2024-05-16T04:57:22Z</dc:date>
    </item>
  </channel>
</rss>

