AutoCAD Map 3D Developer

Reply
Valued Contributor
kob4lt
Posts: 61
Registered: ‎04-14-2010
Message 1 of 8 (354 Views)

Inserting feature through FDO while Map is connected to that SDF

354 Views, 7 Replies
02-12-2012 09:22 AM

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

*Expert Elite*
Alfred.NESWADBA
Posts: 8,867
Registered: ‎06-29-2007
Message 2 of 8 (350 Views)

Re: Inserting feature through FDO while Map is connected to that SDF

02-12-2012 12:48 PM 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
-------------------------------------------------------------------------
Valued Contributor
kob4lt
Posts: 61
Registered: ‎04-14-2010
Message 3 of 8 (348 Views)

Re: Inserting feature through FDO while Map is connected to that SDF

02-12-2012 12:54 PM in reply to: Alfred.NESWADBA

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

 

 

*Expert Elite*
Alfred.NESWADBA
Posts: 8,867
Registered: ‎06-29-2007
Message 4 of 8 (344 Views)

Re: Inserting feature through FDO while Map is connected to that SDF

02-12-2012 01:06 PM 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
-------------------------------------------------------------------------
Valued Contributor
kob4lt
Posts: 61
Registered: ‎04-14-2010
Message 5 of 8 (343 Views)

Re: Inserting feature through FDO while Map is connected to that SDF

02-12-2012 01:21 PM 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?

*Expert Elite*
Alfred.NESWADBA
Posts: 8,867
Registered: ‎06-29-2007
Message 6 of 8 (339 Views)

Re: Inserting feature through FDO while Map is connected to that SDF

02-12-2012 02:18 PM 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
-------------------------------------------------------------------------
Valued Contributor
kob4lt
Posts: 61
Registered: ‎04-14-2010
Message 7 of 8 (338 Views)

Re: Inserting feature through FDO while Map is connected to that SDF

02-12-2012 02:32 PM in reply to: Alfred.NESWADBA

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

*Expert Elite*
Alfred.NESWADBA
Posts: 8,867
Registered: ‎06-29-2007
Message 8 of 8 (336 Views)

Re: Inserting feature through FDO while Map is connected to that SDF

02-12-2012 03:04 PM 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
-------------------------------------------------------------------------

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community