<?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 Re: How to edit part of the dtext? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7671262#M28267</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the intent with the highlighted line below was to create a temporary copy of the DBText, you need to call Clone(), otherwise it's operating on the 'textOrig', which you probably don't want to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&amp;nbsp;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/845950"&gt;@tbrammer&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;First you need the DBText object itself. If you have the two points p1 and p2 of the enclosing rectangle you can use them to retrieve a selection set that contains the DBText. Next have to find the indices of the first and last character that is within the rectangle.&lt;/P&gt;&lt;P&gt;I would suggest to create a DBText object with the same properties as the selected one, and evaluate its extents with different TextString lengths:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Point3d p1, p2; // The selected Points. 
// p1 must be "minpoint" and p2 "maxpoint": (p1[k] &amp;lt; p2[k]) must hold for all k
DBText txtOrig = ...  // Your text object
&lt;FONT color="#FF0000"&gt;DBText txt = txtOrig; // temporary copy of the text object&lt;/FONT&gt;
Extents3d extPrev = new Extents3d();
int iFirst = -1, iLast = -1; // Index of first and last character within [p1 p2]
for (int n=1; n&amp;lt;=txtOrig.TextString.Length; ++n)
{
	// Analyze the extents of a DBText with the first n characters of the original text
	txt.TextString = txtOrig.TextString.Substring(0, n);
	Extents3d ext = txt.GeometricExtents;
	extPrev = ext;

	// Get the extents of the n-th character
	Extents3d ext_n = new Extents3d();
	if (n == 0)
		ext_n = ext;
	else
	{
		Point3d min = new Point3d(extPrev.MaxPoint.X, ext.MinPoint.Y, ext.MinPoint.Z);
		ext_n.Set(min, ext.MaxPoint);
	}

	// Does ext_n overlap with the selected rectangle?
	if (ext_n.MaxPoint.X &amp;gt; p1.X &amp;amp;&amp;amp; ext_n.MinPoint.Y &amp;lt; p2.X ) // within X-extents?
	{
		// n-th char is within the [p1 p2] rectangle
		if (iFirst &amp;lt; 0)
			iFirst = n;
		iLast = n;
	}&lt;BR /&gt;        // Now you can replace chars iFirst...iLast
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the code above doesn't consider multiline text and text rotation.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jan 2018 08:02:13 GMT</pubDate>
    <dc:creator>ActivistInvestor</dc:creator>
    <dc:date>2018-01-08T08:02:13Z</dc:date>
    <item>
      <title>How to edit part of the dtext?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7668760#M28264</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;I want to edit a part of the dtext, the step like:&lt;/P&gt;
&lt;P&gt;1.run the command&lt;/P&gt;
&lt;P&gt;2.select two points,get '89a'&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="S-628.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/446330i3051B1E84DAEB928/image-size/large?v=v2&amp;amp;px=999" role="button" title="S-628.png" alt="S-628.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;3.input the replace character '5'&lt;/P&gt;
&lt;P&gt;4.get the result dtext&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="S-629.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/446331iA1CBCE11512D0063/image-size/large?v=v2&amp;amp;px=999" role="button" title="S-629.png" alt="S-629.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jan 2018 04:13:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7668760#M28264</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2018-01-06T04:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit part of the dtext?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7669066#M28265</link>
      <description>&lt;P&gt;First you need the DBText object itself. If you have the two points p1 and p2 of the enclosing rectangle you can use them to retrieve a selection set that contains the DBText. Next have to find the indices of the first and last character that is within the rectangle.&lt;/P&gt;
&lt;P&gt;I would suggest to create a DBText object with the same properties as the selected one, and evaluate its extents with different TextString lengths:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Point3d p1, p2; // The selected Points. 
// p1 must be "minpoint" and p2 "maxpoint": (p1[k] &amp;lt; p2[k]) must hold for all k
DBText txtOrig = ...  // Your text object
DBText txt = txtOrig; // temporary copy of the text object
Extents3d extPrev = new Extents3d();
int iFirst = -1, iLast = -1; // Index of first and last character within [p1 p2]
for (int n=1; n&amp;lt;=txtOrig.TextString.Length; ++n)
{
	// Analyze the extents of a DBText with the first n characters of the original text
	txt.TextString = txtOrig.TextString.Substring(0, n);
	Extents3d ext = txt.GeometricExtents;
	extPrev = ext;

	// Get the extents of the n-th character
	Extents3d ext_n = new Extents3d();
	if (n == 0)
		ext_n = ext;
	else
	{
		Point3d min = new Point3d(extPrev.MaxPoint.X, ext.MinPoint.Y, ext.MinPoint.Z);
		ext_n.Set(min, ext.MaxPoint);
	}

	// Does ext_n overlap with the selected rectangle?
	if (ext_n.MaxPoint.X &amp;gt; p1.X &amp;amp;&amp;amp; ext_n.MinPoint.Y &amp;lt; p2.X ) // within X-extents?
	{
		// n-th char is within the [p1 p2] rectangle
		if (iFirst &amp;lt; 0)
			iFirst = n;
		iLast = n;
	}&lt;BR /&gt;        // Now you can replace chars iFirst...iLast
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that the code above doesn't consider multiline text and text rotation.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jan 2018 11:49:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7669066#M28265</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2018-01-06T11:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit part of the dtext?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7669914#M28266</link>
      <description>&lt;P&gt;thank you. I tried the code, but the %%c…is a big problem.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 07:16:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7669914#M28266</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2018-01-07T07:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit part of the dtext?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7671262#M28267</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the intent with the highlighted line below was to create a temporary copy of the DBText, you need to call Clone(), otherwise it's operating on the 'textOrig', which you probably don't want to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&amp;nbsp;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/845950"&gt;@tbrammer&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;First you need the DBText object itself. If you have the two points p1 and p2 of the enclosing rectangle you can use them to retrieve a selection set that contains the DBText. Next have to find the indices of the first and last character that is within the rectangle.&lt;/P&gt;&lt;P&gt;I would suggest to create a DBText object with the same properties as the selected one, and evaluate its extents with different TextString lengths:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Point3d p1, p2; // The selected Points. 
// p1 must be "minpoint" and p2 "maxpoint": (p1[k] &amp;lt; p2[k]) must hold for all k
DBText txtOrig = ...  // Your text object
&lt;FONT color="#FF0000"&gt;DBText txt = txtOrig; // temporary copy of the text object&lt;/FONT&gt;
Extents3d extPrev = new Extents3d();
int iFirst = -1, iLast = -1; // Index of first and last character within [p1 p2]
for (int n=1; n&amp;lt;=txtOrig.TextString.Length; ++n)
{
	// Analyze the extents of a DBText with the first n characters of the original text
	txt.TextString = txtOrig.TextString.Substring(0, n);
	Extents3d ext = txt.GeometricExtents;
	extPrev = ext;

	// Get the extents of the n-th character
	Extents3d ext_n = new Extents3d();
	if (n == 0)
		ext_n = ext;
	else
	{
		Point3d min = new Point3d(extPrev.MaxPoint.X, ext.MinPoint.Y, ext.MinPoint.Z);
		ext_n.Set(min, ext.MaxPoint);
	}

	// Does ext_n overlap with the selected rectangle?
	if (ext_n.MaxPoint.X &amp;gt; p1.X &amp;amp;&amp;amp; ext_n.MinPoint.Y &amp;lt; p2.X ) // within X-extents?
	{
		// n-th char is within the [p1 p2] rectangle
		if (iFirst &amp;lt; 0)
			iFirst = n;
		iLast = n;
	}&lt;BR /&gt;        // Now you can replace chars iFirst...iLast
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the code above doesn't consider multiline text and text rotation.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 08:02:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7671262#M28267</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2018-01-08T08:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit part of the dtext?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7671590#M28268</link>
      <description>&lt;P&gt;thanks&amp;nbsp;&lt;A id="link_9e3c337fad5109" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4476837" target="_self"&gt;&lt;SPAN class=""&gt;ActivistInvesto&lt;WBR /&gt;r&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I know the code has some little problem.&lt;/P&gt;
&lt;P&gt;The difficult is not this, but the '%%c,\uxxxxx' charactors, i don't know how to solve it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;could any body give me some code to do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 11:11:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7671590#M28268</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2018-01-08T11:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit part of the dtext?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7672664#M28269</link>
      <description>&lt;P&gt;If the string contains %%c or escaped unicode,&amp;nbsp;you can use the &lt;A href="https://docs.microsoft.com/en-us/dotnet/api/system.text.unicodeencoding?view=netframework-4.7.1" target="_blank"&gt;Unicode.Encoding&lt;/A&gt; class to deal with that, but I suppose you're going to have to deal with the AutoCAD-specific %% codes by parsing the string into tokens and treating each sequence as a single character.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1663708"&gt;@swaywood&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;thanks&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4476837" target="_self"&gt;&lt;SPAN&gt;ActivistInvestor&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I know the code has some little problem.&lt;/P&gt;&lt;P&gt;The difficult is not this, but the '%%c,\uxxxxx' charactors, i don't know how to solve it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could any body give me some code to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 17:38:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7672664#M28269</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2018-01-08T17:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit part of the dtext?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7674015#M28270</link>
      <description>&lt;P&gt;parse the %%c int tokens, but what is the token, I found different charactor has different width.&lt;/P&gt;
&lt;P&gt;when i change the %%c into Φ the width changed too.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Work-220.png" style="width: 229px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/447172i7FCA9B6763CC42C3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Work-220.png" alt="Work-220.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Work-219.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/447173i6B63B5DD4E468293/image-size/large?v=v2&amp;amp;px=999" role="button" title="Work-219.png" alt="Work-219.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Work-218.png" style="width: 230px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/447174i364FA865530F47EF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Work-218.png" alt="Work-218.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Work-217.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/447175i3F9C9C1F0BBD1E14/image-size/large?v=v2&amp;amp;px=999" role="button" title="Work-217.png" alt="Work-217.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 05:22:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7674015#M28270</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2018-01-09T05:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit part of the dtext?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7674401#M28271</link>
      <description>&lt;P&gt;See &lt;A title="Text Symbols and Special Characters Reference" href="https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-Core/files/GUID-518E1A9D-398C-4A8A-AC32-2D85590CDBE1-htm.html" target="_blank"&gt;here&lt;/A&gt; for a list of special characters.&lt;/P&gt;
&lt;P&gt;Your screenshot shows two different characters: The diameter sign ∅ has the Unicode charcode U+2205 and Φ (greek Phi) U+03A6.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 08:40:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7674401#M28271</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2018-01-09T08:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit part of the dtext?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7681143#M28272</link>
      <description>&lt;P&gt;anyone done this before?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 06:08:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7681143#M28272</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2018-01-11T06:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit part of the dtext?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7785603#M28273</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4476837"&gt;@ActivistInvestor&lt;/a&gt;, &amp;nbsp;parsing the string into tokens is better way.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2018 10:50:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-edit-part-of-the-dtext/m-p/7785603#M28273</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2018-02-17T10:50:30Z</dc:date>
    </item>
  </channel>
</rss>

