How do you set a GoObject to be interpreted as avoidable or not? I have some objects I want excluded from any calls determining occupation of the diagram.

Override GoDocument.IsAvoidable.

You can also customize how big they are (if IsAvoidable is true) by overriding GoDocument.GetAvoidableRectangle.

Can I use the GoDocument.IsAvoidable default and just set a value that makes certain GoObjects not evaluated?

Here’s the default implementation of GoDocument.IsAvoidable.

public virtual bool IsAvoidable(GoObject obj) {
return (obj is IGoNode);
In other words, if the object "is a node", avoid it.

If that is the case then why would:

Doc.IsUnoccupied(leftComment.Bounds, leftComment);

be returning false when the comment intersects with a GoStroke object?

public class GoComment : GoGroup, IGoLabeledNode, IGoIdentifiablePart {...
GoComment isn't an IGoNode.

Yes, I know… Neither is Go Stroke, but when I call Doc.IsUnoccupied(rec, comment), it tells me that the space I am looking to put the comment in, is occupied. The only thing in the space is a GoStroke item, which is not a node either.

It is why it seems to think it is occupied by a GoStroke that is confusing me.


Sorry about that, but we do have other customers to attend to, and not just in this forum.

I just tried a situation where I have a GoComment positioned over (i.e. intersecting with) a GoLink that is connecting two nodes.

GoDocument.IsUnoccupied(comment.Bounds, null) returns true.

IsUnoccupied(link.Bounds, null) returns false because the Bounds of the link intersect with the Bounds of the nodes that it connects.

IsUnoccupied(node.Bounds, null) of course returns false.
But IsUnoccpied(node.Bounds, node) will return true if there aren’t any other nodes nearby or intersecting with the node.

I understand you have other customers, but you were responding to my other posts…

Again, I have a GoComment I am overlapping with a GoStroke (not Link) that is returning that it is occupied in spite of the fact, GoStroke is not a node (using your default).

We try to reply as soon as we can when it’s easy to reply. When we have to do more experimentation, it takes longer.

Anyway, I’m unable to reproduce the situation you are reporting. I too had not overridden any relevant methods, such as GoDocument.IsAvoidable or GoDocument.GetAvoidableRectangle. (By the way, GoLink inherits from GoStroke.)

are you using 3 or 2.6? mine is 2.6

I just tried it in GoDiagram Win 2.6.2 as well – same results.