<?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: ISketchTool: setting constraints doesn't work in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/isketchtool-setting-constraints-doesn-t-work/m-p/323743#M8433</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sean... thank you so much for the really quick reply!&amp;nbsp; I implemented your code and it still isn't doing what I expect.&amp;nbsp; I must be missing some key concept here.&amp;nbsp; Once a user starts to draw a sketch, I want the sketch to be limited to 45 degrees, as if the user had just right-clicked and specified "45" for the Direction.&amp;nbsp; I wonder if I need to create my own ShapeConstructor, or is it possible to set the Constraint and AngleConstraint of the existing Polygon ShapeConstructor.&amp;nbsp; Again, no errors and code steps through just fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Apr 2017 22:21:39 GMT</pubDate>
    <dc:creator>ScottEckersall</dc:creator>
    <dc:date>2017-04-11T22:21:39Z</dc:date>
    <item>
      <title>ISketchTool: setting constraints doesn't work</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/isketchtool-setting-constraints-doesn-t-work/m-p/323741#M8431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created an Editor Extension and am listening to the OnSketchModified event. &amp;nbsp;Inside that, I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;ISketchTool sketchTool = ArcMap.Editor.Parent.CurrentTool.Command as ISketchTool;&lt;BR /&gt; if (sketchTool == null)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; double angle = 0.0; &amp;nbsp;//radians&lt;BR /&gt; sketchTool.Constraint = esriSketchConstraint.esriConstraintAngle;&lt;BR /&gt; sketchTool.AngleConstraint = angle;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;When I create a Polygon feature, this all runs without error but the sketch is still unconstrained.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Apr 2017 20:12:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/isketchtool-setting-constraints-doesn-t-work/m-p/323741#M8431</guid>
      <dc:creator>ScottEckersall</dc:creator>
      <dc:date>2017-04-07T20:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: ISketchTool: setting constraints doesn't work</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/isketchtool-setting-constraints-doesn-t-work/m-p/323742#M8432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In ArcMap 10+ you'll need to set the constraint on the current shape constructor.&lt;/P&gt;&lt;DIV&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;//get the editor&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; editorUid &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;UID&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; editorUid&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Value &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"esriEditor.Editor"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; editor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ArcMap&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Application&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;FindExtensionByCLSID&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;editorUid&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; IEditor&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;//get the edit sketch and set current constructor constraint&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; edSketch &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; editor &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; IEditSketch3&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; constructor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; edSketch&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ShapeConstructor&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; constructor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Constraint &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; esriSketchConstraint&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;esriConstraintAngle&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; constructor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AngleConstraint &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;45&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; Math&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;PI &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;180&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;The constraint is only applied to the current segment.&lt;/P&gt;&lt;P&gt;You can create you own &lt;A href="http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#8c2e0bfc-1b18-4f0a-a5ba-7bc63be4cde9.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;shape constructors&lt;/A&gt; with custom constraints if required.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:22:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/isketchtool-setting-constraints-doesn-t-work/m-p/323742#M8432</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T15:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: ISketchTool: setting constraints doesn't work</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/isketchtool-setting-constraints-doesn-t-work/m-p/323743#M8433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sean... thank you so much for the really quick reply!&amp;nbsp; I implemented your code and it still isn't doing what I expect.&amp;nbsp; I must be missing some key concept here.&amp;nbsp; Once a user starts to draw a sketch, I want the sketch to be limited to 45 degrees, as if the user had just right-clicked and specified "45" for the Direction.&amp;nbsp; I wonder if I need to create my own ShapeConstructor, or is it possible to set the Constraint and AngleConstraint of the existing Polygon ShapeConstructor.&amp;nbsp; Again, no errors and code steps through just fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Apr 2017 22:21:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/isketchtool-setting-constraints-doesn-t-work/m-p/323743#M8433</guid>
      <dc:creator>ScottEckersall</dc:creator>
      <dc:date>2017-04-11T22:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: ISketchTool: setting constraints doesn't work</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/isketchtool-setting-constraints-doesn-t-work/m-p/323744#M8434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scott,&lt;/P&gt;&lt;P&gt;The example posted above was driven from a simple button on a toolbar. I would expect it to work through an extension and the sketch modified event, but I haven't tried that yet. A shape constructor is a more generic approach and avoids the overhead of an extension and filtering out the event for your polygon layer but the onus will be on the user to use it.&lt;/P&gt;&lt;P&gt;I'll try the extension approach today to see if there's any problems and probably bang out a 45° shape constructor and post here as an example. Its not exactly &lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Sample_Angle_Angle_shape_constructor/0001000002m4000000/"&gt;straight forward&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2017 17:35:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/isketchtool-setting-constraints-doesn-t-work/m-p/323744#M8434</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2017-04-12T17:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: ISketchTool: setting constraints doesn't work</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/isketchtool-setting-constraints-doesn-t-work/m-p/323745#M8435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried the extension approach and got the same result as you. Something in the display pipeline is eating the constraint. You can solve this by setting the constraint in IEditEvents3.BeforeDrawSketch instead of sketchmodified.&lt;/P&gt;&lt;P&gt;Ive also posted a &lt;A href="https://github.com/SoJourned/ArcObjects"&gt;right angle shape constructor &lt;/A&gt;as an example. This is modelled after the right angle shape constructor on the feature construction toolbar, which constrains the sketch 90 degrees from the previous segment. If you just want 45 degrees regardless of the previous segments you can just set that constraint there also.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Apr 2017 18:45:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/isketchtool-setting-constraints-doesn-t-work/m-p/323745#M8435</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2017-04-13T18:45:52Z</dc:date>
    </item>
  </channel>
</rss>

