I am trying to move a dimension feature inside a personal geodatabase using ArcObjects VBA. I was able to move other types of features using similar code as shown below. However it is not working for dimension features. Can someone help me on this?

Sub AdjustDimensionFeature()
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument

Dim pmap As IMap
Set pmap = pMxDoc.FocusMap

Dim pFtrLyr As IFeatureLayer
Set pFtrLyr = pmap.Layer(0)

Dim pFC As IFeatureClass
Set pFC = pFtrLyr.FeatureClass

Dim pFtr As IFeature
Set pFtr = pFC.GetFeature(8362)

Dim pTransform2D As ITransform2D
Dim pPolygon As IPolygon
Set pPolygon = pFtr.ShapeCopy

Set pTransform2D = pPolygon

pTransform2D.Move 20, 20

Set pFtr.Shape = pPolygon


End Sub
  • found the answer myself.. – vinayan Mar 12 '12 at 16:44
  • found the answer myself.. used the dimensionshape property of idimensionfeature..transform BeginDimensionPoint,EndDimensionPoint and DimensionLinePoint..really finding hard to post the code as comment due to formatting :-( – vinayan Mar 12 '12 at 16:54
  • 1
    Post your solution as an answer. It's perfectly fine to answer your own question! – blah238 Mar 12 '12 at 18:28

here is the solution which i found out..

Dim pDimFtr as IDimensionFeature
set pDimFtr = pFtr
Dim pDimShp As IDimensionShape
Set pDimShp = pDimFtr.DimensionShape

Dim pPtsColl As IPointCollection
Set pPtsColl = New Multipoint
pPtsColl.AddPoint pDimShp.BeginDimensionPoint
pPtsColl.AddPoint pDimShp.DimensionLinePoint
pPtsColl.AddPoint pDimShp.EndDimensionPoint
'pPtsColl.AddPoint pDimShp.TextPoint

Dim pTransform2D As ITransform2D
Dim pPolygon As IPolygon
Set pPolygon = pFtr.ShapeCopy

Set pTransform2D = pPtsColl

pTransform2D.Move 20, 20

Set pDimShp.BeginDimensionPoint = pPtsColl.Point(0)
Set pDimShp.DimensionLinePoint = pPtsColl.Point(1)
Set pDimShp.EndDimensionPoint = pPtsColl.Point(2)
'Set pDimShp.TextPoint = pPtsColl.Point(3)

pDimFtr.DimensionShape = pDimShp

| improve this answer | |
  • 3 years down, I face the same issue and woah!! – vinayan Jul 30 '15 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.