Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

pFtr.Store

End Sub
share|improve this question
    
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

1 Answer 1

up vote 2 down vote accepted

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

pFtr.Store
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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