ctrlaltdel Posted August 17, 2016 Posted August 17, 2016 Can someone please advise a quick way on how to access to the nested level (refedit/block in-place) outside of a specific block? As an example, attached is a drawing that simulate the difficulty of accessing a nested block just outside a specific block. Referring to the attached drawing, how to access to the nested level (refedit/block in-place) just outside the block of the RECTANGLE? Thanks HOW TO ACCESS THE NESTED BLOCK.dwg Quote
ctrlaltdel Posted August 18, 2016 Author Posted August 18, 2016 Have you looked into nentsel? Hippe013 sir. Me & my mate still green in lisp. Quote
Roy_043 Posted August 18, 2016 Posted August 18, 2016 The OP has posted the same problem here: https://www.theswamp.org/index.php?topic=51852.0 Quote
ctrlaltdel Posted August 18, 2016 Author Posted August 18, 2016 The OP has posted the same problem here:https://www.theswamp.org/index.php?topic=51852.0 Hi. I was the poster there but no response regarding access the nested block. Quote
Roy_043 Posted August 18, 2016 Posted August 18, 2016 For 'normal' blocks the standard _REFEDIT command works well. Depending on which nested element you select the dialog suggests a nesting level. But your drawing contains a block that is rather unique and, judging by the complex nesting and block names, has probably been created programmatically. To add to the difficulty it is inserted at a point with huge coordinates. It seems unlikely that this a realistic scenario. Regarding the double posting: I think Hippe013 would have liked to know about your other post before making his contribution here. Quote
ctrlaltdel Posted August 18, 2016 Author Posted August 18, 2016 For 'normal' blocks the standard _REFEDIT command works well. Depending on which nested element you select the dialog suggests a nesting level. But your drawing contains a block that is rather unique and, judging by the complex nesting and block names, has probably been created programmatically. To add to the difficulty it is inserted at a point with huge coordinates.It seems unlikely that this a realistic scenario. Regarding the double posting: I think Hippe013 would have liked to know about your other post before making his contribution here. Sir, the drawing is not a drawing I work with but just an example to show: - the numbers of blocks I deal with in a drawing - the many nested levels deep - the long files names (the one is the example is gibberish. It is to showthat most of the blocks have very long names) All this making getting into the nested block level outside of a specific block extremely difficult if not impossible. Cadders. Please try out the drawing & share your quick method to access the nested level just outside that specific block. I go through 50 such cases of blocks per drawing & it is not fun at all. I sweat every time I face the devil of such blocks Quote
pBe Posted August 18, 2016 Posted August 18, 2016 (defun c:notdb (/ adoc nb ent entV) ;<-- Name of the deepest block (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (setq nb (car (nentselp))) (setq ent (entget nb)) (setq entV (vla-ObjectIdToObject aDoc (vla-get-OwnerId (vlax-ename->vla-object nb) ) ) ) ;;; To go directly to editing the block ;;; (command "_bedit" (Vla-get-name entV)) (princ) ) Quote
ctrlaltdel Posted August 18, 2016 Author Posted August 18, 2016 pBe sir, Thank you are looking into it. I indicated the block name in the LISP as such (defun c:notdb (/ adoc nb ent entV)[b]klmgagidgiASDFJNSAASDFJKASNDLFVASD LFDSAHFSDFVANDGNAQ-!_MyBlock76fafkljgb asrfgquyrwegf wqeiugf[/b] ;<-- Name of the deepest block (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (setq nb (car (nentselp))) (setq ent (entget nb)) (setq entV (vla-ObjectIdToObject aDoc (vla-get-OwnerId (vlax-ename->vla-object nb) ) ) ) ;;; To go directly to editing the block ;;; (command "_bedit" (Vla-get-name entV)) (princ) ) However when run the lisp, it asked to select an object & when click, it just take me directly into that block I click. Reference to the previous example drawing, What I require is: I need to go 1 block level just outside the block I click, which in this example case, is the rectangle block. So based on the drawing example BLOCK NAME OF RECTANGLE fadsfklmgagidgiASDFJNSAASDFJKASNDLFVASD LFDSAHFSDFVANDGNAQ-!_MyBlock140JFDKBSLJDFB SLDFGS EFGSEFULSGFFfafkljgb asrfgquyrwegf wqeiugf BLOCK NAME CONTAINING THE RECTANGLE BLOCK klmgagidgiASDFJNSAASDFJKASNDLFVASD LFDSAHFSDFVANDGNAQ-!_MyBlock76fafkljgb asrfgquyrwegf wqeiugf When LISP is run, it should take me to block "klmgagidgiASDFJNSAASDFJKASNDLFVASD LFDSAHFSDFVANDGNAQ-!_MyBlock76fafkljgb asrfgquyrwegf wqeiugf" instead of the rectangle block. Also the block level I need to get into, just outside the block I click, have different block names. So preferably, a LISP where I click, it will get into the block level just outside the block I click. Thanks Quote
ctrlaltdel Posted August 20, 2016 Author Posted August 20, 2016 Another way of explanation Block 1 (Outer most block) When run the lisp, cadder will select a nested entity (which happens to be Block 6) & lisp will bring the cadder to Block 5 in the Block In-Place command. Cheers Quote
pBe Posted August 20, 2016 Posted August 20, 2016 ..I indicated the block name in the LISP as such... Dont mean to mislead you but I guess you are referring to this.. (defun c:notdb (/ adoc nb ent entV) ;.... c:notdb Name Of The Deepest Block ...Also the block level I need to get into, just outside the block I click, have different block names. So preferably, a LISP where I click, it will get into the block level just outside the block I click.... ...cadder will select a nested entity (which happens to be Block 6) & lisp will bring the cadder to Block 5.... I still don't understand, I've given you a code as a starting point, reason why, we here are having a hard time understanding what you need. Following your reasoning, why not just select the other nested block then? Like what other forum members suggested, -refedit command will be enough. Command: -REFEDIT Select reference: Select nesting level [Ok/Next] : Quote
ctrlaltdel Posted August 20, 2016 Author Posted August 20, 2016 pBe Sir, I amended the code but when LISP loaded error came out (defun c:klmgagidgiASDFJNSAASDFJKASNDLFVASD LFDSAHFSDFVANDGNAQ-!_MyBlock76fafkljgb asrfgquyrwegf wqeiugf (/ adoc nb ent entV);<-- Name of the deepest block Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).Converting (command) calls to (command-s) is recommended. Anyway my last try to explain what my work entails Attached is a simplified drawing. All are blocks. The 4 square share the same block name but are nested in different block. I need to - get into the correct block level - explode lower right square block - move the lower right side square just below the upper right square - delete the lower entity of the square as per in the photo *All blocks still need to remain as per their original block integrity except 1 of the square block that was exploded I have tried -refedit in the above drawing for at least 30 minutes but still unable to go to the right block level to do the above. That is why I would be glad for a LISP that can get me straight into the correct block level. Thanks HOW TO ACCESS THE NESTED BLOCK PART 2.dwg Quote
Lee Mac Posted August 20, 2016 Posted August 20, 2016 See: https://www.theswamp.org/index.php?topic=51887.msg569257#msg569257 Quote
ctrlaltdel Posted August 20, 2016 Author Posted August 20, 2016 See: https://www.theswamp.org/index.php?topic=51887.msg569257#msg569257 Thanks Lee Mac. Close but I need to be in the "Block in-place"/refedit edit mode cause I need to see All the other block as a reference for me. I hope you know what I am getting at & have a solution? Crossing Fingers. Quote
ctrlaltdel Posted September 2, 2016 Author Posted September 2, 2016 I amended the code in this manner (defun c:myblockedit ( / lst ) (if (setq lst (cadddr (nentsel))) (command "[b]_.refedit[/b]" (cdr (assoc 2 (entget (cond ((cadr lst)) ((car lst))))))) ) (princ) ) But encounter this error after clicking the entity Command: MYBLOCKEDIT Select object: _.refedit Select reference: 5 Reference not found How to make it work correctly? 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.