EntitySelector.GetClosestEntities exception

1
myzzard
5/20/2015 2:21 PM

Hi,

When I'm calling GetClosestEntities() an ArgumentOutOfRangeException is thrown.
It says 'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index'
It's called in MouseButtonUp event of my own interactor.

C# Code:
public override bool ProcessMouseButtonUp(CanonicalMouseEventArgs e, InteractionContext context)
{
  IList<RenderedEntityInfo> closestEntities = EntitySelector.GetClosestEntities(
         model,
         GraphicsConfig.WhiteBackgroundCorrectForBackColor,
         context.ProjectionTransform,
         e.Position,
         out distance
       );

What could it be wrong? Model? How can I check it?
CadLib ver. 4.0.36.46

Regards,

Mariusz

rammi
5/21/2015 12:41 AM

Do you have a stacktrace?

- Rammi

myzzard
5/21/2015 7:40 AM

Hi,

Here you are.


at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at ŒŠ.Ÿ.€Ÿ(Polyline4D polyline, Point2D point)
at WW.Cad.Drawing.EntitySelector.”.CreatePath(DxfEntity entity, Wireframe drawContext, ArgbColor color, Boolean forText, IList`1 polylines, Boolean fill, Boolean correctForBackgroundColor)
at WW.Cad.Model.Entities.DxfLine.DrawInternal(Wireframe context, IWireframeGraphicsFactory graphicsFactory)
at WW.Cad.Model.Entities.DxfEntity.Draw(Wireframe context, IWireframeGraphicsFactory graphicsFactory)
at WW.Cad.Model.DxfModel.Draw(Wireframe context, IWireframeGraphicsFactory graphicsFactory)
at WW.Cad.Drawing.EntitySelector.GetClosestEntities(DxfModel model, GraphicsConfig config, Matrix4D transformation, Point2D referencePoint, EntityFilterDelegate filterDelegate, Double& distance)
at WW.Cad.Drawing.EntitySelector.GetClosestEntities(DxfModel model, GraphicsConfig config, Matrix4D transformation, Point2D referencePoint, Double& distance)
at OfficeExpertCAD.SelectionObjectInteractor.ProcessMouseButtonUp(CanonicalMouseEventArgs e, InteractionContext context) in C:\Projects\xxx\SelectionObjectInteractor.cs:line 65

Mariusz

myzzard
5/21/2015 1:53 PM

Hi,

On examination of other drawings it seems that only this one model was corrupted and throws an exception.

Mariusz

rammi
5/21/2015 6:20 PM

Hi Mariusz,

thanks for the stacktrace. I identified a problem which seems to be triggered by your special model where somehow the distance to an empty polyline was calculated.

I'll let you know when the next release where this bug is fixed is out.

- Rammi

myzzard
4/30/2019 8:29 AM

Hi Rammi,

It's been a long time but I need to know if you fixed that bug and in what version of CadLib. It happened again to me. I'm aware of that we don't have the last version. I need to know if I should recommend my boss renewing CadLib license.

Regards,

Mariusz

1