AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Inserting feature through FDO while Map is connected to that SDF

7 REPLIES 7
Reply
Message 1 of 8
kob4lt
654 Views, 7 Replies

Inserting feature through FDO while Map is connected to that SDF

With AutoCAD Map I am connected to this SDF source. While I am connected, through code I am opening and closing same SDF file with FDO. This works fine, but, when I insert a feature with code, everything goes well but AutoCAD Map doesn't see this change. Even if I refresh layer, nothing happens. When I look at the file, I can see that it has been modified.

When I disconnet from the source and then connect back, that feature is here. 

If I do the inserting all again (after connecting and disconnecting), everthing goes well

 

Help! I am going crazy

7 REPLIES 7
Message 2 of 8
Alfred.NESWADBA
in reply to: kob4lt

Hi,

 

>> when I insert a feature with code, everything goes well but AutoCAD Map doesn't see this change

So if you made some insertions of new features with your code and you try to close the DWG ==> do you get the request for commiting the changes? If so you should "commit the insertions" within your code.

 

Or how do I have to understand "Map doesn't see this change"?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 8
kob4lt
in reply to: Alfred.NESWADBA

No i don't because, i think, i am directly accessing SDF with FDO, not with Map. 

 

 

Message 4 of 8
Alfred.NESWADBA
in reply to: kob4lt

Hi,

 

>> i am directly accessing SDF

Sure? So whatfor do you start Map3D then if you write directly to the SDF-file?

 

I think you use the Map/MapGuide/FDO-Library to insert new objects into the FDO-connected SDF. And that made me requesting if you commited the changes by code or you get a request for commiting/check-in the new FDO-objects.

 

Once more: if you don't get the request for that, how do I have to imagine your words "Map doesn't see this change"? Did you assign new features to the sdf and you don't see it on the display? If so: what happens if you pick "refresh" from the right-mouse context menu on your GIS-layer in the Map3D-Workspace? (hoping "refresh" is the correct translation from my German Map3D)

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 5 of 8
kob4lt
in reply to: Alfred.NESWADBA



>> i am directly accessing SDF

Sure? So whatfor do you start Map3D then if you write directly to the SDF-file?

 

 


I was expacting that accessing features through FDO is faster than accessing with Map/MapGuide/FDO-Library

 


Once more: if you don't get the request for that, how do I have to imagine your words "Map doesn't see this change"? Did you assign new features to the sdf and you don't see it on the display? If so: what happens if you pick "refresh" from the right-mouse context menu on your GIS-layer in the Map3D-Workspace? (hoping "refresh" is the correct translation from my German Map3D)


Yes, that it's exactly the point, when I pick a point in drawing and insert feature with FDO (IInsert method), feature is not displaying in drawing. Than I hit the refresh button (right click on that layer in MAPWSPACE palette) -> nothing. I go to my computer, to that sdf file, and in the properties window I can see that it has been modified within a minute ago.

Then, I disconnect from SDF and connect again, that insert feature is there, it is displayed now.

So, what I mean by "Map doesn't see changes" it means that Map connection doesn't register that sdf file has been modified

 

And after reconnecting, inserting features is working fine, when I insert feature, it is there, within a second in drawing

 

One question. after Execute method on insert object, do I have to do anything else?

Message 6 of 8
Alfred.NESWADBA
in reply to: kob4lt

Hi,

 

look to my code-snippet (short and just out of an application), may be it helps (as it works for SHP-files via FDO)

                  If (tFdoBatchPropColl IsNot Nothing) AndAlso (tFdoBatchPropColl.Count > 0) Then
                     Dim tInsertFeatures As MgInsertFeatures = New MgInsertFeatures(tFeatureClassName, tFdoBatchPropColl)
                     Dim tFeatCommands As MgFeatureCommandCollection = New MgFeatureCommandCollection
                     tFeatCommands.Add(tInsertFeatures)

                     Try
                        Dim tFdoResultProps As MgPropertyCollection = tFdoLayer.UpdateFeatures(tFeatCommands)
                        Dim tQueryOpts As MgFeatureQueryOptions = New MgFeatureQueryOptions
                        Call CType(tFdoLayer, AcMapLayer).SaveFeatureChanges(tQueryOpts)
                        tFdoLayer.ForceRefresh()
                     Catch ex2 As Exception
                        Call ISHMessaging.MessageAdd("Fehler bei Export nach FDO", "ISH.ISHFdoConn.writeEntsToFDO", ex2)
                        tRetVal = False
                     End Try

                  End If

 Especially the .ForceRefresh may be the missing link for you?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 7 of 8
kob4lt
in reply to: Alfred.NESWADBA

Do you think that it is better to work with MapGuide or FDO library? Is there a difference?

Message 8 of 8
Alfred.NESWADBA
in reply to: kob4lt

Hi,

 

>> Do you think that it is better to work with MapGuide or FDO library? Is there a difference?

As long as you start them within Map3D there is no difference (they are coming more and more close to each other).

A difference would be (what I thought first) to use any free API's from www.osgeo.org (or any partner) ....while you have loaded it in Map3D.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost