If you want to know, how to create FDO Feature Object in AutoCAD Map 3D using Geospatial Platform API, here is a VB.NET code snippet which demonstrates creation of FDO Feature in Map 3D (in this sample it shows creation of Point Feature like the UI command MAPPointCreate) :
Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
'start the transaction
Dim trans As Transaction = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction
Try
'' layerName used in the folloiwn gline is specific to a FDO
'' Data source which has the same layer.
Dim layerName As String = "park_points"
Dim map As AcMapMap = AcMapMap.GetCurrentMap()
Dim layers As MgLayerCollection = map.GetLayers()
Dim layer As AcMapLayer = Nothing
Dim iCount As Integer = Nothing
For iCount = 0 To (layers.Count)
If (layers.GetItem(iCount).Name.ToLower() = layerName.ToLower()) Then
layer = layers.GetItem(iCount)
Exit For
End If
Next iCount
If layer Is Nothing Then
ed.WriteMessage(vbCrLf + "Layer Not Found ! ")
Exit Sub
End If
Dim pt As Autodesk.AutoCAD.Geometry.Point3d
Dim promptPtOp As PromptPointOptions = New PromptPointOptions(vbCrLf + "Select the Location to create a FDO Point : ")
promptPtOp.AllowNone = False
Dim promptPtRes As PromptPointResult = ed.GetPoint(promptPtOp)
If promptPtRes.Status <> PromptStatus.OK Then
ed.WriteMessage("Exiting! Try Again !")
Exit Sub
End If
pt = promptPtRes.Value
Dim geoFact As MgGeometryFactory = New MgGeometryFactory()
Dim coord As MgCoordinate = geoFact.CreateCoordinateXY(Convert.ToDouble(pt.X), Convert.ToDouble(pt.Y))
Dim point As MgPoint = geoFact.CreatePoint(coord)
Dim agf As MgAgfReaderWriter = New MgAgfReaderWriter()
Dim reader As MgByteReader = agf.Write(point)
Dim propCol As New MgPropertyCollection()
propCol.Add(New MgGeometryProperty(layer.GetFeatureGeometryName(), reader))
propCol.Add(New MgStringProperty("STNAME", "Autodesk"))
Dim commands As New MgFeatureCommandCollection()
commands.Add(New MgInsertFeatures(layer.GetFeatureClassName(), propCol))
layer.UpdateFeatures(commands)
'' Call to SaveFeatureChanges to update the FDO Data Source
layer.SaveFeatureChanges(New MgFeatureQueryOptions())
layer.ForceRefresh()
trans.Commit()
Catch ex As MgException
ed.WriteMessage(ex.Message.ToString())
Finally
trans.Dispose()
End Try