• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

CreateAGNPolyVeg: System.ArgumentException: Number of points must be 0 or >3

MatthiasKNU

Resource contributor
Messages
958
Country
germany
Hi Arno!

I stumbled over the following error with the latest ScenProc Development Release, which *might* be related to this problem:

Code:
13:21    SceneryProcessor    Error        System.AggregateException: Mindestens ein Fehler ist aufgetreten. ---> System.ArgumentException: Number of points must be 0 or >3
   bei NetTopologySuite.Geometries.LinearRing.ValidateConstruction()
   bei NetTopologySuite.Geometries.LinearRing..ctor(Coordinate[] points)
   bei ASToFra.scenProc.DataModel.PolygonFeature..ctor(Coordinate[] points)
   bei ASToFra.scenProc.DataModel.PolygonFeature.GetPolygonsWithoutHoles()
   bei ASToFra.scenProc.Steps.CreateAGNPolyVeg.<>c__DisplayClass9_0.<Process>b__0(GridCell cell)
   bei System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   bei System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   bei System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   bei System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   bei System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
   bei System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   bei System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, Action`1 body)
   bei ASToFra.scenProc.Steps.CreateAGNPolyVeg.Process(List`1 cells, String[] arguments)
   bei ASToFra.scenProc.Processor.SceneryProcessor.Process()
   bei ASToFra.scenProc.Processor.SceneryProcessor.ProcessConfig(String filename, List`1 commands, Boolean errorReporting)
---> (Interne Ausnahme #0) System.ArgumentException: Number of points must be 0 or >3
   bei NetTopologySuite.Geometries.LinearRing.ValidateConstruction()
   bei NetTopologySuite.Geometries.LinearRing..ctor(Coordinate[] points)
   bei ASToFra.scenProc.DataModel.PolygonFeature..ctor(Coordinate[] points)
   bei ASToFra.scenProc.DataModel.PolygonFeature.GetPolygonsWithoutHoles()
   bei ASToFra.scenProc.Steps.CreateAGNPolyVeg.<>c__DisplayClass9_0.<Process>b__0(GridCell cell)
   bei System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   bei System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   bei System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)<---

The ScenProc script looks like this:
Code:
ImportOGR|temp\landuse62.shp|*|*|NOREPROJ
SplitGrid|AGN|*
CreateAGNPolyVeg|GUID="{57fb3c8e-db8b-47b0-a012-8305fbf082c2}"|{57fb3c8e-db8b-47b0-a012-8305fbf082c2}
CreateAGNPolyVeg|GUID="{7ad672f7-e0d4-455b-85f9-6032d39c0855}"|{7ad672f7-e0d4-455b-85f9-6032d39c0855}
CreateAGNPolyVeg|GUID="{d26cb3c7-9be7-44ec-b7ad-155832ec4f99}"|{d26cb3c7-9be7-44ec-b7ad-155832ec4f99}
CreateAGNPolyVeg|GUID="{ca0818dd-dab8-4edd-9b14-d69766fea98a}"|{ca0818dd-dab8-4edd-9b14-d69766fea98a}
ExportAGN|P3D v2|OUTPUT\texture_processed62

I have already checked the landuse62.shp file with ArcGIS for errors, but everything is fine.
Here is the landuse file:
landuse62.shp

In the ScenProc 2 version this error does not occur, so I think it is a problem of the Development Release...

Would be great if you could take a look at this for a second!
Thanks a lot in advance and have a nice weekend!
Matthias
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi,

I'll try to reproduce it. Scenproc doesn't use the library for the polygons that gives this error. It looks like there is a polygon that has only 1 or 2 vertices.
 

MatthiasKNU

Resource contributor
Messages
958
Country
germany
Just checked that, but no, there is no feature in there with less than 4 vertices...
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Interesting, that's what the error says. I'll try with the debugger and see where the error comes from.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi,

I can reproduce it here. The problem is not in the input data. When making the vegetation polygon I need to remove the holes, as AGN files don't support polygons with holes. It seems that algorithm returned the incorrect polygon.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi,

I have fixed the bug now. It will be in the next development release.
 

MatthiasKNU

Resource contributor
Messages
958
Country
germany
Wow, that was fast, just downloaded the new development build, and now it works!
Thank you!
 

MatthiasKNU

Resource contributor
Messages
958
Country
germany
Hi Arno!

I think I just found another problem in the routine for loading the polygons without holes:
Code:
13:50    SceneryProcessor    Error        System.AggregateException: Mindestens ein Fehler ist aufgetreten. ---> System.DivideByZeroException: Es wurde versucht, durch 0 (null) zu teilen.
   bei ASToFra.ObjectModel3D.Polygon.GetVertex(Int32 index)
   bei ASToFra.ObjectModel3D.Polygon.GetMinVector()
   bei ASToFra.ObjectModel3D.Polygon.GetBoundingBox()
   bei ASToFra.ObjectModel3D.Polygon.IsInside(Vector3d pos, Double eps)
   bei ASToFra.ObjectEditor.BooleanOperator.SplitEdges(Boolean first)
   bei ASToFra.ObjectEditor.BooleanOperator..ctor(Polygon a, Polygon b)
   bei ASToFra.scenProc.DataModel.PolygonFeature.GetPolygonsWithoutHoles()
   bei ASToFra.scenProc.Steps.CreateAGNPolyVeg.<>c__DisplayClass9_0.<Process>b__0(GridCell cell)
   bei System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   bei System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   bei System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   bei System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   bei System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
   bei System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   bei System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, Action`1 body)
   bei ASToFra.scenProc.Steps.CreateAGNPolyVeg.Process(List`1 cells, String[] arguments)
   bei ASToFra.scenProc.Processor.SceneryProcessor.Process()
   bei ASToFra.scenProc.Processor.SceneryProcessor.ProcessConfig(String filename, List`1 commands, Boolean errorReporting)
---> (Interne Ausnahme #0) System.DivideByZeroException: Es wurde versucht, durch 0 (null) zu teilen.
   bei ASToFra.ObjectModel3D.Polygon.GetVertex(Int32 index)
   bei ASToFra.ObjectModel3D.Polygon.GetMinVector()
   bei ASToFra.ObjectModel3D.Polygon.GetBoundingBox()
   bei ASToFra.ObjectModel3D.Polygon.IsInside(Vector3d pos, Double eps)
   bei ASToFra.ObjectEditor.BooleanOperator.SplitEdges(Boolean first)
   bei ASToFra.ObjectEditor.BooleanOperator..ctor(Polygon a, Polygon b)
   bei ASToFra.scenProc.DataModel.PolygonFeature.GetPolygonsWithoutHoles()
   bei ASToFra.scenProc.Steps.CreateAGNPolyVeg.<>c__DisplayClass9_0.<Process>b__0(GridCell cell)
   bei System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   bei System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   bei System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)<---

Just give me a few minutes to upload the shapefiles and the script.

Code:
ImportOGR|C:\Users\mknue\Desktop\agnCreator\temp\landuse91.shp|*|*|NOREPROJ
SplitGrid|AGN|*
CreateAGNPolyVeg|GUID="{dc5c8dcb-551e-4980-867d-ee6d12695c50}"|{dc5c8dcb-551e-4980-867d-ee6d12695c50}
CreateAGNPolyVeg|GUID="{db9149ee-bb9d-4da6-89c8-2c4900eed8fa}"|{db9149ee-bb9d-4da6-89c8-2c4900eed8fa}
CreateAGNPolyVeg|GUID="{637d5b6f-3acd-4a55-8c32-2523958f9824}"|{637d5b6f-3acd-4a55-8c32-2523958f9824}
ExportAGN|P3D v2|C:\Users\mknue\Desktop\agnCreator\OUTPUT\texture_processed91

EDIT:
Here's the link:
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
OK, I'll have a look with your data. I suspect there is a polygon with 0 vertices in there.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi,

Thanks, with your test data it was easy to reproduce the bug. It is fixed in the next development release.
 
Top