1. ;;说明:多段线顶点更新
    2. ;;参数:dxflst:多段线全部组码表
    3. ;;参数:ptlst:新点坐标表
    4. ;;返回:更新后的组码表
    5. (defun updatePolyline(dxflst newptlst / a b newdxflst)
    6. (while (and (setq a (car dxflst)) (setq b (car newptlst)))
    7. (if (= (car a) 10)
    8. (setq
    9. newdxflst (cons (cons 10 b) newdxflst)
    10. newptlst (cdr newptlst)
    11. )
    12. (setq newdxflst b)
    13. )
    14. (setq dxflst (cdr dxflst))
    15. )
    16. (reverse newdxflst)
    17. )
    18. ;;说明:多段线顶点更新
    19. ;;参数:dxflst:多段线全部组码表
    20. ;;参数:newptlst:新顶点坐标表
    21. ;;参数:ptidxlst:顶点索引表,从1开始
    22. ;;参数:isupdata:T:索引更新;nil:排除索引更新
    23. ;;返回:更新后的组码表
    24. (defun updatePolyline1(dxflst newptlst ptidxlst isupdata / a b i newdxflst)
    25. (setq i 1 newdxflst '())
    26. (while (and (setq a (car dxflst)) (setq b (car newptlst)))
    27. (if (= (car a) 10)
    28. (setq
    29. newdxflst (if isupdata
    30. (if (vl-position i ptidxlst)
    31. (cons (cons 10 b) newdxflst)
    32. (cons a newdxflst)
    33. )
    34. (if (vl-position i ptidxlst)
    35. (cons a newdxflst)
    36. (cons (cons 10 b) newdxflst)
    37. )
    38. )
    39. newptlst (cdr newptlst)
    40. i (1+ i)
    41. )
    42. (setq newdxflst (cons a newdxflst))
    43. )
    44. (setq dxflst (cdr dxflst))
    45. )
    46. (reverse newdxflst)
    47. )
    48. (defun updatePolyline2(dxflst n pt / i newdxflst a )
    49. (setq i 1 newdxflst '())
    50. (while(setq a (car dxflst))
    51. (if (= (car a) 10)
    52. (progn
    53. (if (= i n) (setq a (cons 10 pt)))
    54. (setq i (1+ i))
    55. )
    56. )
    57. (setq newdxflst (cons a newdxflst))
    58. (setq dxflst (cdr dxflst))
    59. )
    60. (reverse newdxflst)
    61. )
    62. (defun updatePolyline3(dxflst p1 p2 p3 / i newdxflst a )
    63. (setq i 1 newdxflst '())
    64. (while(setq a (car dxflst))
    65. (if (= (car a) 10)
    66. (progn
    67. (cond
    68. ((= i 1) (setq a (cons 10 p1)))
    69. ((= i 2) (setq a (cons 10 p2)))
    70. ((= i 3) (setq a (cons 10 p3)))
    71. )
    72. (setq i (1+ i))
    73. )
    74. )
    75. (setq newdxflst (cons a newdxflst))
    76. (setq dxflst (cdr dxflst))
    77. )
    78. (reverse newdxflst)
    79. )