hokie555 Posted November 6, 2009 Posted November 6, 2009 nentsel: Prompts the user to select an object (entity) by specifying a point, and provides access to the definition data contained within a complex object (i assume this means it will grab the NESTED entity of, say, a block) nentselp: Provides similar functionality to that of the nentsel function without the need for user input entsel: Prompts the user to select a single object (entity) by specifying a point I'm looking for a combination of nentselp and entsel, where I have a predetermined point (don't want to be prompted for it), and I want the entity data to be that of the BLOCK, and not the Nested Object within the Block. Why isn't there an entselp function? Quote
Freerefill Posted November 6, 2009 Posted November 6, 2009 Nentselp returns a list of lots of good information. The first item in that list is the nested entity. The last item in that list is the entity it's nested within. You just need something like (car (last (nentselp (getpoint)))). Quote
hokie555 Posted November 6, 2009 Author Posted November 6, 2009 Thank you Freerefill for your reply. I'm a little new at this. Could you tell me what I'm doing wrong here? I'm just trying to get the layer of the block. ip is my point (setq ent1 (nentselp ip)) (setq ent2 (entget (car (last (ent1))))) (setq blayer (cdr (assoc 8 ent2))) Quote
Freerefill Posted November 6, 2009 Posted November 6, 2009 Your first line is good, spot on. Your second line has one mistake in it: you've got parentheses around your variable. That syntax is going to tell the interpreter that (ent1) is a function, much like (entsel) or (ssget) (see the parentheses?). So just make your second line look like this: (setq ent2 (entget (car (last ent1)))) And your third line looks spot on as well, so that should work. Quote
alanjt Posted November 6, 2009 Posted November 6, 2009 You can use ssget. For instance: (and (setq pt (getpoint "\nSpecify point: ")) (setq ss (ssget pt)) (setq en (entget (ssname ss 0))) ) Quote
hokie555 Posted November 6, 2009 Author Posted November 6, 2009 Thanks to both of you, it works great now! Quote
alanjt Posted November 6, 2009 Posted November 6, 2009 Thanks to both of you, it works great now! No problem. I just wanted to offer another option. Quote
Freerefill Posted November 6, 2009 Posted November 6, 2009 It was a good solution, Alan. I didn't even think of it, I just jumped right into "problem solver" mode. I can only think outside the box when my mind is wandering, it seems. Quote
gile Posted November 6, 2009 Posted November 6, 2009 Hi, Care with (last (nentselp)), it returns a list of all parents entities from the deeper nested to the outer one, i.e. select a line in a block A nested in block B: (car (nentselp)) returns the line ename (last (nentselp)) returns a list which first item is the line owner (block A) and the second the owner of bloc A (block B). So if you want to get the higher parent entity, you have to use: (last (last (nentselp))) Quote
alanjt Posted November 7, 2009 Posted November 7, 2009 It was a good solution, Alan. I didn't even think of it, I just jumped right into "problem solver" mode. I can only think outside the box when my mind is wandering, it seems. Well, I was playing with ssget last night, so it was fresh in my mind. So, I kinda had a little help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.