乐筑天下

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

[编程交流] Autocad应用程序:对象Wa

[复制链接]

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 08:49:45 | 显示全部楼层 |阅读模式
大家好,
 
我刚刚完成了LISP的编写,如下所示,目前正在测试它。
 
我不断收到一条脾气不好的错误消息,有时会显示出来,有时LISP会成功完成。
 
但我一辈子都搞不清楚有时出了什么问题。
 
非常感谢您的帮助,谢谢您抽出时间。
 
  1. ;;;================= AreaDiv.lsp =================
  2. ;;;
  3. ;;; FUNCTION: AD (Area Division)
  4. ;;;
  5. ;;; Will Divide a Selected LWPolyline into
  6. ;;; a specified Area and remainder.
  7. ;;;
  8. ;;; AUTHOR:
  9. ;;; Copyright (C) 2009 Lee McDonnell
  10. ;;;  (Contact Lee Mac, CADTutor.net)
  11. ;;;
  12. ;;; PLATFORMS:
  13. ;;; No Restrictions, only tested on ACAD2004
  14. ;;;
  15. ;;; VERSION:
  16. ;;; 1.0   ~   29.03.2009
  17. ;;;
  18. ;;;===============================================
  19. (defun c:AD (/ *error* ovar vlst doc spc ODel Acc ACol BCol 2Area
  20.           Txt tAcc tHt TCol Ent cEnt cPt cAng p@sel cLen mArea
  21.           ePara Paralst rArea pArea pInc i vPt tLine iArr iLst
  22.           ptLst pLst sPara vpLst vPts tPoly 2vPts 2tPoly
  23.           RLst ObjArr ObjReg rCentr tBoxes mOvPt txtObj AreaLst)
  24. ; === Adjustments ===
  25. (setq ODel nil)    ;  Delete Original LWPolyline (T = Del)
  26. (setq Acc 5.0)  ;  Accuracy of Area Retrieval (Tolerance)
  27. (setq ACol 3)    ;  Colour of Desired Region (0-255)
  28. (setq BCol 4)    ;  Colour of Second Region (if 2Area = T)
  29. (setq 2Area T)   ;  Secondary Marked Area (T or nil)
  30. (setq Txt T)     ;  Area Text in Regions (T or nil)
  31. (setq tAcc 2)    ;  Area Text Precision (if Txt = T)
  32. (setq tHt 2.5)   ;  Area Text Height (if Txt = T, 0.0 for Default)
  33. (setq TCol 2)    ;  Area Text Colour (if Txt = T)
  34. ; ===================
  35. ; === Error Prevention ===
  36. (or (< 0.0 Acc) (setq Acc 10.0))
  37. (or (and (eq 'INT (type ACol)) (<= 0 ACol 255)) (setq ACol 3))
  38. (or (and (eq 'INT (type ACol)) (<= 0 BCol 255)) (setq BCol 4))
  39. (or (and (eq 'INT (type tAcc)) (<= 0 tAcc))     (setq tAcc 2))
  40. (or (and (eq 'INT (type TCol)) (<= 0 TCol 255)) (setq TCol 2))
  41. (or (< 0.0 tHt) (setq tHt (getvar "TEXTSIZE")))
  42. (defun *error* (msg)
  43.    (if ovar (mapcar 'setvar vlst ovar))
  44.    (if (not (member msg '("Function cancelled" "quit / exit abort")))
  45.      (princ (strcat "\nError: " (strcase msg))))
  46.    (princ))
  47. ; ========================
  48. (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object))
  49.        spc (if (zerop (vla-get-activespace doc))
  50.              (if (= (vla-get-mspace doc) :vlax-true)
  51.                (vla-get-modelspace doc)
  52.                (vla-get-paperspace doc))
  53.              (vla-get-modelspace doc)))
  54. (setq vlst '("OSMODE")
  55.    ovar (mapcar 'getvar vlst))
  56. (mapcar 'setvar vlst '(0))
  57. (if (and (setq Ent (entsel "\nSelect LWPolyline: "))
  58.       (eq "LWPOLYLINE" (cdr (assoc 0 (entget (car Ent))))))
  59.    (progn
  60.      (setq cEnt (vlax-ename->vla-object (car Ent))
  61.        cPt (vlax-curve-getClosestPointto cEnt (cadr Ent) acExtendNone)
  62.        cAng (angle '(0 0 0) (vlax-curve-getFirstDeriv cEnt
  63.                   (vlax-curve-getParamatPoint cEnt cPt)))
  64.        p@sel (vlax-curve-getParamAtPoint cEnt cPt)
  65.        cLen (- (vlax-curve-getDistatParam cEnt (fix p@sel))
  66.            (vlax-curve-getDistatParam cEnt (1+ (fix p@sel)))))
  67.      (if (eq :vlax-false (vla-get-Closed cEnt))
  68.    (progn
  69.      (initget "Yes No")
  70.      (if (eq "Yes" (getkword "\nPolyline Not Closed, Close it?  "))
  71.        (vla-put-Closed cEnt :vlax-true))))
  72.      (setq mArea (vla-get-Area cEnt) ePara (1+ (vlax-curve-getEndParam cEnt)))
  73.      (while (not (minusp (setq ePara (1- ePara))))
  74.    (setq Paralst (cons ePara Paralst)))
  75.      (if (and (not (initget 7))
  76.           (setq rArea (getreal (strcat "\nPline Area: "(rtos mArea 2 0)", Required: ")))
  77.           (<= rArea mArea))
  78.    (progn
  79.      (setq pArea 0.0 pInc (/ Acc 500.0) i -1.0)
  80.      ; === While Loop ===
  81.      (while (and (not (equal rArea pArea Acc))
  82.              (setq vPt (vlax-curve-getPointatParam cEnt (* pInc (setq i (1+ i))))))
  83.        (setq tLine (vla-addLine spc (vlax-3D-Point vPt)
  84.              (vlax-3D-Point (polar vPt cAng cLen)))
  85.          iArr (vlax-variant-value
  86.             (vla-IntersectWith tLine cEnt acExtendThisEntity)))
  87.        (vla-Delete tLine)
  88.        (if (> (vlax-safearray-get-u-bound iArr 1) 0)
  89.          (progn
  90.        (setq iLst (vlax-safearray->list iArr))
  91.        (while (not (zerop (length iLst)))
  92.          (setq ptLst (cons (list (car iLst) (cadr iLst) (caddr iLst)) ptLst)
  93.            iLst (cdddr iLst)))))
  94.        (if (> (length ptLst) 1)
  95.          (progn
  96.        (setq pLst (vl-sort
  97.                 (mapcar
  98.                   '(lambda (p) (vlax-curve-getParamatPoint cEnt p)) ptLst) '<)
  99.              sPara (1+ (fix (car pLst))) pInts (list (car pLst) (cadr pLst)))
  100.        (while (< sPara (cadr pLst))
  101.          (setq pLst (append pLst (list sPara)) sPara (1+ sPara)))
  102.        (setq vpLst (apply 'append
  103.                  (mapcar '(lambda (x) (list (car x) (cadr x)))
  104.                      (mapcar '(lambda (p) (vlax-curve-getPointatParam cEnt p)) (vl-sort pLst '<))))
  105.              vPts (vlax-make-variant
  106.                 (vlax-safearray-fill
  107.                   (vlax-make-safearray
  108.                 vlax-vbdouble
  109.                 (cons 0 (1- (length vpLst))))
  110.                   vpLst))
  111.              tPoly (vla-AddLightWeightPolyline spc vPts))
  112.        (vla-put-Closed tPoly :vlax-true)
  113.        (setq pArea (vla-get-Area tPoly))
  114.        (or (equal rArea pArea Acc) (vla-Delete tPoly))))
  115.        (setq ptLst nil))
  116.        ; === End of Loop ===
  117.      (if tPoly
  118.        (progn
  119.          (vla-put-color tPoly ACol)
  120.          (if 2Area
  121.        (progn
  122.          (setq Paralst (apply 'append
  123.                   (mapcar '(lambda (w) (list (car w) (cadr w)))
  124.                       (mapcar '(lambda (y) (vlax-curve-getPointatParam cEnt y))
  125.                           (vl-sort
  126.                             (append pInts (vl-remove-if
  127.                                     '(lambda (m) (member m pLst)) Paralst)) '<))))
  128.            2vPts (vlax-make-variant
  129.                (vlax-safearray-fill
  130.                  (vlax-make-safearray
  131.                    vlax-vbDouble
  132.                    (cons 0 (1- (length Paralst))))
  133.                  Paralst))
  134.            2tPoly (vla-addLightWeightPolyline spc 2vPts))
  135.          (vla-put-Closed 2tPoly :vlax-true)
  136.          (vla-put-Color 2tPoly BCol) (setq RLst (list tPoly 2tPoly)))
  137.        (setq RLst (list tPoly)))
  138.          (if Txt
  139.        (progn
  140.          (setq ObjArr (vlax-safearray-fill
  141.                 (vlax-make-safearray
  142.                   vlax-vbObject
  143.                   (cons 0 (1- (length RLst))))
  144.                 RLst)
  145.            ObjReg (vlax-safearray->list
  146.                 (vlax-variant-value
  147.                   (vla-addRegion spc ObjArr)))
  148.            rCentr (mapcar '(lambda (x) (vlax-safearray->list
  149.                              (vlax-variant-value
  150.                            (vla-get-Centroid x)))) ObjReg)
  151.            tBoxes (mapcar '(lambda (x) (textbox (list (cons 1 x))))
  152.                       (setq AreaLst (mapcar '(lambda (y) (strcat "Area: " (rtos y 2 tAcc)))
  153.                                 (mapcar 'vla-get-Area RLst))))
  154.            mOvPt  (mapcar 'vlax-3D-point
  155.                    (mapcar '(lambda (x)
  156.                     (mapcar '*
  157.                          (mapcar '/
  158.                           (mapcar '+ (car x) (cadr x))
  159.                               '(2.0 2.0 1.0))
  160.                              '(-1.0 -1.0 1.0))) tBoxes))
  161.            rCentr (mapcar 'vlax-3D-Point
  162.                       (mapcar '(lambda (x) (append x '(0.0))) rCentr))
  163.            txtObj (mapcar '(lambda (x y) (vla-addText spc x y tHt)) AreaLst rCentr))
  164.          
  165.          (cond ((eq 1 (length RLst))
  166.             (vla-Move (car txtObj) (vlax-3D-Point '(0 0 0)) (car mOvPt))
  167.             (vla-put-Color (car txtObj) TCol)
  168.             (vla-put-Color (car ObjReg) ACol)
  169.             (vla-delete tPoly))
  170.            ((eq 2 (length RLst))
  171.             (mapcar 'vla-Move txtObj
  172.                 (mapcar 'vlax-3D-Point '((0 0 0) (0 0 0))) mOvPt)
  173.             (mapcar 'vla-put-Color txtObj (list TCol TCol))
  174.             (mapcar 'vla-put-Color ObjReg (list ACol BCol))
  175.             (mapcar 'vla-Delete (list tPoly 2tPoly))))))
  176.          (if ODel (vla-Delete cEnt)))
  177.        (princ "\n<!> Unable to Partition Area <!>")))
  178.    (princ "\n<!> Area is Greater than Area of Selected Pline <!>")))
  179.    (princ "\n<!> Nothing Selected, or this isn't an LWPline <!>"))
  180. (mapcar 'setvar vlst ovar)
  181. (princ))
  182.       
回复

使用道具 举报

2

主题

439

帖子

536

银币

限制会员

铜币
-14
发表于 2022-7-6 08:56:06 | 显示全部楼层
使用(if(not(vlax-erased-p tPoly))可以确信您的多段线没有被擦除,或者在(vla Delete tPoly)之后使用(setq tPoly nil)。
 
使用(vla Delete tPoly)不会更改tPoly变量值。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 08:58:51 | 显示全部楼层
 
啊,说得好!
 
我认为,由于这是一个迭代过程-有可能在公差(Acc)内找不到区域-但由于tPoly未设置为零,LISP仍将尝试继续。。。
 
非常感谢ASMI,我会试一试的
 
干杯
 
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 09:00:34 | 显示全部楼层
非常感谢ASMI-vlax-erased-p带来的惊喜。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 09:02:54 | 显示全部楼层
发现了其他一些小故障,如区域被标记为错误的方向,但现在似乎都已修复
 
它有时无法划分区域,我认为这是因为(作为一个迭代过程),在循环到达曲线末端之前,区域不会达到公差集内-但减少增量步长只会减慢程序的速度。
 
但无论如何,这里有一个最终结果:
 
  1. ;;;================= AreaDiv.lsp =================
  2. ;;;
  3. ;;; FUNCTION: AD (Area Division)
  4. ;;;
  5. ;;; Will Divide a Selected LWPolyline into
  6. ;;; a specified Area and remainder.
  7. ;;;
  8. ;;; AUTHOR:
  9. ;;; Copyright (C) 2009 Lee McDonnell
  10. ;;;  (Contact Lee Mac, CADTutor.net)
  11. ;;;
  12. ;;; PLATFORMS:
  13. ;;; No Restrictions, only tested on ACAD2004
  14. ;;;
  15. ;;; VERSION:
  16. ;;; 1.0   ~   29.03.2009
  17. ;;;
  18. ;;; RESTRICTIONS:
  19. ;;; Iterative Process, will unsuccessfully
  20. ;;; partition region if tolerance is too low.
  21. ;;;
  22. ;;;===============================================
  23. (defun c:AD (/ *error* ovar vlst doc spc ODel Acc ACol BCol 2Area
  24.           Txt tAcc tHt TCol Ent cEnt cPt cAng p@sel cLen mArea
  25.           ePara Paralst rArea pArea pInc i vPt tLine iArr iLst
  26.           ptLst pLst sPara vpLst vPts tPoly 2vPts 2tPoly
  27.           RLst ObjArr ObjReg rCentr tBoxes mOvPt txtObj AreaLst)
  28. ; === Adjustments ===
  29. (setq ODel nil)    ;  Delete Original LWPolyline (T = Del)
  30. (setq Acc 5.0)  ;  Accuracy of Area Retrieval (Tolerance)
  31. (setq ACol 3)    ;  Colour of Desired Region (0-255)
  32. (setq BCol 4)    ;  Colour of Second Region (if 2Area = T)
  33. (setq 2Area T)   ;  Secondary Marked Area (T or nil)
  34. (setq Txt T)     ;  Area Text in Regions (T or nil)
  35. (setq tAcc 2)    ;  Area Text Precision (if Txt = T)
  36. (setq tHt 2.5)   ;  Area Text Height (if Txt = T, 0.0 for Default)
  37. (setq TCol 2)    ;  Area Text Colour (if Txt = T)
  38. ; ===================
  39. ; === Error Prevention ===
  40. (or (< 0.0 Acc) (setq Acc 10.0))
  41. (or (and (eq 'INT (type ACol)) (<= 0 ACol 255)) (setq ACol 3))
  42. (or (and (eq 'INT (type ACol)) (<= 0 BCol 255)) (setq BCol 4))
  43. (or (and (eq 'INT (type tAcc)) (<= 0 tAcc))     (setq tAcc 2))
  44. (or (and (eq 'INT (type TCol)) (<= 0 TCol 255)) (setq TCol 2))
  45. (or (< 0.0 tHt) (setq tHt (getvar "TEXTSIZE")))
  46. (defun *error* (msg)
  47.    (if ovar (mapcar 'setvar vlst ovar))
  48.    (if (not (member msg '("Function cancelled" "quit / exit abort")))
  49.      (princ (strcat "\nError: " (strcase msg))))
  50.    (princ))
  51. ; ========================
  52. (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object))
  53.        spc (if (zerop (vla-get-activespace doc))
  54.              (if (= (vla-get-mspace doc) :vlax-true)
  55.                (vla-get-modelspace doc)
  56.                (vla-get-paperspace doc))
  57.              (vla-get-modelspace doc)))
  58. (setq vlst '("OSMODE")
  59.    ovar (mapcar 'getvar vlst))
  60. (mapcar 'setvar vlst '(0))
  61. (if (and (setq Ent (entsel "\nSelect LWPolyline: "))
  62.       (eq "LWPOLYLINE" (cdr (assoc 0 (entget (car Ent))))))
  63.    (progn
  64.      (setq cEnt (vlax-ename->vla-object (car Ent))
  65.        cPt (vlax-curve-getClosestPointto cEnt (cadr Ent) acExtendNone)
  66.        cAng (angle '(0 0 0) (vlax-curve-getFirstDeriv cEnt
  67.                   (vlax-curve-getParamatPoint cEnt cPt)))
  68.        p@sel (vlax-curve-getParamAtPoint cEnt cPt)
  69.        cLen (- (vlax-curve-getDistatParam cEnt (fix p@sel))
  70.            (vlax-curve-getDistatParam cEnt (1+ (fix p@sel)))))
  71.      (if (eq :vlax-false (vla-get-Closed cEnt))
  72.    (progn
  73.      (initget "Yes No")
  74.      (if (eq "Yes" (getkword "\nPolyline Not Closed, Close it?  "))
  75.        (vla-put-Closed cEnt :vlax-true))))
  76.      (setq mArea (vla-get-Area cEnt) ePara (1+ (vlax-curve-getEndParam cEnt)))
  77.      (while (not (minusp (setq ePara (1- ePara))))
  78.    (setq Paralst (cons ePara Paralst)))
  79.      (if (and (not (initget 7))
  80.           (setq rArea (getreal (strcat "\nPline Area: "(rtos mArea 2 0)", Required: ")))
  81.           (<= rArea mArea))
  82.    (progn
  83.      (setq pArea 0.0 pInc (/ Acc 500.0) i -1.0)
  84.      ; === While Loop ===
  85.      (while (and (not (equal rArea pArea Acc))
  86.              (setq vPt (vlax-curve-getPointatParam cEnt (* pInc (setq i (1+ i))))))
  87.        (setq tLine (vla-addLine spc (vlax-3D-Point vPt)
  88.              (vlax-3D-Point (polar vPt cAng cLen)))
  89.          iArr (vlax-variant-value
  90.             (vla-IntersectWith tLine cEnt acExtendThisEntity)))
  91.        (and (vla-Delete tLine) (setq tLine nil))
  92.        (if (> (vlax-safearray-get-u-bound iArr 1) 0)
  93.          (progn
  94.        (setq iLst (vlax-safearray->list iArr))
  95.        (while (not (zerop (length iLst)))
  96.          (setq ptLst (cons (list (car iLst) (cadr iLst) (caddr iLst)) ptLst)
  97.            iLst (cdddr iLst)))))
  98.        (if (> (length ptLst) 1)
  99.          (progn
  100.        (setq pLst (vl-sort
  101.                 (mapcar
  102.                   '(lambda (p) (vlax-curve-getParamatPoint cEnt p)) ptLst) '<)
  103.              sPara (1+ (fix (car pLst))) pInts (list (car pLst) (cadr pLst)))
  104.        (while (< sPara (cadr pLst))
  105.          (setq pLst (append pLst (list sPara)) sPara (1+ sPara)))
  106.        (setq vpLst (apply 'append
  107.                  (mapcar '(lambda (x) (list (car x) (cadr x)))
  108.                      (mapcar '(lambda (p) (vlax-curve-getPointatParam cEnt p)) (vl-sort pLst '<))))
  109.              vPts (vlax-make-variant
  110.                 (vlax-safearray-fill
  111.                   (vlax-make-safearray
  112.                 vlax-vbdouble
  113.                 (cons 0 (1- (length vpLst))))
  114.                   vpLst))
  115.              tPoly (vla-AddLightWeightPolyline spc vPts))
  116.        (if (not (vlax-erased-p tPoly)) (vla-put-Closed tPoly :vlax-true))
  117.        (setq pArea (vla-get-Area tPoly))
  118.        (or (equal rArea pArea Acc) (and (vla-Delete tPoly) (setq tPoly nil)))))
  119.        (setq ptLst nil))
  120.        ; === End of Loop ===
  121.      (if (not (vlax-erased-p tPoly))
  122.        (progn
  123.          (vla-put-color tPoly ACol)
  124.          (if 2Area
  125.        (progn
  126.          (setq Paralst (apply 'append
  127.                   (mapcar '(lambda (w) (list (car w) (cadr w)))
  128.                       (mapcar '(lambda (y) (vlax-curve-getPointatParam cEnt y))
  129.                           (vl-sort
  130.                             (append pInts (vl-remove-if
  131.                                     '(lambda (m) (member m pLst)) Paralst)) '<))))
  132.            2vPts (vlax-make-variant
  133.                (vlax-safearray-fill
  134.                  (vlax-make-safearray
  135.                    vlax-vbDouble
  136.                    (cons 0 (1- (length Paralst))))
  137.                  Paralst))
  138.            2tPoly (vla-addLightWeightPolyline spc 2vPts))
  139.          (vla-put-Closed 2tPoly :vlax-true)
  140.          (vla-put-Color 2tPoly BCol) (setq RLst (list tPoly 2tPoly)))
  141.        (setq RLst (list tPoly)))
  142.          (if Txt
  143.        (progn
  144.          (setq ObjArr (vlax-safearray-fill
  145.                 (vlax-make-safearray
  146.                   vlax-vbObject
  147.                   (cons 0 (1- (length RLst))))
  148.                 RLst)
  149.            ObjReg (vlax-safearray->list
  150.                 (vlax-variant-value
  151.                   (vla-addRegion spc ObjArr))))
  152.          
  153.          (if (< 1 (length ObjReg))
  154.            (setq ObjReg (vl-sort ObjReg '(lambda (x1 x2)
  155.                            (< (abs (- rArea (vla-get-Area x1)))
  156.                               (abs (- rArea (vla-get-Area x2))))))))
  157.                      
  158.          (setq rCentr (mapcar '(lambda (x) (vlax-safearray->list
  159.                              (vlax-variant-value
  160.                            (vla-get-Centroid x)))) ObjReg)
  161.            tBoxes (mapcar '(lambda (x) (textbox (list (cons 1 x))))
  162.                       (setq AreaLst (mapcar '(lambda (y) (strcat "Area: " (rtos y 2 tAcc)))
  163.                                 (mapcar 'vla-get-Area RLst))))
  164.            mOvPt  (mapcar 'vlax-3D-point
  165.                    (mapcar '(lambda (x)
  166.                     (mapcar '*
  167.                          (mapcar '/
  168.                           (mapcar '+ (car x) (cadr x))
  169.                               '(2.0 2.0 1.0))
  170.                              '(-1.0 -1.0 1.0))) tBoxes))
  171.            rCentr (mapcar 'vlax-3D-Point
  172.                       (mapcar '(lambda (x) (append x '(0.0))) rCentr))
  173.            txtObj (mapcar '(lambda (x y) (vla-addText spc x y tHt)) AreaLst rCentr))
  174.          
  175.          (cond ((eq 1 (length RLst))
  176.             (vla-Move (car txtObj) (vlax-3D-Point '(0 0 0)) (car mOvPt))
  177.             (vla-put-Color (car txtObj) TCol)
  178.             (vla-put-Color (car ObjReg) ACol)
  179.             (and (vla-delete tPoly) (setq tPoly nil)))
  180.            ((eq 2 (length RLst))
  181.             (mapcar 'vla-Move txtObj
  182.                 (mapcar 'vlax-3D-Point '((0 0 0) (0 0 0))) mOvPt)
  183.             (mapcar 'vla-put-Color txtObj (list TCol TCol))
  184.             (mapcar 'vla-put-Color ObjReg (list ACol BCol))
  185.             (mapcar 'vla-Delete (list tPoly 2tPoly))))))
  186.          (if ODel (vla-Delete cEnt)))
  187.        (princ "\n<!> Unable to Partition Area <!>")))
  188.    (princ "\n<!> Area is Greater than Area of Selected Pline <!>")))
  189.    (princ "\n<!> Nothing Selected, or this isn't an LWPline <!>"))
  190. (mapcar 'setvar vlst ovar)
  191. (princ))
  192.       
回复

使用道具 举报

8

主题

50

帖子

42

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 09:08:22 | 显示全部楼层
  1. Command: ad
  2. Select LWPolyline:
  3. Pline Area: 3312, Required: 1500
  4. <!> Unable to Partition Area <!>
  5. Command:
  6. Command:
  7. Command: _.erase 1 found
  8. Command: re
  9. REGEN Regenerating model.
  10. Command: ad
  11. Select LWPolyline:
  12. Pline Area: 6706, Required: 3000
  13. <!> Unable to Partition Area <!>
  14. Command:

 
我正在使用autodesk land desktop 2009。。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 09:14:35 | 显示全部楼层
 
 
它应该解决这个问题——但正如我前面所说的那样——需要调整公差和增量步长,以帮助它一致地检索所需区域。
回复

使用道具 举报

8

主题

50

帖子

42

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 09:17:25 | 显示全部楼层
最后现在它的工作降级到acad2007。。
非常感谢。
 
奥利弗
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 09:20:23 | 显示全部楼层
 
 
很高兴你成功了-我不喜欢函数的迭代方法-它们大多不可靠,可靠性可能会因用户输入而有所不同。。。例如,在我的代码中,很难在大区域中找到一个小区域,必须对容差和增量步骤进行很大修改。
 
但是我认为这种方法是你在这个请求中能得到的最好的方法,我当然想不出另一种方法来执行这样的任务,如果其他人可以的话,我会感兴趣的。。。。
 
干杯
 
回复

使用道具 举报

8

主题

50

帖子

42

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 09:23:50 | 显示全部楼层
我一直在看这个和相关的线程,但由于有限的Lisp经验,没有能够添加太多。然而,我可以肯定地看到局势的复杂性。
 
经过进一步思考,我很想知道这个过程将如何处理这里所示的情况,以及下面的简化形式。
 
在“简化”中,在60和64平方单位的目标区域中似乎存在不连续性。

回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-7 07:59 , Processed in 0.486967 second(s), 72 queries .

© 2020-2025 乐筑天下

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