Author Topic: Modifying points of an autocad "dimension"  (Read 2198 times)

0 Members and 1 Guest are viewing this topic.

snoopyonline

  • Guest
Modifying points of an autocad "dimension"
« on: October 14, 2013, 04:09:34 AM »
I need some help or good idea how to modify the (stretch-)points of autocad dimensions with .NET

I am analysing the existing objects in an autocad drawing. If the object is a dimension (DxfName = "DIMENISON") the following sub is executed with its ObjectID...

Code: [Select]
Private Sub rnddim(ByVal OID As Autodesk.AutoCAD.DatabaseServices.ObjectId)
        Try
            Dim myEnt As Dimension = OID.GetObject(OpenMode.ForWrite)
            Dim pset As New Point3dCollection
            myEnt.GetStretchPoints(pset)
            For r As Integer = 0 To pset.Count - 1
                DrawDBPoint(New Point2d(pset.Item(r).X, pset.Item(r).Y), r + 1) 'Draws an AutoCAD-Point on each coordinate - just for fun and to analyse the stretchpoints
                Dim oldpt As Point3d = pset.Item(r)
                Dim newpt As Point3d = New Point3d(baseround(oldpt.X, dblXBase), baseround(oldpt.Y, dblXBase), baseround(oldpt.Z, dblXBase) * zfact) 'Round the X/Y/Z coordinate of the points (e.g. 0.001 --> 0.05)
                Dim pvector As Vector3d = New Vector3d(newpt.X - oldpt.X, newpt.Y - oldpt.Y, newpt.Z - oldpt.Z)
                myEnt.MoveStretchPointsAt(New IntegerCollection(r), pvector)
            Next

        Catch ex As Exception
            ListBox2.Items.Add(ListBox1.Items(ListBox1.SelectedIndex) & "|" & OID.ToString & "|" & "Bemassung: " & " " & ex.Message)
            oiderrorlist.Add(OID)
        End Try
    End Sub

After the "GetStretchPoints" method works fine and delivers all positions of the dimensions definitionpoints (including text- and baseline-position) I thought the "MoveStretchPointsAt" method should be able to modify these points but obviously nothing happens. The points of the dimension are not modified in any way...

What am I doing/thinking wrong? How can I move the definition points of AutoCAD dimensions?


Thank you very much in advance...