.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GetNestedEntity shows message "Nothing selected"

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
max.senft
535 Views, 2 Replies

GetNestedEntity shows message "Nothing selected"

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

2 REPLIES 2
Message 2 of 3
max.senft
in reply to: max.senft

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

Message 3 of 3
max.senft
in reply to: max.senft

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost