GetNestedEntity shows message "Nothing selected"

GetNestedEntity shows message "Nothing selected"

max.senft
Enthusiast Enthusiast
649 Views
2 Replies
Message 1 of 3

GetNestedEntity shows message "Nothing selected"

max.senft
Enthusiast
Enthusiast

Hi everybody,

 

at first I have to apologize, if "Nothing selected" is the wrong translation, but I'm using the German version of AutoCAD and there the message is called "Nichts gewählt."

 

So, here's the problem: I implented a command, that will set "inner" attributes to a user defined position. I do so by changing the property "Position" of the attribute (which actually is property "DBText.Position"). After repositioning I cannot click on the attribute again using GetNestedEntity. It just shows the text I mentioned above. I realized, that this behavior occurs, when I reposition the attribute outside of the extents of the outer block. So, it seems to me there is some "action" missing that will update the block's extents?!

 

I remembered playing around with the "MoveTextInBlockJig" shown at the Through the Interface blog. There, the entity (attribute/text) is moved by using the class' TransformBy() method. Is this the better way to do the repositioning? Or can I use the Position property, but with some further method to call?

 

Thanks!

 

Best regards

Max

0 Likes
Accepted solutions (1)
650 Views
2 Replies
Replies (2)
Message 2 of 3

max.senft
Enthusiast
Enthusiast

Ok, too sad. I rewrote the part where I use the Position property by now using the TransformBy() method. But it did not change the behavior.

So, it seems that during (or after?) the DisplacementJig's (see the Through the Interface blog) Update() method (in which the TransformBy() is also used) something else happens which will update the entity correctly. 😞 But what is it?

Regards
Max

0 Likes
Message 3 of 3

max.senft
Enthusiast
Enthusiast
Accepted solution

Hi again,

 

I feel really stupid now... Smiley Embarassed I should have read the code on the blog properly ... the following lines will do the trick. Shame on me.

 

foreach (var id in SelectionTools.LastContainers)
{
	var ent2 = CurrentTr.GetObject(id, OpenMode.ForWrite) as Entity;
	if (ent2 != null)
	{
		// We might also have called this method:
		// ent2.RecordGraphicsModified(true);
		// but setting a property works better with undo

		ent2.Visible = ent2.Visible;
	}
}

 

Regards

Max