Jump to content

Quick way to access to the nested level outside of a specific block?


Recommended Posts

Posted

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

Posted
Have you looked into nentsel?

Hippe013 sir. Me & my mate still green in lisp. :oops:

Posted

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.

Posted
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 :sweat:

Posted
(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)
)

Posted

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

Posted

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

Posted
..I indicated the block name in the LISP as such...

 

:lol: 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] :

Posted

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

EDIT THIS BLOCK.jpg

HOW TO ACCESS THE NESTED BLOCK PART 2.dwg

  • 2 weeks later...
Posted

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?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...