Select to view content in your preferred language

How do you actually create and modify dimension features using the SDK?

338
5
Jump to solution
11-08-2024 12:41 PM
BillyBuerger
Frequent Contributor

I'm trying to move some dimension features through a custom tool.  I reviewed the ProConcepts Editing Dimensions document which seems to suggest that you can pass a multipoint to the EditOperation to define the new geometry locations.  But nothing is happening.  The dimension doesn't move or change in any way.

As a test, I started with a new map tool and used the exact example code from the documentation and I get a new dimension feature in the table but nothing displays on my map.  I noticed the attribute for dimension length is 0.  If I start editing vertices on another  existing dimension and then switch selection to this new dimension, it shows on my map.  But if I don't actually make any changes, it disappears when I unselect.  If I do make a modification to the geometry and apply, the dimension then is visible and the Dimension Length and other attributes populate.

So even the documented example doesn't appear to work as is.  It seems that something else is needed for the dimension feature to be complete like using the default edit tools.  How exactly are you supposed to work with dimensions as part of an edit operation in a custom tool?  Nothing seems to be working and I don't see any other examples to try.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
NarelleChedzey
Esri Contributor

Hi, 

So I've dug a bit deeper over the last day and know a bit more about what is going on. And why the EditOperation.Create is not working correctly for dimension features.  As the documentation states, a dimension feature consists of 4 points (the begin, end points, the dimension line point and the text point).  These points are stored as x,y fields in the feature class.  The polygon shape of the dimension is the bounding rectangle of these points and it should be calculated when the feature is created or modified.  In the case of the creation; we supply the points as a mutlipoint geometry, however the calculation to generate the bounding polygon from this point information and the other attributes is not being performed and the shape value of the created feature is null  (which is why it is not displayed).  As you've seen if you make any modifications to the point coordinate attributes or other attributes, the dimension becomes visible - because it's polygon shape has been generated.

So basically we need to look into a way to force this shape generation to occur on a creation as the software is not working as it should. 

 

Having said all of that, lets deal with the original question you had first - how to move a dimension feature. 

Assuming we're dealing with a well-defined dimension feature  (ie one that is displaying correctly); you should be able to use EditOperation.Move function.   For example

// assuming on the MCT

// get a dim layer
DimensionLayer dimLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<DimensionLayer>().FirstOrDefault();

var selection = dimLayer.GetSelection();
var oids = selection.GetObjectIDs();
var oid = oids.FirstOrDefault();

var op = new EditOperation();
op.Name = "Move dimension";
op.Move(dimLayer, oid, 10, 0);    // move it in the x direction only
var success = op.Execute();

 

Alternatively you can modify the BeginX, BeginY, EndX, EndY, DimX, DimY and TextX and TextY fields individually if you'd rather using the EditOperation.Modify method and an Inspector class.  Here's an example snippet of this

// assuming on the MCT

// get a dim layer
DimensionLayer dimLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<DimensionLayer>().FirstOrDefault();

var selection = dimLayer.GetSelection();
var oids = selection.GetObjectIDs();
var oid = oids.FirstOrDefault();

var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();
insp.Load(dimLayer, oid);

// get all the coordinates
Double.TryParse(insp["BeginX"].ToString(), out double BeginX);
Double.TryParse(insp["BeginY"].ToString(), out double BeginY);
Double.TryParse(insp["EndX"].ToString(), out double EndX);
Double.TryParse(insp["EndY"].ToString(), out double EndY);
Double.TryParse(insp["DimX"].ToString(), out double DimX);
Double.TryParse(insp["DimY"].ToString(), out double DimY);
Double.TryParse(insp["TextX"].ToString(), out double TextX);
Double.TryParse(insp["TextY"].ToString(), out double TextY);

// modify the x positions
BeginX += 10;
EndX += 10;
DimX += 10;

// assign the new values to the fields
insp["BeginX"] = BeginX;
insp["EndX"] = EndX;
insp["DimX"] = DimX;

// do the edit
var op = new EditOperation();
op.Name = "Modify dimension";
op.Modify(insp);
var success = op.Execute();

 

You can use any of the other EditOperation.Modify overloads as appropriate.  The key is that you need to modify the x,y fields of the points and not the shape field itself.   Despite supplying a mtulipoint to the EditOperation.Create to generate a dimension feature we cannot use a multipoint within an EditOperation.Modify to modify the geometry. 

I've verified that both of these scenarios work correctly at 3.4.  Can you try and see if they work for you at 2.9. 

 

As for the creation, you were on the correct path with regards to the DimensionFeature. and the SetDimensionShape method.  This is the call we have to  make to force the shape generation to occur as the workaround for this bug.  The way to use this method within an EditOperaiton is to hook into the RowCreated event.   Here's a button that is based on your code snippet with the row event and the SetDimensionShape method. 

protected override void OnClick()
{
  var CurrentMap = MapView.Active.Map;
  DimensionLayer dimLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<DimensionLayer>().FirstOrDefault();

  QueuedTask.Run(() =>
  {
    var sr = dimLayer.GetSpatialReference();

    // use layer selection to get an oid
    var selection = dimLayer.GetSelection();
    var oids = selection.GetObjectIDs();
    var oid = oids.FirstOrDefault();

    // load inspector with the feature
    var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();
    insp.Load(dimLayer, oid);
 
    // get the x,y coords of the the dimension points
    Double.TryParse(insp["BeginX"].ToString(), out double BeginX);
    Double.TryParse(insp["BeginY"].ToString(), out double BeginY);
    Double.TryParse(insp["EndX"].ToString(), out double EndX);
    Double.TryParse(insp["EndY"].ToString(), out double EndY);
    Double.TryParse(insp["DimX"].ToString(), out double DimX);
    Double.TryParse(insp["DimY"].ToString(), out double DimY);
    Double.TryParse(insp["TextX"].ToString(), out double TextX);
    Double.TryParse(insp["TextY"].ToString(), out double TextY);

    // create a new multipoint for updated dimension points
    var DimPoints = new List<MapPoint>()
      { MapPointBuilderEx.CreateMapPoint(BeginX + 10, BeginY, 0, sr),
        MapPointBuilderEx.CreateMapPoint(EndX + 10, EndY, 0, sr),
        MapPointBuilderEx.CreateMapPoint(DimX + 10, DimY, 0, sr) };
    var UpdatedGeom = MultipointBuilderEx.CreateMultipoint(DimPoints, AttributeFlags.AllAttributes);
    // attributes
    var Attributes = new Dictionary<string, object>() { { "StyleID", 0 },
                                    { "DimType", 0 },
                                    { "BeginX", DimPoints[0].X }, { "BeginY", DimPoints[0].Y },
                                    { "EndX", DimPoints[1].X }, { "EndY", DimPoints[1].Y },
                                    { "DimX", DimPoints[2].X }, { "DimY", DimPoints[2].Y } };

    // subscribe to the RowCreatedEvent
    //  do this as close as possible to the EditOperation to 
    //   minimize the time that we are monitoring the creates
    var table = dimLayer.GetTable();
    SubscriptionToken token = ArcGIS.Desktop.Editing.Events.RowCreatedEvent.Subscribe(OnRowCreated, table);

    // wrap in a try/catch/finally to ensure that we can unsubscribe 
    // if there is a failure
    bool success = false;
    var Op = new EditOperation(); Op.Name = "Test";
    try
    {
      Op.Create(dimLayer, UpdatedGeom, Attributes);
      success = Op.Execute();
    }
    catch (Exception ex)
    {
    }
    finally
    {
      // unsubscribe
      if (token != null)
        ArcGIS.Desktop.Editing.Events.RowCreatedEvent.Unsubscribe(token);
    }

    if (!success)
    {
      throw new Exception(Op.ErrorMessage);
    }
  });
}

private void OnRowCreated(ArcGIS.Desktop.Editing.Events.RowChangedEventArgs args)
{
  var row = args.Row;

  if (row is ArcGIS.Core.Data.Mapping.DimensionFeature df)
  {
    try
    {
      // force the dimension polygon shape generation
      //  a simple get and then set will accomplish this
      var shape = df.GetDimensionShape();
      df.SetDimensionShape(shape);
    }
    catch (Exception ex)
    {
    }
  }
}

 

Again, this works on 3.4; can you verify that it will work for you on 2.9.   

 

I've entered an issue into our backlog to fix the dimension creation.  In the meantime, I'll get this workaround documented on the Editing Dimensions concept page.  Thanks for drawing our attention to this; unfortunately we don't have too many dimension feature SDK users. 

Let me know if you have any additional questions or run into any problems with the snippets I've posted.

Narelle

 

View solution in original post

0 Kudos
5 Replies
NarelleChedzey
Esri Contributor

Hi Billy, 

I am looking at this right now and can confirm that custom dimension construction tools aren't working in the current release.  I am trying to find you a work around.   In the mean time can you tell me what version of the software you are using. 

But from your first sentence it seems like you are also interested in how to move an existing dimension feature.  Are you using the EditOperation.Modify operation and modifing the individual x,y coordinates of the BeginX, BeginY, EndX, EndY, DimX, DimY and TextX and TextY fields.? 

Thanks  

Narelle

0 Kudos
BillyBuerger
Frequent Contributor

Thanks so much for the reply.  My primary development environment is on Pro 2.9 still.  Still need to support people who are using that.  But after running into this issue, I went and tested on 3.3 and got the same result. I noticed that 3.4 was available so upgraded to that and again, same result.

I'm primarily interested in moving existing dimensions.  I was assuming it would be similar to annotations where in the modify operation, I can pass the updated graphic shape and it applies it correctly to the annotation graphic as opposed to attempting to update the polygon feature shape.  So I was passing the same multipoint to the modify operation on a dimension that the document shows for creating a dimension.  But that doesn't work.  I'm only trying to figure out the issues with creating dimensions to see if that helps to understand how updating of dimensions would work.  I did also test using the SetGraphicShape method on the DimensionFeature and that does work to update the dimension location as expected.  But that requires doing a Store() on the feature which can only be done through an ApplyEdits on a geodatabase and not through the map edit operations.  Unless there's something that I'm missing there.

Following the documentation, when I'm attempting to create a dimension, I was only passing the geometry to the Create method of the EditOperation.  I was not setting the Begin/End X/Y attributes as I would assume those would get populated from the geometry and should not be directly modified.  I tried that and doing so populated those fields and gave the same result as using the template.  In that it creates a dimension that is not visible (shape length/area are 0) but I can edit the vertices which causes it to display.  Modifying the geometry and applying it then causes the dimension to show up with a valid shape length/area.

Here's my sample code where I take an existing Dimension (OID=1) and try to create a new dimension at X + 10...

private void DimensionEditOperation()
{
    var CurrentMap = MapView.Active.Map;
    var Layer = CurrentMap.FindLayers("Dimension").First() as DimensionLayer;
    
    using (var FeatCursor = Layer.GetTable().Search(new QueryFilter() { ObjectIDs = new List<long>() { 1 } }))
    {
        FeatCursor.MoveNext();
        var DimFeat = FeatCursor.Current as DimensionFeature;
        var DimOID = DimFeat.GetObjectID();
        var DimGeom = DimFeat.GetDimensionShape();
        var DimPoints = new List<MapPoint>()
        {
           MapPointBuilderEx.CreateMapPoint(DimGeom.BeginDimensionPoint.X + 10, DimGeom.BeginDimensionPoint.Y + 0, 0, DimGeom.BeginDimensionPoint.SpatialReference),
           MapPointBuilderEx.CreateMapPoint(DimGeom.EndDimensionPoint.X + 10, DimGeom.EndDimensionPoint.Y + 0, 0, DimGeom.EndDimensionPoint.SpatialReference),
           MapPointBuilderEx.CreateMapPoint(DimGeom.DimensionLinePoint.X + 10, DimGeom.DimensionLinePoint.Y + 0, 0, DimGeom.DimensionLinePoint.SpatialReference)
        };

        var UpdatedGeom = MultipointBuilderEx.CreateMultipoint(DimPoints, AttributeFlags.AllAttributes);
        var Attributes = new Dictionary<string, object>() 
        {
           { "StyleID", 0 },
           { "DimType", 0 },
           { "BeginX", DimPoints[0].X },
           { "BeginY", DimPoints[0].Y },
           { "EndX", DimPoints[1].X },
           { "EndY", DimPoints[1].Y },
           { "DimX", DimPoints[2].X },
           { "DimY", DimPoints[2].Y }
        };

        var Op = new EditOperation();
        Op.Name = "Test";
        Op.Create(Layer, UpdatedGeom, Attributes);

        if (!Op.Execute())
        {
           throw new Exception(Op.ErrorMessage);
        }
    }
}

 

0 Kudos
NarelleChedzey
Esri Contributor

Hi, 

So I've dug a bit deeper over the last day and know a bit more about what is going on. And why the EditOperation.Create is not working correctly for dimension features.  As the documentation states, a dimension feature consists of 4 points (the begin, end points, the dimension line point and the text point).  These points are stored as x,y fields in the feature class.  The polygon shape of the dimension is the bounding rectangle of these points and it should be calculated when the feature is created or modified.  In the case of the creation; we supply the points as a mutlipoint geometry, however the calculation to generate the bounding polygon from this point information and the other attributes is not being performed and the shape value of the created feature is null  (which is why it is not displayed).  As you've seen if you make any modifications to the point coordinate attributes or other attributes, the dimension becomes visible - because it's polygon shape has been generated.

So basically we need to look into a way to force this shape generation to occur on a creation as the software is not working as it should. 

 

Having said all of that, lets deal with the original question you had first - how to move a dimension feature. 

Assuming we're dealing with a well-defined dimension feature  (ie one that is displaying correctly); you should be able to use EditOperation.Move function.   For example

// assuming on the MCT

// get a dim layer
DimensionLayer dimLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<DimensionLayer>().FirstOrDefault();

var selection = dimLayer.GetSelection();
var oids = selection.GetObjectIDs();
var oid = oids.FirstOrDefault();

var op = new EditOperation();
op.Name = "Move dimension";
op.Move(dimLayer, oid, 10, 0);    // move it in the x direction only
var success = op.Execute();

 

Alternatively you can modify the BeginX, BeginY, EndX, EndY, DimX, DimY and TextX and TextY fields individually if you'd rather using the EditOperation.Modify method and an Inspector class.  Here's an example snippet of this

// assuming on the MCT

// get a dim layer
DimensionLayer dimLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<DimensionLayer>().FirstOrDefault();

var selection = dimLayer.GetSelection();
var oids = selection.GetObjectIDs();
var oid = oids.FirstOrDefault();

var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();
insp.Load(dimLayer, oid);

// get all the coordinates
Double.TryParse(insp["BeginX"].ToString(), out double BeginX);
Double.TryParse(insp["BeginY"].ToString(), out double BeginY);
Double.TryParse(insp["EndX"].ToString(), out double EndX);
Double.TryParse(insp["EndY"].ToString(), out double EndY);
Double.TryParse(insp["DimX"].ToString(), out double DimX);
Double.TryParse(insp["DimY"].ToString(), out double DimY);
Double.TryParse(insp["TextX"].ToString(), out double TextX);
Double.TryParse(insp["TextY"].ToString(), out double TextY);

// modify the x positions
BeginX += 10;
EndX += 10;
DimX += 10;

// assign the new values to the fields
insp["BeginX"] = BeginX;
insp["EndX"] = EndX;
insp["DimX"] = DimX;

// do the edit
var op = new EditOperation();
op.Name = "Modify dimension";
op.Modify(insp);
var success = op.Execute();

 

You can use any of the other EditOperation.Modify overloads as appropriate.  The key is that you need to modify the x,y fields of the points and not the shape field itself.   Despite supplying a mtulipoint to the EditOperation.Create to generate a dimension feature we cannot use a multipoint within an EditOperation.Modify to modify the geometry. 

I've verified that both of these scenarios work correctly at 3.4.  Can you try and see if they work for you at 2.9. 

 

As for the creation, you were on the correct path with regards to the DimensionFeature. and the SetDimensionShape method.  This is the call we have to  make to force the shape generation to occur as the workaround for this bug.  The way to use this method within an EditOperaiton is to hook into the RowCreated event.   Here's a button that is based on your code snippet with the row event and the SetDimensionShape method. 

protected override void OnClick()
{
  var CurrentMap = MapView.Active.Map;
  DimensionLayer dimLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<DimensionLayer>().FirstOrDefault();

  QueuedTask.Run(() =>
  {
    var sr = dimLayer.GetSpatialReference();

    // use layer selection to get an oid
    var selection = dimLayer.GetSelection();
    var oids = selection.GetObjectIDs();
    var oid = oids.FirstOrDefault();

    // load inspector with the feature
    var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();
    insp.Load(dimLayer, oid);
 
    // get the x,y coords of the the dimension points
    Double.TryParse(insp["BeginX"].ToString(), out double BeginX);
    Double.TryParse(insp["BeginY"].ToString(), out double BeginY);
    Double.TryParse(insp["EndX"].ToString(), out double EndX);
    Double.TryParse(insp["EndY"].ToString(), out double EndY);
    Double.TryParse(insp["DimX"].ToString(), out double DimX);
    Double.TryParse(insp["DimY"].ToString(), out double DimY);
    Double.TryParse(insp["TextX"].ToString(), out double TextX);
    Double.TryParse(insp["TextY"].ToString(), out double TextY);

    // create a new multipoint for updated dimension points
    var DimPoints = new List<MapPoint>()
      { MapPointBuilderEx.CreateMapPoint(BeginX + 10, BeginY, 0, sr),
        MapPointBuilderEx.CreateMapPoint(EndX + 10, EndY, 0, sr),
        MapPointBuilderEx.CreateMapPoint(DimX + 10, DimY, 0, sr) };
    var UpdatedGeom = MultipointBuilderEx.CreateMultipoint(DimPoints, AttributeFlags.AllAttributes);
    // attributes
    var Attributes = new Dictionary<string, object>() { { "StyleID", 0 },
                                    { "DimType", 0 },
                                    { "BeginX", DimPoints[0].X }, { "BeginY", DimPoints[0].Y },
                                    { "EndX", DimPoints[1].X }, { "EndY", DimPoints[1].Y },
                                    { "DimX", DimPoints[2].X }, { "DimY", DimPoints[2].Y } };

    // subscribe to the RowCreatedEvent
    //  do this as close as possible to the EditOperation to 
    //   minimize the time that we are monitoring the creates
    var table = dimLayer.GetTable();
    SubscriptionToken token = ArcGIS.Desktop.Editing.Events.RowCreatedEvent.Subscribe(OnRowCreated, table);

    // wrap in a try/catch/finally to ensure that we can unsubscribe 
    // if there is a failure
    bool success = false;
    var Op = new EditOperation(); Op.Name = "Test";
    try
    {
      Op.Create(dimLayer, UpdatedGeom, Attributes);
      success = Op.Execute();
    }
    catch (Exception ex)
    {
    }
    finally
    {
      // unsubscribe
      if (token != null)
        ArcGIS.Desktop.Editing.Events.RowCreatedEvent.Unsubscribe(token);
    }

    if (!success)
    {
      throw new Exception(Op.ErrorMessage);
    }
  });
}

private void OnRowCreated(ArcGIS.Desktop.Editing.Events.RowChangedEventArgs args)
{
  var row = args.Row;

  if (row is ArcGIS.Core.Data.Mapping.DimensionFeature df)
  {
    try
    {
      // force the dimension polygon shape generation
      //  a simple get and then set will accomplish this
      var shape = df.GetDimensionShape();
      df.SetDimensionShape(shape);
    }
    catch (Exception ex)
    {
    }
  }
}

 

Again, this works on 3.4; can you verify that it will work for you on 2.9.   

 

I've entered an issue into our backlog to fix the dimension creation.  In the meantime, I'll get this workaround documented on the Editing Dimensions concept page.  Thanks for drawing our attention to this; unfortunately we don't have too many dimension feature SDK users. 

Let me know if you have any additional questions or run into any problems with the snippets I've posted.

Narelle

 

0 Kudos
BillyBuerger
Frequent Contributor

Oh, thank you.  I think I found what I need.  On the modify side of it, I only need to update the attributes.  If I ignore the geometry but update the X/Y fields, I get the update of the existing dimension feature.  That's unexpected as with Annotations, you never update these fields and they get calculated from the annotation geometry.  Similar with ArcOjbects where Anno and Dims are updated by geometry and the fields are calculated from the geometry.  But, it works so that's good.  The edits I'm making to the dimension could mean moving one side but not the other of the dimension so a Move operation isn't possible.  So this simplified version is working for me in 3.4...

private void DimensionEditOperation()
{
    var CurrentMap = MapView.Active.Map;
    var Layer = CurrentMap.FindLayers("Dimension").First() as DimensionLayer;
    
    using (var FeatCursor = Layer.GetTable().Search(new QueryFilter() { ObjectIDs = new List<long>() { 1 } }))
    {
        FeatCursor.MoveNext();
        var DimFeat = FeatCursor.Current as DimensionFeature;
        var DimOID = DimFeat.GetObjectID();
        var DimGeom = DimFeat.GetDimensionShape();

        var Attributes = new Dictionary<string, object>()
        {
           { "BeginX", DimGeom.BeginDimensionPoint.X + 10 },
           { "BeginY", DimGeom.BeginDimensionPoint.Y },
           { "EndX", DimGeom.EndDimensionPoint.X + 10 },
           { "EndY", DimGeom.EndDimensionPoint.Y + 10 },
           { "DimX", DimGeom.DimensionLinePoint.X + 10 },
           { "DimY", DimGeom.DimensionLinePoint.Y }
        };

        var Op = new EditOperation();
        Op.Name = "Test";
        Op.Modify(Layer, DimOID, Attributes);

        if (!Op.Execute())
        {
           throw new Exception(Op.ErrorMessage);
        }
    }
}

 

I haven't tested this exact version in 2.9 but I updated my actual tool using this same logic and it gives me the expected result.  So this process seems to work in all versions of Pro.  The only issue I see with this is that I have to make a special case for dimensions that different from all other types of features where I update the geometry.  For dimensions, I have to update attributes to update the geometry.

On the creation side which I don't currently need, again, I was able to simplify the process by setting the attributes and setting a polygon geometry using the extent of the updated points.  Like this...

private void DimensionEditOperation()
{
    var CurrentMap = MapView.Active.Map;
    var Layer = CurrentMap.FindLayers("Dimension").First() as DimensionLayer;
    
    using (var FeatCursor = Layer.GetTable().Search(new QueryFilter() { ObjectIDs = new List<long>() { 1 } }))
    {
        FeatCursor.MoveNext();
        var DimFeat = FeatCursor.Current as DimensionFeature;
        var DimOID = DimFeat.GetObjectID();
        var DimGeom = DimFeat.GetDimensionShape();
        var BeginPoint = MapPointBuilderEx.CreateMapPoint(DimGeom.BeginDimensionPoint.X + 10, DimGeom.BeginDimensionPoint.Y + 0, 0, DimGeom.BeginDimensionPoint.SpatialReference);
        var EndPoint = MapPointBuilderEx.CreateMapPoint(DimGeom.EndDimensionPoint.X + 10, DimGeom.EndDimensionPoint.Y + 10, 0, DimGeom.EndDimensionPoint.SpatialReference);
        var DimPoint = MapPointBuilderEx.CreateMapPoint(DimGeom.DimensionLinePoint.X + 10, DimGeom.DimensionLinePoint.Y + 0, 0, DimGeom.DimensionLinePoint.SpatialReference);

        var Attributes = new Dictionary<string, object>()
        {
           { "StyleID", 0 },
           { "DimType", 0 },
           { "BeginX", BeginPoint.X + 10 },
           { "BeginY", BeginPoint.Y },
           { "EndX", EndPoint.X + 10 },
           { "EndY", EndPoint.Y + 10 },
           { "DimX", DimPoint.X + 10 },
           { "DimY", DimPoint.Y }
        };

        var UpdatedGeom = MultipointBuilderEx.CreateMultipoint(new List<MapPoint>() { BeginPoint, EndPoint, DimPoint }, AttributeFlags.AllAttributes);
        var UpdatedBounds = PolygonBuilderEx.CreatePolygon(UpdatedGeom.Extent);
        
        var Op = new EditOperation();
        Op.Name = "Test";
        Op.Create(Layer, UpdatedBounds, Attributes); ;

        if (!Op.Execute())
        {
           throw new Exception(Op.ErrorMessage);
        }
    }
}

 

This might not be the correct way to calculate the polygon geometry but it does seem to work.  I tried just cloning the shape from the existing dimension without using the updated points and it seems that the polygon doesn't align with the dimension so selecting doesn't work as expected.  So it should be updated from the points used for the dimension. But this seems to go along with the bug that this polygon should be calculated from the dimension points and not need to be specified in the creation of the dimension.

Thanks again for helping to find a solution that works with the current environment.

0 Kudos
BillyBuerger
Frequent Contributor

Oh, I should mention that I don't think I have any customers using dimension in Pro that this needs to be used for.  I'm just building a generic tool to modify features and I wanted to make sure all types of features could be updated in case we come across that in the future.  I do know of customers that use dimensions in ArcMap and are planning on moving to Pro that I expect would use dimensions in Pro when that happens.

0 Kudos