<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>[Microstation Connect] How to create a GroupedHole Element with a AreaPattern</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/212669/microstation-connect-how-to-create-a-groupedhole-element-with-a-areapattern</link><description>Good morning, I have a problem with creating PatternArea on an object of type GroupedHoleElement, I would like to create a groupedHole like this: 
 
 the Microstation version is the following: Microstation CONNECT Edition Update 12 - Version 10.12.00</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: [Microstation Connect] How to create a GroupedHole Element with a AreaPattern</title><link>https://communities.bentley.com/thread/645144?ContentTypeID=1</link><pubDate>Fri, 16 Apr 2021 13:16:46 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:4b0c0d53-746b-441d-8eb8-af53daf00b27</guid><dc:creator>salvatore montella</dc:creator><description>&lt;pre class="tw-data-text tw-text-large XcVN5d tw-ta" id="tw-target-text" dir="ltr"&gt;&lt;span class="Y2IQFc" lang="en"&gt;Hi Jan,
thanks for the help, your example works perfectly

Thanks so much

Salvio&lt;/span&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Microstation Connect] How to create a GroupedHole Element with a AreaPattern</title><link>https://communities.bentley.com/thread/645121?ContentTypeID=1</link><pubDate>Fri, 16 Apr 2021 11:12:35 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:3dfb0d57-440d-467d-8d71-8fe5a7c1dc7f</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi Salvatore,&lt;/p&gt;
[quote userid="1009364" url="~/products/programming/microstation_programming/f/microstation-programming---forum/212669/microstation-connect-how-to-create-a-groupedhole-element-with-a-areapattern/645114"]about the image is just an example from the intended output.[/quote]
&lt;p&gt;Unfortunately it&amp;#39;s confusing a bit, because you mentioned cell (patterning), but demonstrate it using hatched (filled by lines) element.&lt;/p&gt;
[quote userid="1009364" url="~/products/programming/microstation_programming/f/microstation-programming---forum/212669/microstation-connect-how-to-create-a-groupedhole-element-with-a-areapattern/645114"]What is not clear to me is how to correctly set the parameters of the patternParams and dwgHatchDefLine objects[/quote]
&lt;p&gt;When you do not want to hatch, why you care how to se hatch def lines? Especially when, by its name, this parameter seems to be valid for DWG data only.&lt;/p&gt;
[quote userid="1009364" url="~/products/programming/microstation_programming/f/microstation-programming---forum/212669/microstation-connect-how-to-create-a-groupedhole-element-with-a-areapattern"]The code is executed without errors, only that in the output the selected element has no pattern[/quote]
&lt;p&gt;It&amp;#39;s expected behavior, because you do not update the element in DGN model.&lt;/p&gt;
[quote userid="1009364" url="~/products/programming/microstation_programming/f/microstation-programming---forum/212669/microstation-connect-how-to-create-a-groupedhole-element-with-a-areapattern/645114"]What I would like to achieve is to add a pattern by repeatedly placing a cell.[/quote]
&lt;p&gt;It&amp;#39;s not very complicated, using a combination of C++ documentation and some thinking how NET API is implemented (even though the code is a bit dirty):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;// For a simplicity and testing purpose, element obtained using its ID
long elementId = 827;
using (Element element = Session.Instance.GetActiveDgnModel().FindElementById(new ElementId(ref elementId)))
{
    if (element is GroupedHoleElement gh)
    {
        using (AreaFillPropertiesEdit areFillProperties = gh.AsAreaFillPropertiesEdit())
        {
            Session.Instance.EnqueueKeyin(&amp;quot;rc=areapat.cel&amp;quot;);

            PatternParams pp = new PatternParams
            {
                CellName = &amp;quot;BATEN&amp;quot;,
                Scale = 0.1
            };

            bool addWasSuccessful = areFillProperties.AddPattern(pp, null, 0);

            if (addWasSuccessful)
            {
                areFillProperties.ReplaceInModel(gh);
            }
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Microstation Connect] How to create a GroupedHole Element with a AreaPattern</title><link>https://communities.bentley.com/thread/645114?ContentTypeID=1</link><pubDate>Fri, 16 Apr 2021 10:38:44 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:8816a295-eddf-4e15-ae1b-5f5548b6f416</guid><dc:creator>salvatore montella</dc:creator><description>&lt;p&gt;Hi Jan,&lt;br /&gt;yes of course there is a cell library attached,&lt;br /&gt;about the image is just an example from the intended output.&lt;/p&gt;
&lt;p&gt;What I would like to achieve is to add a pattern by repeatedly placing a cell.&lt;br /&gt;Indeed in istruction&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;patternParams.CellName = &amp;quot;A0A&amp;quot;;&lt;br /&gt;I indicate the name of the model present in a cell library attached to the work design&lt;/p&gt;
&lt;p&gt;What is not clear to me is how to correctly set the parameters of the patternParams and dwgHatchDefLine objects&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Salvio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Microstation Connect] How to create a GroupedHole Element with a AreaPattern</title><link>https://communities.bentley.com/thread/645109?ContentTypeID=1</link><pubDate>Fri, 16 Apr 2021 10:33:42 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:f2cdf07b-0629-4842-979a-df1d96bb24db</guid><dc:creator>Jan Šlegr</dc:creator><description>[quote userid="1009364" url="~/products/programming/microstation_programming/f/microstation-programming---forum/212669/microstation-connect-how-to-create-a-groupedhole-element-with-a-areapattern"]patternParams.CellName = &amp;quot;A0A&amp;quot;; &amp;lt;- This field must contain the name of a model from the tmplate.cel library linked to the working file[/quote]
&lt;p&gt;I am not sure what does it mean &amp;quot;linked to working file&amp;quot;.&lt;/p&gt;
&lt;p&gt;When you want to use a cell for patterning, is the cell library attached?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Microstation Connect] How to create a GroupedHole Element with a AreaPattern</title><link>https://communities.bentley.com/thread/645101?ContentTypeID=1</link><pubDate>Fri, 16 Apr 2021 10:24:20 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:b63ea6d2-37c4-46d0-b4ba-2d75dcfc5e26</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;From the picture and the code, it&amp;#39;s not clear whether you want to add pattern (to place a cell repeatedly) or to hatch / crosshatch the grouped hole element.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>