AutoCAD Map 3D Developer

Reply
New Member
troy.miller
Posts: 2
Registered: ‎02-13-2012
Message 1 of 3 (319 Views)

Layer.UpdateFeatures(); Layer.SaveFeatureChanges() is Slow

319 Views, 2 Replies
02-13-2012 01:14 PM

Hello,

 

I am working with the AutoDesk Geospatial platform API to connect to a SQL2008 spatial database. I have my application working but whenever I try to add/update features and save the changes it takes a long time. It takes about 5 seconds which making a user wait five seconds to add a feature is too long.

Is this the right approch to add features or is there another method to update features and then save to the database?

 

Here is a section of my code:

 

MgFeatureCommandCollection commands = new MgFeatureCommandCollection();


commands.Add(new MgInsertFeatures(MyPointLayer.FeatureClassName, propcol));


MyPointLayer.UpdateFeatures(commands);

MyPointLayer.SaveFeatureChanges(options);

 

Any insight would be appricated.

Thanks,

-Troy

Valued Contributor
kob4lt
Posts: 61
Registered: ‎04-14-2010
Message 2 of 3 (317 Views)

Re: Layer.UpdateFeatures(); Layer.SaveFeatureChanges() is Slow

02-13-2012 02:05 PM in reply to: troy.miller

I think you don't have to call SaveChanges method on layer and did you try updating features like this

 

AcMapFeatureService fs = AcMapServiceFactory.GetService(MgServiceType.FeatureService) as AcMapFeatureService;

fs.UpdateFeatures(new MgResourceIdentifier(layer.FeatureSourceId), commands, false);

 

New Member
troy.miller
Posts: 2
Registered: ‎02-13-2012
Message 3 of 3 (313 Views)

Re: Layer.UpdateFeatures(); Layer.SaveFeatureChanges() is Slow

02-13-2012 04:40 PM in reply to: kob4lt

I found a documentation site that explains this.

 

http://wikihelp.autodesk.com/AutoCAD_Map_3D/enu/2012/Help/0000-AutoCAD_0/0015-Feature_15/0029-Updati...

 

I tried the featureservice method but the problem is AutoCAD does not update the layer correctly. It saves the data to the datasource but then AutoCAD re-overwrites it and I end up losing data. 

 

After my command to updateFeatures I would have to refresh each layer which takes longer then the "Edit Set" method from the above link.

 

 

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