stevesfr 发表于 2022-7-6 08:22:03

Lee, thanks for the *tutor*ing !
Steve

Lee Mac 发表于 2022-7-6 08:25:13

You're welcome Steve, anytime.

jake77777 发表于 2022-7-6 08:33:09

I cannot get enough of this lisp!   Just curious.As the code is..itimports a block to the endpoints only w/o adding the block to theendpoints of the lines within plines..Is it possible to have the blockimport to the points within a selected group of plines?..or even more,just these points and excluding the endpoints? My first amateur move wasto add pline to the snippet   

( (not (setq ss (ssget '((0 . "ARC,CIRCLE,ELLIPSE,SPLINE,PLINE,LINE,LWPOLYLINE,")))))
That did not do it    I had come across a similar code using nodeinsert below, but thinking of all the snap settings don't know howsomething like that is possible..Any advice?
 
 
Sorry I couldn't find the author to give credit to on this..

;;;--- Insert a block on every node found in a drawing(defun C:NODESERT() (setvar "cmdecho" 0) (setq oldSnap(getvar "osmode")) (setvar "osmode" 0) (setq blkName(getstring T "\n Block name: ")) (setq ang(getangle "\n Rotation angle: ")) (setq scalef(getreal "\n Scale factor: ")) (if(setq eset(ssget "X" (list(cons 0 "POINT"))))   (progn   (setq cntr 0)   (while(< cntr (sslength eset))       (setq en(ssname eset cntr))       (setq enlist(entget en))       (setq pt(cdr(assoc 10 enlist)))       (command "-insert" blkName pt scalef scalef (angtos ang))       (setq cntr(+ cntr 1))   )   (alert (strcat "\n Inserted " (itoa(- cntr 1)) " blocks!"))   )   (alert "No nodes found!") ) (setvar "osmode" oldSnap) (setvar "cmdecho" 1) (princ)
This is Lee's fine piece of work I'm using from page 1 of post...

;;---------------------=={ EndBlock }==-----------------------;;;;                                                            ;;;;Inserts a Block at the end points of selected objects   ;;;;------------------------------------------------------------;;;;Author: Lee McDonnell, 2010                               ;;;;                                                            ;;;;Copyright © 2010 by Lee McDonnell, All Rights Reserved.   ;;;;Contact: Lee Mac @ TheSwamp.org, CADTutor.net             ;;;;------------------------------------------------------------;;(defun c:EndBlock ( / *error* _StartUndo _EndUndo _Insert _AngleAtParam doc block ss ) (vl-load-com) ;; © Lee Mac 2010 (setq block "endtick.dwg") ;;

Lee Mac 发表于 2022-7-6 08:33:35

As a reference to others, this thread continues here:
 
http://www.cadtutor.net/forum/showthread.php?52992-Auto-insert-blocks-on-pline-points-possible
 
FYI: The Polyline object is already included in the selectionset filter: 'LWPOLYLINE' - Polylines are not called 'PLINES'.
 
The SelectionSet filter utilises the same data as can be found when querying an entity using entget, hence to check the entity name, use something like:
 

(defun c:EName ( / e ) (while (setq e (car (entsel "\nSelect Entity: ")))   (print (cdr (assoc 0 (entget e)))) ) (princ))

asos2000 发表于 2022-7-6 08:38:58

This lisp not working with REGION
Could you please modify to deal with region
页: 1 [2]
查看完整版本: 在端点处自动插入块