乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: jake77777

[编程交流] 在端点处自动插入块

[复制链接]

6

主题

249

帖子

247

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-6 08:22:03 | 显示全部楼层
Lee, thanks for the *tutor*ing !
Steve
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 08:25:13 | 显示全部楼层
You're welcome Steve, anytime.
回复

使用道具 举报

13

主题

61

帖子

48

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
65
发表于 2022-7-6 08:33:09 | 显示全部楼层
I cannot get enough of this lisp!   Just curious.  As the code is..it  imports a block to the endpoints only w/o adding the block to the  endpoints of the lines within plines..Is it possible to have the block  import to the points within a selected group of plines?..or even more,  just these points and excluding the endpoints? My first amateur move was  to add pline to the snippet     
  1. ( (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 node  insert below, but thinking of all the snap settings don't know how  something like that is possible..Any advice?
 
 
Sorry I couldn't find the author to give credit to on this..
  1. ;;;--- 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...

[code] ;;---------------------=={ 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") ;;
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 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:
 
  1. (defun c:EName ( / e ) (while (setq e (car (entsel "\nSelect Entity: ")))   (print (cdr (assoc 0 (entget e)))) ) (princ))
回复

使用道具 举报

51

主题

481

帖子

457

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
262
发表于 2022-7-6 08:38:58 | 显示全部楼层
This lisp not working with REGION
Could you please modify to deal with region
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 05:01 , Processed in 0.455420 second(s), 60 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表