[Drawkit] DKShapeGroup bump in the road

Graham Cox graham.cox at bigpond.com
Thu Apr 16 22:13:02 PDT 2009


On 17/04/2009, at 3:04 PM, Allan Daly wrote:

> I cannot figure out why does this code not properly create a new  
> DKShapeGroup containing 1 object.
>
>  Any thoughts?
>


Yep. Because a group must have at least 2 objects. This line in - 
setGroupObjects: (204 in my copy) rejects < 2:

	if([groupObjects count] < 2 )
		return;


This then causes the initialiser of DKShapeGroup to gracefully fail  
and return nil.

Now, it isn't absolutely essential that a group have > 1 object, it  
just didn't seem to make sense that such a thing should exist.  
However, if it's allowed by the DXF format, then you should find that  
simply removing that check should allow it to work. Otherwise, try  
adding at least two objects when you make the group.

--Graham




More information about the Drawkit mailing list