.NET

Reply
Contributor
max.senft
Posts: 15
Registered: ‎03-19-2014
Message 1 of 3 (134 Views)
Accepted Solution

GetNestedEntity shows message "Nothing selected"

134 Views, 2 Replies
04-03-2014 04:01 AM

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

Hi again,

 

I feel really stupid now... :smileyembarrassed: 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

Contributor
max.senft
Posts: 15
Registered: ‎03-19-2014
Message 2 of 3 (127 Views)

Re: GetNestedEntity shows message "Nothing selected"

04-03-2014 04:30 AM 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. :smileysad: But what is it?

Regards
Max

Contributor
max.senft
Posts: 15
Registered: ‎03-19-2014
Message 3 of 3 (121 Views)

Re: GetNestedEntity shows message "Nothing selected"

04-03-2014 04:43 AM in reply to: max.senft

Hi again,

 

I feel really stupid now... :smileyembarrassed: 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.