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

Read An Object Properties Of An Object In An XRef By Selection

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Hugh_Compton
952 Views, 5 Replies

Read An Object Properties Of An Object In An XRef By Selection

 

Is it possible to select an object for reading in an XRef?  If so could someone post an example?

 

Thanks

 

PS I think it has something to do with  Editor.SelectNestedEntity() but it is the end of a long day and I can't fathom it out 😞

5 REPLIES 5
Message 2 of 6

Dim PrNestOps As New PromptNestedEntityOptions("Pick Nested Entity")
PrNestOps.AllowNone = False
PrNestOps.UseNonInteractivePickPoint = False
'set that to true and supply a point to NonInteractivePickPoint if you want to get an entity at a known point without prompting the user
Dim pner As PromptNestedEntityResult = acdocs.MdiActiveDocument.Editor.GetNestedEntity(PrNestOps)
If pner.Status = PromptStatus.OK Then
	Dim nestedID As ObjectId = pner.ObjectId 'this is the id of the most deeply nested object at the picked point
	Dim pickpt As Point3d = pner.PickedPoint
	Dim ParentIds As New ObjectIdCollection(pner.GetContainers) 'this is the Ids of all the container objects
	'... do what you need to do
End If

 

Dave O.                                                                  Sig-Logos32.png
Message 3 of 6
Hugh_Compton
in reply to: Hugh_Compton

 

Fantastic reply, works brilliantly.  Thanks Chief!

Message 4 of 6

No problem...

 

You should also note, if you haven't already discovered it, that if the selected object is a Polyline2d or Polyline3d type, then the "most deeply nested object" returned by pner.ObjectId will be a Vertex2d or Vertex3d object.  So, in the code I have where I was looking for something that derives from Curve, I had to check for that, and get the parent of the Vertex to get the Curve I was looking for.

 

Also, It is appreciated, by both the answerers, and the future searchers, if you mark a post as a solution when your problem is solved.

Dave O.                                                                  Sig-Logos32.png
Message 5 of 6
Hugh_Compton
in reply to: Hugh_Compton

 

Good advice, I've been using it on Sold3D objects with great success so far. 

Message 6 of 6

Glad to help...  And thanks for marking the solution.  It's not an ego thing, I couldn't care less about my "solutions Authored" stats, it's just that I, and I'm sure other people like me, have an RSS feed of this forum, and I at least "look" at every single post.  It helps if I can open a post and see that it has been solved, then I know I don't need to look at it any further, unless I intend to learn from it.

 

Then there is the other side, where I am am searching this forum or any other, I'm more likely to look at threads that show a solution, than threads that don't.

 

Dave O.                                                                  Sig-Logos32.png

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