Jump to content

Recommended Posts

Posted

 
(defun C:cb ()
 (setq blkent (car (entsel "Select block to Copy: "))
lstent (entget blkent))
 (setq ptcpy (getpoint "Enter Point to copy: "))
 (setq ptcpy (cons '10 ptcpy))
 (setq lstnewent lstent)
 (setq lstnewent (subst ptcpy (assoc 10 lstent) lstnewent))
 (entmake (list (assoc 0 lstnewent)
  (assoc 8 lstnewent)
  (assoc 2 lstnewent)
  (assoc 10 lstnewent)
  (assoc 41 lstnewent)
  (assoc 42 lstnewent)
  (assoc 43 lstnewent)
  (assoc 50 lstnewent)
  ))
 )

 

I am trying to copy a block and still be able to edit the attribute (attached is a block). I can currently copy a block; but then when I try running the eattedit command I get the following: "That block has no editable attributes." I think it may have something to do with the entity group code 330; but I cannot be certain.

 

I know there is the copy function; but I am trying to do other things to this block once it is copied.

 

Does anyone have any advice?

FLAG.dwg

Posted

Have you tried exploding after you have inserted?

You may have a block-within-a-block situation.

Posted

I know it's VLA, but does this help?

(defun c:CB (/ #Block #Point)
 (vl-load-com)
 (and (setq #Block (car (entsel "\nSelect block to copy: ")))
      (eq "INSERT" (cdr (assoc 0 (entget #Block))))
      (setq #Point (getpoint "\nSpecify placement point: "))
      (setq #Block (vla-copy (vlax-ename->vla-object #Block)))
      (vla-move #Block
                (vla-get-insertionpoint #Block)
                (vlax-3d-point (trans #Point 0 1))
      ) ;_ vla-move
 ) ;_ and
 (princ)
) ;_ defun

Posted

Make sure you add the sequential flag (66 . 1) to the INSERT data to have access to the ATTRIButes. Then you must add the ATTRIB entity definitions. Then you must add a ENDBLK entity. Not the cleanest way to make an INSERT but it is what it takes via entmake. -David

Posted

Thanks for the help, everyone. After all the comments I think I might go with the VLA code since it seems to be the simpliest. Although, I have to say out of all the code used in AutoCAD, VLA is currently the one my mind has the hardest time thinking of.

 

It also sounds like the entmake command might really just be useful for the basic entities in LISP (i.e. line, polylines, circle, arcs)

 

Thanks again.

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