multiple entity instertion routine

Discussion in 'AutoCAD' started by RickNichols, Jul 29, 2003.

  1. RickNichols

    RickNichols Guest

    I am looking for a routine that will allow me to insert multiple autocad points into a drawing at block insertion points by a window method. Does that make sense? Basically I want to insert a bunch of points at the exact location a bunch of blocks were inserted, and I want to do this by selecting these insertion points globally or by a window. I figured that this routine has been done many times by others or should at least be pretty easy to create by someone who knows what they are doing. If there is anyone who can help please let me know. Thanks in advance.

    Rick
     
    RickNichols, Jul 29, 2003
    #1
  2. How about somethin' like this.....

    ; create a point entity on the current layer
    ; at the insertion point of each seleted insert.
    (defun c:insPts (/ ss i)
    (setq ss (ssget '((0 . "INSERT"))))
    (if ss
    (progn
    (setq i -1)
    (repeat (sslength ss)
    (entmake
    (list
    '(0 . "POINT")
    (cons 8 (getvar "clayer"))
    (cons 10 (cdr (assoc 10 (entget (ssname ss (setq i (1+ i)))))))
    )
    )
    )
    )
    )
    (princ)
    )

    --

    -Jason
    Member of the Autodesk Discussion Forum Moderator Program


    drawing at block insertion points by a window method. Does that make sense? Basically I
    want to insert a bunch of points at the exact location a bunch of blocks were inserted,
    and I want to do this by selecting these insertion points globally or by a window. I
    figured that this routine has been done many times by others or should at least be pretty
    easy to create by someone who knows what they are doing. If there is anyone who can help
    please let me know. Thanks in advance.
     
    Jason Piercey, Jul 29, 2003
    #2
  3. ....er how about

    ; create a point entity on the current layer
    ; at the insertion point of each seleted insert.
    (defun c:insPts (/ ss i)
    (setq ss (ssget '((0 . "INSERT"))))
    (if ss
    (progn
    (setq i -1)
    (repeat (sslength ss)
    (entmake
    (list
    '(0 . "POINT")
    (cons 8 (getvar "clayer"))
    (assoc 10 (entget (ssname ss (setq i (1+ i)))))
    )
    )
    )
    )
    )
    (princ)
    )
     
    Jason Piercey, Jul 29, 2003
    #3
  4. RickNichols

    RickNichols Guest

    Thanks Jason. It did just what I wanted. Thanks for sharing your lisp knowledge.

    Rick
     
    RickNichols, Jul 29, 2003
    #4
  5. RickNichols

    RickNichols Guest

    What does this second one do that the first one didn't do?
     
    RickNichols, Jul 29, 2003
    #5
  6. They operate the same, just less code.

    The first one
    (cons 10 (cdr (assoc 10 (entget (ssname ss (setq i (1+ i)))))))

    can be simplified to
    (assoc 10 (entget (ssname ss (setq i (1+ i)))))

    and you are welcome.
     
    Jason Piercey, Jul 29, 2003
    #6
  7. RickNichols

    Rudy Tovar Guest

    hehehe....

    Oh well...

    (defun c:cap (/ ss c)
    (setq ss (ssget "x" '((0 . "insert"))))
    (setq c -1)
    (while
    (entmake
    (list (cons 0 "POINT")
    (cons 10
    (cdr (assoc 10 (entget (ssname ss (setq c (1+ c))))))
    )
    )
    )
    )
    (princ)
    )

    --
    Rodolfo Tovar
    www.Cadentity.com
    AUTODESK
    Authorized Developer
    MASi
    Express U.........s...and then some...
    Version 2.01
    6 yrs Time Tested and it Works....
    Coming Soon.....
     
    Rudy Tovar, Jul 29, 2003
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.