Partha
Seeing it in not in the managed API I have just been having a play with trying to use the send command to send CREATECATCHMENTFROMOBJECT to the command line and then passing the last object that I have set as a polyline pulled out of a parcel object.
Then I am using sendkeys to try and tab thru the dialog box but Civil3d gets the focus. Can I stop this happening or set up a hook in and event that watches for the "Create Catchment from Object dialog"" to appear to grab back the focus back along the lines of these links?
http://miamicoder.com/2008/how-to-spy-on-a-windows-program-tracking-main-window-activation/
http://through-the-interface.typepad.com/through_the_interface/2008/05/filtering-windo.html
I did do it years ago 2002-2003 in vba and by starting an external .exe watching for the window handle and name but will have to hunt down the code and expect it will not work with 64 Bit system anyway.
Any suggestions on I simpler way. The end goal I am trying to achieve is to get my parcels which represent catchments linked to structures allready (a couple of hundred) into catchments and out to SSA.
Public Sub MakeCatchment()
Dim document As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = document.Editor
Dim db As Database = document.Database
''Select a polyline to turn into a catchment object
Dim peo1 As New PromptEntityOptions(vbLf & "Select a Catchment Object : ")
peo1.SetRejectMessage(vbLf & "Invalid selection...")
peo1.AddAllowedClass(GetType(Autodesk.Civil.Land.DatabaseServices.Catchment), True)
Dim pEntrs As PromptEntityResult = ed.GetEntity(peo1)
If PromptStatus.OK <> pEntrs.Status Then
Return
End If
Dim ParcelId As ObjectId = pEntrs.ObjectId
'*******************************************
Dim app As AcadApplication
app = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
'app.ActiveDocument.SendCommand("AddNetworkPartsToProf" & vbCr & "Select" & vbCr & "P" & vbCr & vbCr & "(handent ""faa8f"")" & vbCr)
app.ActiveDocument.SendCommand("CREATECATCHMENTFROMOBJECT" & vbCr & "Last" & vbCr & Chr(27) & Chr(9) & Chr(9)) ''The 'chr(27)' means ESC key.
'' 11 tab keys
SendKeys.Send("{TAB 13}")
Regards
Justin Ralston
http://c3dxtreme.blogspot.com/