Jump to content

LM:burstupgraded pburst -> list, then unburst


Recommended Posts

Posted

Hi guys, is there any way for me to save the (pburst) primary burst selection to a list and then unburst it?

I want to be able to extract something from the nested blocks inside of my dynamic blocks without messing with the dynamic block themselves. 

 

If Lee Mac can answer that would be helpful as well.

Posted

Can you post an example what you are wanting to do?

Posted

In Lee Mac's burst, there's two versions, pburst and nburst, pburst only 'explodes' the dynamic block once to get the subsequent nested blocks and 'preserves' the locations of the blocks. 

Suppose BLOCKA is composed of BLOCKB, BLOCKC, and BLOCKD, (these are the effectivenames), how can I not explode/burst BLOCKA but still get the information of BLOCKB, BLOCKC, and BLOCKD?

PBURST requires a selection and then basically explodes the block and then you can't really put it back together while getting information, even getting the entity names of them would suffice.

I don't really have blocks to work with currently, my job doesn't allow me to share the blocks. I apologize in advance and thanks for the help.

Posted

could be tricky without an image of what needs to be done, what are you trying to extract or copy?

Posted
Just now, Steven P said:

could be tricky without an image of what needs to be done, what are you trying to extract or copy?

just the entity names of the nested blocks to be honest.

Posted

Can you do anything with nentsel ? All I am thinking that bursting the blocks, grabbing the information you want, putting them back together again is a long way around.

 

Would something like this work? Should select something within the the block where the mouse is clicked

 

(defun c:tt ( / MySelection MyEnt)
  (setq MySelection (nentselp "Select"))
  (setq MyEnt (car MySelection))
  (entget MyEnt)
)

 

Posted

Now where is that code get names of nested blocks. It exists.

 

Try this, I forget where I found it, apology to author.

 

(defun BlkNameN
  (/ blksel blkobj)
  (setq
    blksel (nentsel "\nSelect Block or nested Block: ")
    blkobj (vlax-ename->vla-object (car (last blksel)))
  )
  (prompt
    (strcat
      "\nBlock name is: "
      (vlax-get-property blkobj (if (vlax-property-available-p blkobj 'effectivename) 'effectivename 'name))
    )
  )
  (princ)
)

(BlkNameN)

 

  • 2 weeks later...
Posted

so typically I can get the first subentity using:

 

(setq en1 (nentselp (cadr (entsel))))

 

since it uses the insertion point of the (nested) entity and shows the first subentity,

and then using:

 

(setq subent1 (LM:al-effectivename (car (caddr (cdr en1)))))

 

So, I get the first subentity name. Even just getting the (car (caddr (cdr en1))) is also already useful. 

Posted

You can use nentsel directly in place of entsel, rather than performing two selections.

Posted
1 minute ago, Lee Mac said:

You can use nentsel directly in place of entsel, rather than performing two selections.

Yes, I even used nentselp to supply a point instead of a user input. I just wanted to be able to figure out all the entity names of the subentities inside of the block like what you did on Nested Block Counter but I only need the entity names not the effective names.

Posted

If you already know the target block definition, you can obtain the AcDbBlockBegin (BLOCK) entity using tblobjname and then iterate over the component entities using the entnext function until it returns nil (at which point it has reached the AcDbBlockEnd (ENDBLK) entity).

Posted

After a few days of going back and forth with AI, we've come up with a way to list the entity name and translated insertion point of the sub-entities inside a nested block. 

I'm using a function like this:
 

(defun get-block-entity-info (blk / ent lst rot entloc entlistinfo effname) 
  ;; Define the function, declare local variables
  (setq entloc (cdr (assoc 10 (entget blk))))
  (setq rot (cdr (assoc 50 (entget blk))))
  (if  ;; If the following returns a non-nil value
    ;; i.e. if the block exists in the drawing

    (setq ent (tblobjname "block" (cdr (assoc 2 (entget blk))))) ;; get the BLOCK entity
    (while (setq ent (entnext ent)) 
      ;; Step through the entities in the block definition
      (if (= (cdr (assoc 0 (entget ent))) "INSERT") 
        (setq lst (cons ent lst))
        (setq lst lst)
      )
      ;; Construct a list of the block components
    ) ;; end WHILE
  ) ;; end IF

  ;(reverse lst) ;; Return the list
  (setq entlistinfo '())
  (foreach item lst 
    (setq entlistinfo (cons 
                        (list item  ;(LM:al-effectivename item)
                              (mapcar '+ 
                                      (list 
                                        (* 
                                          (distance '(0.0 0.0) 
                                                    (cdr (assoc 10 (entget item)))
                                          )
                                          (cos 
                                            (+ rot 
                                               (angle '(0.0 0.0) 
                                                      (cdr (assoc 10 (entget item)))
                                               )
                                            )
                                          )
                                        )
                                        (* 
                                          (distance '(0.0 0.0) 
                                                    (cdr (assoc 10 (entget item)))
                                          )
                                          (sin 
                                            (+ rot 
                                               (angle '(0.0 0.0) 
                                                      (cdr (assoc 10 (entget item)))
                                               )
                                            )
                                          )
                                        )
                                        0.0
                                      )
                                      entloc
                              )
                        )
                        entlistinfo
                      )
    )
  )
  entlistinfo
) ;; end DEFUN

 

Thanks for the help @Lee Mac

 

I'm basically using this as a data point for annotating the blocks with another massive auto-leader script that I have.

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...