Resolve error "Invalid polygon number.Alter Object No when Alter Object Node Remove failed" when called in MapBasic application

Product affected: MapInfo Pro™ application, MapBasic® application


When running the below code in MapBasic® application:

Include "MapBasic.def"
Declare Sub Main

Sub Main
Dim nNode As Integer
Dim objx As Object

Create Pline Into Variable objx 2 (5,5) (6,6)

Alter Object objx Node Remove Position 1,2

Print "1st Object, num nodes: " + ObjectInfo (objx, OBJ_INFO_NPNTS)

Create Pline Into Variable objx 1 (5,5)

Print "2nd Object, num nodes: " + ObjectInfo(objx, OBJ_INFO_NPNTS)

Create Region Into Variable objx 1 4 (5,5) (6,6) (5,6) (5,5)

Print "Removing Segment with few Nodes, Segment 1 has only " & ObjectInfo(objx, OBJ_INFO_NPOLYGONS + 1) + " nodes"

For nNode = ObjectInfo(objx, OBJ_INFO_NPOLYGONS + 1) To 1 Step - 1

Print "Removing node " & nNode

Alter Object objx Node Remove Position 1, nNode


End Sub

the following error occurs in MapInfo Pro™ application:
User-added image



MIPro does allow an invalid object to exist in case a user tries to commit which could result in the table having invalid objects. If the operation ends up with a one node Polyline, then MIPro will remove it completely as an invalid object.


UPDATED: March 14, 2018
This is working as design