Author Topic: Creating an associative hatch in C# causes access violation  (Read 8060 times)

0 Members and 2 Guests are viewing this topic.

akaranta

  • Guest
Re: Creating an associative hatch in C# causes access violation
« Reply #15 on: November 04, 2015, 07:30:14 AM »
I am not quite sure what you mean by "are you trying to copy the id's of the associated entity(s)?? .. or perhaps does the definition of the associated hatch refer to the bounding objects ??".
I am assuming that Hatch.GetAssociatedObjectIdsAt( int index ) returns the objects associated with the loop with the given index (in this case I assume the id of the rectangle is returned). In the code I just posted I am making a new ObjectIdCollection with the same object ids as in the original loop in order to create an identical hatch loop (i.e. in this case it is associated with the same object(s) as the original one).
If I haven't misunderstood completely, by definition an associative hatch refers to the bounding objects.

akaranta

  • Guest
Re: Creating an associative hatch in C# causes access violation
« Reply #16 on: November 11, 2015, 02:26:43 AM »
As a workaround I changed my code so that I "strip" away the Polyline flag from the hatch loop type like so:

Code: [Select]
var ltype = ( loopType.HasFlag( HatchLoopTypes.Polyline ) && loopType != HatchLoopTypes.Polyline ) ? loopType & ~HatchLoopTypes.Polyline : loopType;

This seems to be working at least with the hatches I have tried this far and visually they look the same. I am not sure if removing the Polyline flag from the loop type like this causes any differences that are significant to a user using the drawing.