Select to view content in your preferred language

How do you create a new feature with a default radius?

1991
2
02-24-2012 04:58 AM
GregRieck
Frequent Contributor
Hello,

When a new feature is created using the Create Feature template for my Polygon Feature Class and using the "Circle" tool how can I assign a default radius to the circle during creation?

I've trapped for the OnCreate using an extension.
I've trapped for the use of the circle tool.

Now how do I change the radius of the feature during the creation process?

    public void OnCreate(IObject obj)

.....
          ICommandItem ci = afoGlobals.afoApp.CurrentTool;
          if (ci != null)
          {
            switch (ci.Caption.ToLower())
            {
              case "circle":
                ISegmentCollection sc = new ESRI.ArcGIS.Geometry.Polygon as ISegmentCollection;
                IEditSketch es = myEditor3 as IEditSketch;
                sc.SetCircle(es.LastPoint, 25);
                IFeature f = obj as IFeature;
                f.Shape = sc;  ?????????
                break;
            }
          }


G
0 Kudos
2 Replies
by Anonymous User
Not applicable

Now how do I change the radius of the feature during the creation process?


When OnCreate fires the feature is already there so the only thing you could do is recreate the geometry of the feature (IObject) to a fixed radius.

You cant set the radius of the core circle construction tool through code.

I think you would be better off here making a custom circle construction tool who's radius would persist during the edit session.
0 Kudos
GregRieck
Frequent Contributor
Hi Sean,

Thank you for taking the time to respond to my post.

It sure would be nice if there were an easy way to assign a default radius to a template that uses the circle construction tool. I did a quick search and this seems to be a common request. Here is one thread. You mention a "custom circle construction tool" as a possible solution. However, if I'm not mistaken that involves creating a button to activate it. To me that defeats the purpose of Create Feature Templates. I'd much rather use the template to create the initial feature and then change it's radius through code. This is something I had done previously in 9. It also dealt with the feature after it was created. In fact it used the ISegmentCollection and is the source of my start of completing this task at 10.

The clients requested default radius is stored in our database and queried when this particular feature is created.

The issue I'm having at 10 is I'm no longer able to perform this cast:
SegmentCollection.SetCircle EditSketch.LastPoint, Radius
Feature.Shape = SegmentCollection

I also have a 9 routine that allows the user to select "N" of this particular feature and change the default radius using an input box.

Have you tried changing the default radius on a feature? I find it difficult to get the radius dialog to even appear. Personally, the idea of the feature templates is to allow the user to perform quick edit tasks. Not being able to do something as simple as assigning a default radius is certainly preventing that from happening.

Greg
0 Kudos