Jump to content

Finding a blocks insertion point and inserting a another block in the same spot.


Recommended Posts

Posted

Hiya gang,

 

I've been messing around with this routine, trying to get it to place a point at the insertion poiutn of ALL selected blocks.

 

I've got this far, but it's only placing one point on one of the selected blocks...

 

(defun c:inspoint  (/ ss)
 (if (and (setq ss (ssget '((0 . "INSERT")))))
   (command "point"
            (cdr (assoc 10 (entget (ssname ss 0)))))
 )
 (princ))

 

Any help is as always, much appreciated.

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

  • elfert

    11

  • BlackBox

    5

  • stevesfr

    2

  • jpcadconsulting

    2

Posted

You're only getting the first item in the selection set (ssname ss 0) ? You have to iterate the selection and place a point at each instance. IMO it would be better to use entmake for the point too.

 

Quick example:

(defun c:inspoint (/ ss)
 ;; RJP - 11.29.2017
 ;; Get selection
 (if (setq ss (ssget '((0 . "INSERT"))))
   ;; Convert to a list of enames (vl-remove-if 'listp .. then iterate list (foreach b ..
   (foreach b (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
     ;; Entmake a point on layer 'point' at insertion of block
     (entmakex (list '(0 . "point") '(8 . "point") (assoc 10 (entget b))))
   )
 )
 ;; Shhhhh
 (princ)
)

Posted

Brilliant! I knew that was the issue, just not sure how to do anything about it. ;-)

 

Thanks!

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