VB.NET : Problems with Boolean Method from 2012 to 2015

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This is my first and most likely not my last post in here ;
I'm migrating a .NET application from Autocad2012 to Autocad2015. I have yet to find important incompatibilities except this one right here that is really giving me hard times. Basically, the function used have a Region.Area value modified by the Union transaction but on 2015, that area as an Invalid Input or some reason.
Dim MySSet As AcadSelectionSet = AcadApp.ActiveDocument.SelectionSets.Add("SSet1")
Dim FilterType() As Int16 = {8, 0}
Dim FilterData() As Object = {ProgConfig.ClesLayers.CleRegion & "_" & ProgConfig.ClesLayers.CleCut & "_*", ProgConfig.ClesLayers.CleRegion}
MySSet.Select(AcSelect.acSelectionSetAll, , , FilterType, FilterData)
Dim RegionsDessus As New List(Of AcadRegion)
Dim RegionsDessous As New List(Of AcadRegion)
For Each MyAcadEntity As AcadEntity In MySSet
Dim MyEntityNormal As New NormalVector(MyAcadEntity.Normal)
If ((MyEntityNormal.Rnd_X = NormalDessus.Rnd_X) And (MyEntityNormal.Rnd_Y = NormalDessus.Rnd_Y) And (MyEntityNormal.Rnd_Z = NormalDessus.Rnd_Z)) Then
RegionsDessus.Add(MyAcadEntity)
ElseIf ((MyEntityNormal.Rnd_X = NormalDessous.Rnd_X) And (MyEntityNormal.Rnd_Y = NormalDessous.Rnd_Y) And (MyEntityNormal.Rnd_Z = NormalDessous.Rnd_Z)) Then
RegionsDessous.Add(MyAcadEntity)
End If
Next
MySSet.Clear() : MySSet.Delete()
Dim Regions2Remove As New List(Of AcadRegion)
For RegionCount As Integer = 0 To RegionsDessous.Count - 1
Dim RegionDessous As AcadRegion = RegionsDessous(RegionCount)
Dim Resultat As List(Of AcadRegion) = (From Element In RegionsDessus _
Where (Math.Abs((Element.Area - RegionDessous.Area)) < ProgConfig.AppConfig3.Tolerance01)).ToList
Dim ResultCount As Integer = 0
For ResultCount = 0 To Resultat.Count - 1
Dim RegionTemp As AcadRegion = RegionDessous.Copy
RegionTemp.Boolean(AcBooleanType.acUnion, Resultat(ResultCount).Copy)
Dim AreaDiff As Double = Math.Abs((Resultat(ResultCount).Area - RegionTemp.Area))
RegionTemp.Delete()