<?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: Design Option Sorting Revit 2021 in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10216023#M27187</link>
    <description>&lt;P&gt;Well to be honest as a Revit user I kind of assume an alphabetical order was the right way to go generally. On the other hand sometimes you find things listed by level elevation e.g. levels. I think the idea being that if you are on Level 1m then Slab Level 1m will be nearby and not after Level 100m. That makes sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if things like this is what they mean because they haven't clarified it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Apr 2021 16:19:47 GMT</pubDate>
    <dc:creator>RPTHOMAS108</dc:creator>
    <dc:date>2021-04-06T16:19:47Z</dc:date>
    <item>
      <title>Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10187337#M27175</link>
      <description>&lt;P&gt;Can someone please share with me how the Design Options are sorted in Revit 2021.&amp;nbsp; I'm trying to create an IComparer implementation that will match it.&amp;nbsp; My attempts have centered around string.Compare() with various flags and options using the docs for &lt;A href="https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringex" target="_blank" rel="noopener"&gt;CompareStringEx&lt;/A&gt; as a guide.&amp;nbsp; But so far, no luck.&amp;nbsp; Here is an example:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;    public class DesignOptionComparer : IComparer&amp;lt;DesignOption&amp;gt;
    {
        public int Compare(DesignOption x, DesignOption y)
        {
            var result = string.Compare(x.Name, y.Name, CultureInfo.CurrentCulture, CompareOptions.IgnoreSymbols);
            return result;
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given two Design Options in the same Option Set, the Revit UI sorts them this way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;OPT. COVERED PORCH W/ EXT. RETREAT A/B&lt;/LI&gt;&lt;LI&gt;OPT. COVERED PORCH - A/B&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Whereas all my Comparers to date return this order&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;OPT. COVERED PORCH - A/B&lt;/LI&gt;&lt;LI&gt;OPT. COVERED PORCH W/ EXT. RETREAT A/B&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 19:22:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10187337#M27175</guid>
      <dc:creator>BobbyC.Jones</dc:creator>
      <dc:date>2021-03-25T19:22:41Z</dc:date>
    </item>
    <item>
      <title>Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10188306#M27176</link>
      <description>&lt;P&gt;I have not analysed the Revit sorting in depth.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From what you say, though, it sounds as if you will have to implement some custom sort order to achieve it, e.g., explicitly sort the hyphen character '-' before the alphabetical ones.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 04:55:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10188306#M27176</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-03-26T04:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10195898#M27177</link>
      <description>&lt;P&gt;Thanks Jeremy.&amp;nbsp; I can certainly implement custom sorting for the hyphen.&amp;nbsp; I would love to know if other characters need special handling as well.&amp;nbsp; There are hints in the Microsoft docs that the apostrophe could be another to look for.&amp;nbsp; Alphanumeric sorting turns out to be a much more complicated topic than I ever imagined.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 13:42:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10195898#M27177</guid>
      <dc:creator>BobbyC.Jones</dc:creator>
      <dc:date>2021-03-29T13:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10196081#M27178</link>
      <description>&lt;P&gt;If you remove all non alphanumerical characters from the strings before you sort them then such characters are of no consequence unless you have two strings distinguished only by those characters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similar to when using String.ToLower to ignore case in comparisons. That is probably the behaviour you actually want since hyphen is always going to mess up the order. It isn't so much a case of which punctuation comes before which since nobody could really tell you if . should be before - or _ (those are probably sorted by character code).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are working with ASCII characters only then you can exclude by code:&lt;/P&gt;&lt;P&gt;ASCII&lt;/P&gt;&lt;P&gt;0-9 = 48-57&amp;nbsp;&lt;/P&gt;&lt;P&gt;A-Z = 65-90&lt;/P&gt;&lt;P&gt;_ = 95&lt;/P&gt;&lt;P&gt;a-z = 97-122&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Unicode you probably have to use Char.IsNumber &amp;amp; Char.IsLetter etc. then probably culture comes into play in terms of how people expect things in their culture to be sorted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 14:58:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10196081#M27178</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-03-29T14:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10196164#M27179</link>
      <description>&lt;P&gt;That's an interesting thought.&amp;nbsp; I'll test to see if that matches how the Revit UI sorts them.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 15:00:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10196164#M27179</guid>
      <dc:creator>BobbyC.Jones</dc:creator>
      <dc:date>2021-03-29T15:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10196199#M27180</link>
      <description>&lt;P&gt;I don't understand how Revit is sorting those:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OPT. COVERED PORCH W/ EXT. RETREAT A/B&lt;BR /&gt;OPT. COVERED PORCH - A/B&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the above counting from left to right (after removing -) you would still expect A/B... to come before W/EXT... probably the extra space after the hyphen is dictating order. The way your comparer has it makes more sense to me than the Revit version (as a human being I expect 'A' before 'W').&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 15:12:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10196199#M27180</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-03-29T15:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10196256#M27181</link>
      <description>&lt;P&gt;Maybe it would help to do the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Ensure all your names consist purely of ASCII characters and nothing else&lt;/LI&gt;
&lt;LI&gt;Programmatically create 128 elements named with a single character from ASCII 0 to 127&lt;/LI&gt;
&lt;LI&gt;Observe the sorting order created by Revit&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That would at least provide a reliable starting point...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 15:28:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10196256#M27181</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-03-29T15:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10196844#M27182</link>
      <description>&lt;P&gt;In the NamingUtils , I find the method &amp;nbsp;&lt;SPAN&gt;CompareNames&lt;/SPAN&gt;(),&amp;nbsp;&lt;/P&gt;&lt;DIV class="section"&gt;Return ValueAn integer indicating the result of the lexical comparison between the two names. Less than zero if nameA comes before nameB in the ordering, zero if nameA and nameB are equivalent, and greater than zero if nameA is comes after nameB in the ordering.&lt;/DIV&gt;&lt;P&gt;Remarks&lt;/P&gt;&lt;DIV class="section"&gt;This routine is similar to System.String.Compare(), but uses Revit rules for comparison. This involves breaking the names into alphabetic and numeric tokens and comparing tokens individually. Neither comparand is allowed to be&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="nu"&gt;a null reference (&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="keyword"&gt;Nothing&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;in Visual Basic)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;.&lt;/DIV&gt;</description>
      <pubDate>Mon, 29 Mar 2021 18:38:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10196844#M27182</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2021-03-29T18:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10197229#M27183</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2083518"&gt;@FAIR59&lt;/a&gt;&amp;nbsp;You are my hero, again!&amp;nbsp; This works perfectly.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 20:56:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10197229#M27183</guid>
      <dc:creator>BobbyC.Jones</dc:creator>
      <dc:date>2021-03-29T20:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10197260#M27184</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1035859"&gt;@RPTHOMAS108&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I don't understand how Revit is sorting those:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OPT. COVERED PORCH W/ EXT. RETREAT A/B&lt;BR /&gt;OPT. COVERED PORCH - A/B&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the above counting from left to right (after removing -) you would still expect A/B... to come before W/EXT... probably the extra space after the hyphen is dictating order. The way your comparer has it makes more sense to me than the Revit version (as a human being I expect 'A' before 'W').&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I stopped short of extensive sort testing, thanks to&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2083518"&gt;@FAIR59&lt;/a&gt;&amp;nbsp;, but I did find that this character isn't a hyphen, it is an 'en dash'.&amp;nbsp; I believe a true hyphen sorts prior to the W.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 21:08:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10197260#M27184</guid>
      <dc:creator>BobbyC.Jones</dc:creator>
      <dc:date>2021-03-29T21:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10197357#M27185</link>
      <description>&lt;P&gt;Yes I don't know enough about what they mean in terms of 'Revit rules for comparison' what are those exactly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it doing it similar to current project browser settings e.g.:&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;&lt;A href="https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/Revit-Customize/files/GUID-20919325-BC6E-48C2-B756-43B424B91B1B-htm.html" target="_blank" rel="noopener"&gt;Browser Organization Properties Dialog: Grouping and Sorting Tab | Revit Products | Autodesk Knowledge Network&lt;/A&gt;&lt;/STRIKE&gt;&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;&lt;EM&gt;"Using:&lt;/EM&gt;&lt;/STRIKE&gt;&lt;BR /&gt;&lt;STRIKE&gt;&lt;EM&gt;Indicate whether the items are to be grouped based on all characters of the parameter values, or one or more leading characters.&lt;/EM&gt;&lt;/STRIKE&gt;&lt;BR /&gt;&lt;STRIKE&gt;&lt;EM&gt;For example, suppose sheet names use prefixes of AB-, AC-, BD-, BE-, and so. To group together all sheets based on the first letter of their name (A, B, and so on), for Using, select Leading characters, and set it equal to 1."&lt;/EM&gt;&lt;/STRIKE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No this if for grouping which makes sense actually but still the term 'Revit rules' (when those rule are not set out) troubles me. What was wrong with string.compare is what I wonder? Perhaps it is the case sensitivity aspect but I've not checked that.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 22:10:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10197357#M27185</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-03-29T22:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10215627#M27186</link>
      <description>Honestly, I prefer the API from Autodesk solution over finding the proper string.compare settings. That way they can black box the rules and we just don't care what they are.</description>
      <pubDate>Tue, 06 Apr 2021 14:34:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10215627#M27186</guid>
      <dc:creator>BobbyC.Jones</dc:creator>
      <dc:date>2021-04-06T14:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10216023#M27187</link>
      <description>&lt;P&gt;Well to be honest as a Revit user I kind of assume an alphabetical order was the right way to go generally. On the other hand sometimes you find things listed by level elevation e.g. levels. I think the idea being that if you are on Level 1m then Slab Level 1m will be nearby and not after Level 100m. That makes sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if things like this is what they mean because they haven't clarified it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 16:19:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10216023#M27187</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-04-06T16:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: Design Option Sorting Revit 2021</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10216121#M27188</link>
      <description>Oh, couldn't agree more that order is very important to the user. The reason I posted this in the first place was that Revit 2021 sorting broke some features of our custom Design Option UI, which allows custom sorting.</description>
      <pubDate>Tue, 06 Apr 2021 16:50:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/design-option-sorting-revit-2021/m-p/10216121#M27188</guid>
      <dc:creator>BobbyC.Jones</dc:creator>
      <dc:date>2021-04-06T16:50:53Z</dc:date>
    </item>
  </channel>
</rss>

