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: 

How to modify attributes of FDO features during digitization or on check-in?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
thkoehler
548 Views, 3 Replies

How to modify attributes of FDO features during digitization or on check-in?

I'm looking for a way to populate some feature attributes via API during digitization of FDO features (on a Shapefile layer). Alternatively, also setting the attributes on check-in would be ok.

 

What I have tried so far:

 

Dim map As AcMapMap = AcMapMap.GetCurrentMap()
AddHandler map.FeatureInstanceToBeAdded, AddressOf FeatureInstanceToBeAdded
AddHandler map.FeatureInstanceAdded, AddressOf FeatureInstanceAdded
Dim doc As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
doc.SendStringToExecute("-MAPLINESTRINGCREATE ""Forced Feeder Cables"" ", False, False, True)

 

Unfortunately, in the 2 events I only get a System.IntPtr object as the sender and in the event arguments only the layer + session ID, so I don't see a way there to modify attributes of the new feature.

 

Second approach:

 

Dim service As Autodesk.Gis.Map.Platform.Internal.AcMapEditingService = Autodesk.Gis.Map.Platform.Internal.AcMapEditingService.GetInstance()
Dim options As New Autodesk.Gis.Map.Platform.Internal.AcMapFeatureAcquisitionOptions()
options.AcquireStylized = True
options.GeometryPropertyName = _layer.GetClassDefinition().DefaultGeometryPropertyName
options.HasM = False
options.HasZ = False
Dim propCol As New MgPropertyCollection()
propCol.Add(New MgInt32Property("MyProp", 123)) service.AcquireLineString(_layer, propCol, "Digitize line string", options)

 

Sounds and looks very promising, digitization starts but then no feature is written.

 

What is the right way to do this? Any advice is highly appreciated!

 

Best regards,

Thomas

3 REPLIES 3
Message 2 of 4
thkoehler
in reply to: thkoehler

Never mind, method 2 is working now. I was assuming that AcMapEditingService.AcquireLinestring automatically writes the feature to the layer. But instead, it only adds the geometry property to the MgPropertyCollection. Now I'm manually inserting the feature using a MgInsertFeatures command and that works like a charm :).

Message 3 of 4
hence_the_name
in reply to: thkoehler

Hi,

 

there is some sample code by ADN:

 

http://adndevblog.typepad.com/infrastructure/2012/05/how-to-create-fdo-feature-using-geospatial-plat...

 

Rob

http://raumpatrouille3d.blogspot.ch/
Message 4 of 4
thkoehler
in reply to: hence_the_name

Hi Rob,

 

I had seen that blog post, however it is about digitizing points and for the digitize operation it is using the Editor.GetPoint method from the AutoCAD API. Unfortunately, I didn't find a similar method in the AutoCAD API for digitizing line strings (there is no such thing as Editor.GetLinestring()) and I didn't want to create that on my own, so I was looking for some alternative approaches :).

 

Best regards,

Thomas

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

Post to forums  

Autodesk Design & Make Report

”Boost