Add Line Points to Parcel Fabric Using ArcObjects

3554
5
Jump to solution
11-05-2015 06:37 AM
JasonMcKeefry
New Contributor III

I'm working on an add-in tool that would be very similar to the stock Add Line Point Tool with the goal of adding line points between a start and end point on the selected fabric points.  The goal is to add a batch of line points at once on these selected fabric points.  It appears that I need to use ICadastralLinePoints, AddLinePoint method.  This method is not working.  At this point, I think there is a problem with my CadastralPacket.  I don't have any kind of a new parcel started when I use the tool, it's just some selected fabric points.  Does anyone have an example or guidance?  I hacked code from the NewParcel Parcel Fabric Code Snippet.  The line in the while loop fails either because the packet is null or depending on how I try to get the packet, with an exception having no meaningful message.

                    ICadastralExtensionManager pCadExtMan = (ICadastralExtensionManager)ArcMap.Application.FindExtensionByCLSID(pUID);

                    ICadastralEditor pCadEd = (ICadastralEditor)ArcMap.Application.FindExtensionByCLSID(pUID);

                    ICadastralPacketManager pCadPacketMan = (ICadastralPacketManager)pCadEd;

                    bool bStartedWithPacketOpen = pCadPacketMan.PacketOpen;

                    if (!bStartedWithPacketOpen)

                    {

                        pEd.StartOperation();

                    }

                    ICadastralMapEdit pCadMapEdit = (ICadastralMapEdit)pCadEd;

                    pCadMapEdit.StartMapEdit(esriMapEditType.esriMEMapExtent, "Batch Add Line Points", false);

                    ICadastralPacket pCadaPacket = pCadPacketMan.JobPacket; //Get job packet

                    ICadastralPacketStatistics pStatistics = (ICadastralPacketStatistics)pCadaPacket;

                    ICadastralLinePoints pCadLinePoints = (ICadastralLinePoints)pCadaPacket;

                   

                    pEnumIDs.Reset();

                    int oid;

                    while ((oid = pEnumIDs.Next()) != -1)

                    {

                        pCadLinePoints.AddLinePoint(startID, endID, oid);

                    }

1 Solution

Accepted Solutions
JasonMcKeefry
New Contributor III

The key was what you told me offline.  The packet has its own point ids, not the ObjectIDs you see in ArcMap.  Ultimately, I used FindPoint on ICadastralPoints to get the packet point ID.  Another key is that you need to convert your map coordinates to metric using IMetricUnitConverter, which is what goes into FindPoint.  Thanks!

Best,

Jason

View solution in original post

0 Kudos
5 Replies
ChristineLeslie
Esri Contributor

There are some parcel-fabric-specific code snippets available for download from this location on AGOL:

http://www.arcgis.com/home/item.html?id=816ce8cc1ddc4ac2a034f64914947912

Also, on GitHub the code for the published parcel editing/fabric add-ins is available:

Esri/parcel-fabric-desktop-addins · GitHub

Hopefully these links are helpful in solving your problem

Christine

Parcel Editing Team

JasonMcKeefry
New Contributor III

Thanks, Christine.  My original code is a variation on the new parcel snippet.  I've looked at the New Control Point snippet, and I'm still not seeing a strategy for adding line points.  I glanced at GitHub, but am not seeing anything analogous to what I'm trying here.  What about code for the original Add Line Point tool?  This whole endeavor is about trying to keep our tax parcel lines coincident with 40 lines.  Is there a better way to get this set up?  The stock Add Line Point tool works for zipping the boundaries together, but it's slow going to add one line point at a time.  My hope is to get something that lets me identify the start and end points (of a 40 line), and then have all the tax parcel fabric points between those selected so the tool could just loop through the selection adding a line point for each...bringing the tax parcel lines onto the 40 line.  Any ideas?

0 Kudos
ChristineLeslie
Esri Contributor

It looks like your packet may be empty?

Can you try get the job packet and see if that helps?

ICadastralPacket ipPacket;

      ipGeoCadastralExtension->GetJobPacket(&ipPacket);

     ICadastralLinePoints ipGSELinePoints = ipPacket;

JasonMcKeefry
New Contributor III

Thanks, Christine.  I'm probably not understanding what the "packet" really is.  Depending on the code, I can get it, have it open, get statistics on it...confirming that there are parcels and points, but it never has any line points.  The statistics tell me I have points, but I can't access any of them.  My hunch is that it also only gets the tax parcels...not quarters or sections etc.  If there's code for the stock add line point tool, that would probably help.

Best,

Jason

0 Kudos
JasonMcKeefry
New Contributor III

The key was what you told me offline.  The packet has its own point ids, not the ObjectIDs you see in ArcMap.  Ultimately, I used FindPoint on ICadastralPoints to get the packet point ID.  Another key is that you need to convert your map coordinates to metric using IMetricUnitConverter, which is what goes into FindPoint.  Thanks!

Best,

Jason

0 Kudos