f5612140 发表于 2005-3-26 20:57:00

无痕发表于2005-3-26 20:28:00static/image/common/back.gif起点不是可以随便指定的

<BR>老兄,请再看看楼主在3楼的意思

diablo_xie 发表于 2005-3-27 11:35:00

命令bh

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

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

sly 发表于 2005-3-29 08:25:00

能否编个程序?多谢

sly 发表于 2005-3-29 08:28:00

可以编一段改变起点位置的程序吗?

sly 发表于 2005-3-29 08:30:00

可以编一段重新定义起点的程序吗?

diablo_xie 发表于 2005-3-29 09:29:00

<b>(defun c:bh()<BR>;编号高度<BR>(if (null h)<BR>(setq h (getvar "textsize"))<BR>)<BR>(setq input (getreal(strcat"\n\t输入编号高度&lt;" (rtos h) "&gt;")))<BR>(if (/= input nil)<BR>(setq h input)<BR>)<BR>------------------------------------- <BR>(initget "1 2")<BR>(setq key (getkword"\n\t1-正向编号/2-反向编号&lt;1&gt;:"))<BR>(setq s1 (entsel"\n\t选择对象&lt;退出&gt;"))<BR>(setq ent (entget(car s1)))<BR>(redraw (car s1) 3)<BR>(setq pt0 (getpoint "\n选择编号起号位置"))<BR>(setq x (car pt0))<BR>(setq y (cadr pt0))<BR>(redraw (car s1) 4)<BR>(setq n (cdr(assoc 90 ent)))</b>


<b>;正向编号<BR>(if (or (= key 1) (= key nil))<BR>(progn<BR>(command "text" pt0 h "0" 1)<BR>(setq plist (member (list 10 x y) ent))<BR>(SETQ pplist (member(assoc 10 ent) ent))<BR>(setq count 1)<BR>(setq d (cdr plist))<BR>(setq plist (member (assoc 10 d) d))<BR>(while (/= plist nil)<BR>(setq count (1+ count))<BR>(setq pp_t (car plist))<BR>(setq pp (cdr pp_t))<BR>(command "text" pp h "0" (itoa count))<BR>(setq d (cdr plist))<BR>(setq plist (member (assoc 10 d) d))<BR>) <BR>(while (/= pplist nil)<BR>(setq count (1+ count))<BR>(setq pp_t (car pplist))<BR>(setq pp (cdr pp_t))<BR>(setq pp_x (car pp))<BR>(setq pp_y (cadr pp))<BR>(if (and (= pp_x x) (= pp_y y))<BR>(exit)<BR>(progn<BR>(command "text" pp h "0" (itoa count))<BR>(setq d (cdr pplist))<BR>(setq pplist (member (assoc 10 d) d))<BR>);end progn<BR>);end if<BR>);end while<BR>);end progn<BR>;反向编号 <BR>(progn<BR>(command "text" pt0 h "0" (itoa n))<BR>(setq plist (member (list 10 x y) ent))<BR>(SETQ pplist (member(assoc 10 ent) ent))<BR>(setq d (cdr plist))<BR>(setq plist (member (assoc 10 d) d))<BR>(setq n (1- n))<BR>(while (/= plist nil)<BR>(setq pp_t (car plist))<BR>(setq pp (cdr pp_t))<BR>(command "text" pp h "0" (itoa n))<BR>(setq d (cdr plist))<BR>(setq plist (member (assoc 10 d) d))<BR>(setq n (1- n))<BR>)</b>


<b>(while (/= pplist nil)<BR>(setq pp_t (car pplist))<BR>(setq pp (cdr pp_t))<BR>(setq pp_x (car pp))<BR>(setq pp_y (cadr pp))<BR>(if (and (= pp_x x) (= pp_y y))<BR>(exit)<BR>(progn<BR>(command "text" pp h "0" (itoa n))<BR>(setq d (cdr pplist))<BR>(setq pplist (member (assoc 10 d) d))<BR>(setq n (1- n))<BR>);end progn<BR>);end if<BR>);end while<BR>);end progn<BR>);end if<BR>);end defun<BR>(prompt"\n多义线角点自动编号程序,键入:bh执行,程序设计:小谢")<BR>(princ) </b>

【KAIXIN】 发表于 2011-12-11 16:34:01

;线形反向
(defun c:KK()
    (setq ss(ssget) mun 0)
(repeat (sslength ss)
    (setq entl-y (ssname ss mun))
    (command "pedit" entl-y "d" "")
    (setq entl(entget entl-y))
    (if (= "POLYLINE" (cdr(assoc 0 entl))) (command "pedit" entl-y "lt" "on" "x"))
    (if (= 10 (car (nth 13 entl))) (setq nn 13))
    (if (= 10 (car (nth 12 entl))) (setq nn 12))
    (setq lt-name(cdr(assoc 6 entl)) la-name (cdr (assoc 8 entl)))  
    (setq W_list '())
    (setq elem (cdr (nth nn entl)))
    (setq w_list (append w_list (list elem))) 
   (while (not (null elem))         
  (setq nn(+ nn 4))
  (setq elem (cdr (nth nn entl))) 
    (if (= (car (nth nn entl)) 10)
    (setq w_list (append w_list (list elem))) ;构建实体坐标表  
    )
   )
    (setq w_list (reverse w_list))
    (setq pt1 (car W_list))
    (command "pline" pt1)
   (while w_list
    (setq w_list(cdr w_list))
    (setq pt (car w_list))
    (command pt)
   )
    (command "")
    (command "chprop" (entlast) "" "lt" lt-name "la" la-name "")
    (command "pedit" (entlast) "lt" "on" "s" "")
    (command "erase" entl-y "")
    (setq mun (+ mun 1))
)
)

navalarch 发表于 2015-2-22 01:45:24

学习了, 正好遇到困难

壮壮和冷血 发表于 2015-7-14 16:53:56

meflying 发表于 2005-3-25 08:44 static/image/common/back.gif
程序功能:判断是顺时针还是逆时针,如果是顺时针则更改为逆时针。。。REV函数更改顶点顺序,可单独使用。。 ...

你好这个lisp怎么调用呀?在cad里输入ap加载然后输入什么调用呢?谢谢

345862750@qq.co 发表于 2015-11-2 10:54:21

meflying 发表于 2005-3-25 08:44 static/image/common/back.gif
程序功能:判断是顺时针还是逆时针,如果是顺时针则更改为逆时针。。。REV函数更改顶点顺序,可单独使用。。 ...

太棒了,楼主人才
页: 1 [2]
查看完整版本: [求助]如何改变多段线的顶点顺序