明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: sly

[求助]如何改变多段线的顶点顺序

  [复制链接]
发表于 2005-3-26 20:57:00 | 显示全部楼层
无痕发表于2005-3-26 20:28:00起点不是可以随便指定的

老兄,请再看看楼主在3楼的意思
发表于 2005-3-27 11:35:00 | 显示全部楼层

命令bh

本帖最后由 作者 于 2005-3-27 16:03:40 编辑

自已写了一个支持正向、反向、任意起点楼主你试试:命令bh

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
 楼主| 发表于 2005-3-29 08:25:00 | 显示全部楼层
能否编个程序?多谢
 楼主| 发表于 2005-3-29 08:28:00 | 显示全部楼层
可以编一段改变起点位置的程序吗?
 楼主| 发表于 2005-3-29 08:30:00 | 显示全部楼层
可以编一段重新定义起点的程序吗?
发表于 2005-3-29 09:29:00 | 显示全部楼层
(defun c:bh()
;编号高度
(if (null h)
(setq h (getvar "textsize"))
)
(setq input (getreal(strcat"\n\t输入编号高度<" (rtos h) ">")))
(if (/= input nil)
(setq h input)
)
-------------------------------------
(initget "1 2")
(setq key (getkword"\n\t1-正向编号/2-反向编号<1>:"))
(setq s1 (entsel"\n\t选择对象<退出>"))
(setq ent (entget(car s1)))
(redraw (car s1) 3)
(setq pt0 (getpoint "\n选择编号起号位置"))
(setq x (car pt0))
(setq y (cadr pt0))
(redraw (car s1) 4)
(setq n (cdr(assoc 90 ent)))
;正向编号
(if (or (= key 1) (= key nil))
(progn
(command "text" pt0 h "0" 1)
(setq plist (member (list 10 x y) ent))
(SETQ pplist (member(assoc 10 ent) ent))
(setq count 1)
(setq d (cdr plist))
(setq plist (member (assoc 10 d) d))
(while (/= plist nil)
(setq count (1+ count))
(setq pp_t (car plist))
(setq pp (cdr pp_t))
(command "text" pp h "0" (itoa count))
(setq d (cdr plist))
(setq plist (member (assoc 10 d) d))
)
(while (/= pplist nil)
(setq count (1+ count))
(setq pp_t (car pplist))
(setq pp (cdr pp_t))
(setq pp_x (car pp))
(setq pp_y (cadr pp))
(if (and (= pp_x x) (= pp_y y))
(exit)
(progn
(command "text" pp h "0" (itoa count))
(setq d (cdr pplist))
(setq pplist (member (assoc 10 d) d))
);end progn
);end if
);end while
);end progn
;反向编号
(progn
(command "text" pt0 h "0" (itoa n))
(setq plist (member (list 10 x y) ent))
(SETQ pplist (member(assoc 10 ent) ent))
(setq d (cdr plist))
(setq plist (member (assoc 10 d) d))
(setq n (1- n))
(while (/= plist nil)
(setq pp_t (car plist))
(setq pp (cdr pp_t))
(command "text" pp h "0" (itoa n))
(setq d (cdr plist))
(setq plist (member (assoc 10 d) d))
(setq n (1- n))
)
(while (/= pplist nil)
(setq pp_t (car pplist))
(setq pp (cdr pp_t))
(setq pp_x (car pp))
(setq pp_y (cadr pp))
(if (and (= pp_x x) (= pp_y y))
(exit)
(progn
(command "text" pp h "0" (itoa n))
(setq d (cdr pplist))
(setq pplist (member (assoc 10 d) d))
(setq n (1- n))
);end progn
);end if
);end while
);end progn
);end if
);end defun
(prompt"\n多义线角点自动编号程序,键入:bh执行,程序设计:小谢")
(princ)
发表于 2011-12-11 16:34:01 | 显示全部楼层
  1. ;线形反向
  2. (defun c:KK()
  3.     (setq ss(ssget) mun 0)
  4. (repeat (sslength ss)
  5.     (setq entl-y (ssname ss mun))
  6.     (command "pedit" entl-y "d" "")
  7.     (setq entl(entget entl-y))
  8.     (if (= "POLYLINE" (cdr(assoc 0 entl))) (command "pedit" entl-y "lt" "on" "x"))
  9.     (if (= 10 (car (nth 13 entl))) (setq nn 13))
  10.     (if (= 10 (car (nth 12 entl))) (setq nn 12))
  11.     (setq lt-name(cdr(assoc 6 entl)) la-name (cdr (assoc 8 entl)))  
  12.     (setq W_list '())
  13.     (setq elem (cdr (nth nn entl)))
  14.     (setq w_list (append w_list (list elem))) 
  15.    (while (not (null elem))         
  16.   (setq nn(+ nn 4))
  17.   (setq elem (cdr (nth nn entl))) 
  18.     (if (= (car (nth nn entl)) 10)
  19.     (setq w_list (append w_list (list elem))) ;构建实体坐标表  
  20.     )
  21.    )
  22.     (setq w_list (reverse w_list))
  23.     (setq pt1 (car W_list))
  24.     (command "pline" pt1)
  25.    (while w_list
  26.     (setq w_list(cdr w_list))
  27.     (setq pt (car w_list))
  28.     (command pt)
  29.    )
  30.     (command "")
  31.     (command "chprop" (entlast) "" "lt" lt-name "la" la-name "")
  32.     (command "pedit" (entlast) "lt" "on" "s" "")
  33.     (command "erase" entl-y "")
  34.     (setq mun (+ mun 1))
  35. )
  36. )
发表于 2015-2-22 01:45:24 | 显示全部楼层
学习了, 正好遇到困难
发表于 2015-7-14 16:53:56 | 显示全部楼层
meflying 发表于 2005-3-25 08:44
程序功能:判断是顺时针还是逆时针,如果是顺时针则更改为逆时针。。。REV函数更改顶点顺序,可单独使用。。 ...

你好  这个lisp怎么调用呀?在cad里输入ap加载  然后输入什么调用呢?谢谢
发表于 2015-11-2 10:54:21 | 显示全部楼层
meflying 发表于 2005-3-25 08:44
程序功能:判断是顺时针还是逆时针,如果是顺时针则更改为逆时针。。。REV函数更改顶点顺序,可单独使用。。 ...

太棒了,楼主人才
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-21 05:01 , Processed in 0.202667 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表