| 首先,感谢您对理解代码的兴趣和明显的努力! 
 对您的评论的一些评论:
 
 
 ; [color="red"]I added a command line call c:orth-lwp in the updated version[/color](defun ortholst (pl / xvals yvals xeq yeq) ;defines the subroutine ortholst,      ; [color="red"]declares the aurgment pl[/color]     ; d[color="red"]efines variables xvals yvals xeq and yeq as local to this function only[/color]  (setq xvals (mapcar 'car pl) ; sets the variable xvals as a [color="red"]list of [/color]real numbers extracted from the first [color="red"]atom[/color] of the list pl          yvals (mapcar 'cadr pl) ; sets the variable yvals as a [color="red"]list of[/color] real numbers extracted from the second [color="red"]atom[/color] of the list pl       xeq (apply '= xvals)       yeq (apply '= yvals)) ; tests xvals and yvals atoms for all equivalency, thus xeq and yeq [color="red"]are bound to T / nil[/color]; [color="red"]here is where the problem may be   The = call returns T ONLY if all of the atom are exactly equal.  ; Point values are stored as REAL numbers and autocad uses 15 significant digits.; If all of the the points are not exactly equal, then it will reurn nil  [/color] (or xeq yeq)) ;[color="red"]if either the x or y coordinates are equal then return T else nil[/color] (and (setq i -1  ;and, [color="red"]evaluate all expressions until a nil return is encountered[/color]; what are all the 'and' comparisons[color="red"]; the color helps here. All of the magenta tests in the original ( blue in the updated ) post are evaluated; the last call will return nil either way, but it dosen't matter as it is the last espression [/color], and we are still under the 'or' xeq yeq comparison for true condition aren't we? [color="red"]No[/color]         cs (ssadd) ;[color="red"]create an empty PICKSET named cs ( ChangeSet )[/color]         ss (ssget '((0 . "X" LWPOLYLINE")))) ; [color="red"]Create a PICKSET named ss of all LWPOLYLINEs in the drawing [/color]    (while (setq en (ssname ss (setq i (1+ i)))) ;looping through a PICKESET           (setq ed (entget en)  ; [color="red"]Get the entity definition[/color]                 pl (massoc 10 ed)) ; [color="red"]extract all group 10 point values from the entity definition[/color]           (cond ((ortholst pl)) ; [color="red"]Conditional test : If the subroutine othro_test returns T, Then do nothing [/color]                 (T (ssadd en cs)))) ; [color="red"]Elseif, then add the entity to the change set cs[/color]    (if cs (command "_.CHPROP" cs "" "_C" 1 ""))) ; [color="red"]if the changes set is bound to a value, then issue the CHPROP command[/color] ; [color="red"]I changed this test to test if the length of  set is greater than 0 for clarity[/color]
 
更新的例程:
 
 
 [b][color=BLACK]([/color][/b]defun c:orth-lwp [b][color=FUCHSIA]([/color][/b]/ i cs ss en ed pl[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]defun massoc [b][color=NAVY]([/color][/b]key alist / nlist[b][color=NAVY])[/color][/b]   [b][color=NAVY]([/color][/b]foreach x alist     [b][color=MAROON]([/color][/b]if [b][color=GREEN]([/color][/b]eq key [b][color=BLUE]([/color][/b]car x[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]         [b][color=GREEN]([/color][/b]setq nlist [b][color=BLUE]([/color][/b]cons [b][color=RED]([/color][/b]cdr x[b][color=RED])[/color][/b] nlist[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]   [b][color=NAVY]([/color][/b]reverse nlist[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]defun ortholst [b][color=NAVY]([/color][/b]pl / xvals yvals xeq yeq[b][color=NAVY])[/color][/b]   [b][color=NAVY]([/color][/b]setq xvals [b][color=MAROON]([/color][/b]mapcar 'car pl[b][color=MAROON])[/color][/b]         yvals [b][color=MAROON]([/color][/b]mapcar 'cadr pl[b][color=MAROON])[/color][/b]         xeq [b][color=MAROON]([/color][/b]apply '= xvals[b][color=MAROON])[/color][/b]         yeq [b][color=MAROON]([/color][/b]apply '= yvals[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]   [b][color=NAVY]([/color][/b]or xeq yeq[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq i -1           cs [b][color=MAROON]([/color][/b]ssadd[b][color=MAROON])[/color][/b]           ss [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"X"[/color] '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"LWPOLYLINE"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]      [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss [b][color=BLUE]([/color][/b]setq i [b][color=RED]([/color][/b]1+ i[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]             [b][color=MAROON]([/color][/b]setq ed [b][color=GREEN]([/color][/b]entget en[b][color=GREEN])[/color][/b]                   pl [b][color=GREEN]([/color][/b]massoc 10 ed[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]             [b][color=MAROON]([/color][/b]cond [b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]ortholst pl[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]                   [b][color=GREEN]([/color][/b]T [b][color=BLUE]([/color][/b]ssadd en cs[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]      [b][color=NAVY]([/color][/b]if [b][color=MAROON]([/color][/b]> [b][color=GREEN]([/color][/b]sslength cs[b][color=GREEN])[/color][/b] 0[b][color=MAROON])[/color][/b]          [b][color=MAROON]([/color][/b]command [color=#2f4f4f]"_.CHPROP"[/color] cs [color=#2f4f4f]""[/color] [color=#2f4f4f]"_C"[/color] 1 [color=#2f4f4f]""[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]
 
我的测试台dwg文件已附上。
  
我希望这有帮助。随时欢迎回到低谷-大卫
  
顺便说一句,你是在测试一个向量样条线,而不是一个矩形???主要区别:冲击:
  
PS PS看起来你精通一门计算机语言,顺便说一句,在Autolisp中,我们没有错。在大多数语言中,FALSE不是TRUE。我们有零,这是一个空列表。 
所有这些都返回T:
 (equal nil '())(eq nil '())(= nil '())(not nil)(null nil)(listp nil)
 
测验图纸 |