- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
If I move an alignment that is in the alignment table, C3D will adjust the table values based on how the alignment moved.
(*EDIT NOTE: For clarity this first pair of images is what happens when clicking and dragging an alignment with the mouse. I want to emulate this behavior when moving an alignment autonomously using .NET. The second set of images shows, below the VB .NET code I have given, shows the alignment has been transformed by the code, but the table did not auto update itself to the alignments new values)
Above table pre move
Below table post move
So if I move the alignment the table updates. I want the table to be updated when moved from code. I.e) when I adjust the alignment in any way.
Currently I have this. Basically I look through everything, find the alignment and transform it then I want to update the table.
'Globals initlaized else where but so you know what they are
m_docCol = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager
m_doc = m_docCol.MdiActiveDocument
m_oDB = m_doc.Database
Using trans As Transaction = m_oDB.TransactionManager.StartTransaction()
Dim currentSpace As BlockTableRecord = TryCast(
trans.GetObject(m_oDB.CurrentSpaceId, OpenMode.ForRead), BlockTableRecord
)
For Each objId As ObjectId In currentSpace
Dim ent As Autodesk.AutoCAD.DatabaseServices.Entity = TryCast(
trans.GetObject(objId, OpenMode.ForRead),
Autodesk.AutoCAD.DatabaseServices.Entity
)
If TypeOf ent Is Alignment Then
Dim test As Alignment = TryCast(
ent, Alignment
)
' Create a transformation matrix for the move
Dim moveVec As New Vector3d(100, 200, 0) ' Change these values to your desired X,Y,Z offset
Dim transform As Matrix3d = Matrix3d.Displacement(moveVec)
test.TransformBy(transform)
End If
If TypeOf ent Is Autodesk.Civil.DatabaseServices.Table Then
Dim table As Autodesk.Civil.DatabaseServices.Table = TryCast(
ent, Autodesk.Civil.DatabaseServices.Table
)
' Check for specific table types
Select Case True
Case TypeOf table Is PointTable
m_doc.Editor.WriteMessage(vbCrLf & "Found Point table: " & table.Description)
Case TypeOf table Is ParcelTable
m_doc.Editor.WriteMessage(vbCrLf & "Found Parcel table: " & table.Description)
Case TypeOf table Is AlignmentTable
m_doc.Editor.WriteMessage(vbCrLf & "Found Alignment table: " & table.Description)
End Select
End If
Next
trans.Commit()
End Using
Here is the current outcome
above is pre code, below is post code. The tables are identical even though the alignment has been altered.
The alignment is moved, but the table is not changed.
Is there a way to get the outcome I am looking for.
Again, I want to be able to move items that are linked to tables and have the table auto update, which is currently what happens when moving items within cad itself. However, I want to get that same behavior when the alignment is modified in code.
Solved! Go to Solution.