Modify Structural Member Start/End Point

Modify Structural Member Start/End Point

ChrisPicklesimer
Advocate Advocate
327 Vistas
0 Respuestas
Mensaje 1 de 1

Modify Structural Member Start/End Point

ChrisPicklesimer
Advocate
Advocate

I am trying to modify the start and/or end points of a structural member.  I assumed I would be able to modify the StartPoint and EndPoint property of the structural member in a similar way in which I modify Line StartPoint and EndPoint properties. See code below.    The sub where I attempt to manipulate the structural member blows up at the indicated line below. 

 

Anyone know how to modify Start/End Point of a stuctural member or can point me in the right direction?

 

Thanks.

 

Chris

 

    Public Sub ChangeStartPointLine()

        Dim pt As Point3d
        Dim myID As ObjectId = GetEntityID(pt)
        Dim myLine As Line

        Dim ed As Editor = AcApp.Application.DocumentManager.MdiActiveDocument.Editor
        Dim db As Autodesk.AutoCAD.DatabaseServices.Database = ed.Document.Database
        Using tr As Transaction = db.TransactionManager.StartTransaction()

            Dim mypt As New Point3d(0, 0, 0)
            myLine = tr.GetObject(myID, OpenMode.ForWrite)
            myLine.StartPoint = mypt '<<<<<<<<<<<<<<<<<<<<<<<<<<<Works

            tr.Commit()

        End Using

    End Sub

 

Public Sub ChangeStartPointMember()

        Dim pt As Point3d
        Dim myID As ObjectId = GetEntityID(pt)
        Dim myMember As Autodesk.Aec.Structural.DatabaseServices.Member

        Dim ed As Editor = AcApp.Application.DocumentManager.MdiActiveDocument.Editor
        Dim db As Autodesk.AutoCAD.DatabaseServices.Database = ed.Document.Database
        Using tr As Transaction = db.TransactionManager.StartTransaction()

            Dim mypt As New Point3d(0, 0, 0)
            myMember = tr.GetObject(myID, OpenMode.ForWrite)
            myMember.StartPoint = mypt '<<<<<<<<<<<<<<<<<<<<<<<<<<<Does not work

            tr.Commit()

        End Using

    End Sub


    Public Function GetEntityID(ByRef pt As Point3d) As ObjectId

        Dim myObjID As ObjectId

        myObjID = Nothing

        Dim ed As Editor = AcApp.Application.DocumentManager.MdiActiveDocument.Editor
        'get working database
        Dim dwg As Database = ed.Document.Database

        Dim prGetEntity As PromptEntityOptions = New PromptEntityOptions(ControlChars.NewLine & "Select entity:")
        prGetEntity.SetRejectMessage(ControlChars.NewLine & "You must select an entity:.")
        'prGetEntity.AddAllowedClass(GetType(Wall), False)


        Dim resGetEntity As PromptEntityResult = ed.GetEntity(prGetEntity)

        If resGetEntity.Status = PromptStatus.OK Then
            myObjID = resGetEntity.ObjectId
            pt = resGetEntity.PickedPoint
        End If

        Return myObjID

    End Function

0 Me gusta
328 Vistas
0 Respuestas
Respuestas (0)