Message 1 of 4

Not applicable
09-18-2015
02:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello again,
I have another problem with my DLL for AutoCad.
In my previous post (here) I wanted to connect to a FDO source.
Now I have connected and queried the FDO and got a response in form of a FeatureReader.
but how can I add the features in the reader to the map?
My Code is as follows:
Dim document As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim database As Database = document.Database Dim TM As Autodesk.AutoCAD.DatabaseServices.TransactionManager = document.Database.TransactionManager Dim connManager As OSGeo.FDO.IConnectionManager = OSGeo.FDO.ClientServices.FeatureAccessManager.GetConnectionManager() Dim conn As OSGeo.FDO.Connections.IConnection = connManager.CreateConnection("Autodesk.Oracle.3.9") conn.ConnectionString = "Service=SRID;Username=USERNAME;Password=PASSWORD;Datastore=SCHEMA" conn.Open() Dim Transaction Autodesk.AutoCAD.DatabaseServices.Transaction = TM.StartTransaction Dim LayerTable As Autodesk.AutoCAD.DatabaseServices.LayerTable = CType(TM.GetObject(database.LayerTableId, OpenMode.ForRead, True, True), LayerTable) Dim btr As BlockTableRecord = Transaction.GetObject(database.CurrentSpaceId, OpenMode.ForWrite) Dim selCmd As OSGeo.FDO.Commands.Feature.ISelect = conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Select) selCmd.FeatureClassName = New OSGeo.FDO.Expression.Identifier("VIEWNAME") Dim ftrRdr As OSGeo.FDO.Commands.Feature.IFeatureReader = selCmd.Execute() While ftrRdr.ReadNext() Dim geometryBytes As Byte() = ftrRdr.GetGeometry("SHAPE") Dim geometryFactory As New OSGeo.FDO.Geometry.FgfGeometryFactory() Dim geometry As OSGeo.FDO.Geometry.IGeometry = geometryFactory.CreateGeometryFromFgf(geometryBytes)
'What to do here? End While Transaction.Commit() conn.Close()
//Per
Solved! Go to Solution.