找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 2528|回复: 16

[每日一码] 改造一下打断于点

[复制链接]

已领礼包: 593个

财富等级: 财运亨通

发表于 2013-8-1 23:28:36 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×
  1. (defun c:brp (/ s)
  2.   (if (setq s
  3.       (ssget
  4.         ":S"
  5.         '((0 . "line,lwpolyline,arc,polyline,spline,trace,ray,xline")
  6.   )
  7.       )
  8.       )
  9.     (vl-catch-all-apply
  10.       '(lambda (/ el e)
  11.   (setq el (ssnamex s)
  12.         e  (list (cadar el) (cadr (last (car el))))
  13.   )
  14.   (if (and (vlax-curve-isclosed (car e))
  15.     (vlax-curve-isPeriodic (car e))
  16.       )
  17.     (princ "\nCan not Break this Object!")
  18.     (progn
  19.       (command ".break" e "f")
  20.       (command pause)
  21.       (command "@")
  22.     )
  23.   )
  24.        )
  25.     )
  26.     (princ "\nNo Selected Break Object!")
  27.   )
  28.   (princ)
  29. )
  30. (princ "\nStart Command with Brp, eachy!")
  31. (princ)

点评

很好用。  发表于 2014-1-23 22:42
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 2688个

财富等级: 家财万贯

发表于 2013-8-2 08:10:40 | 显示全部楼层
楼主最近放出不少好东西,顶!!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2013-11-22 23:29:37 | 显示全部楼层
加载后只能选择无法执行下一步!求指点!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2013-11-28 22:57:12 | 显示全部楼层
楼主在忙什么,怎么还不回复?

点评

你选择的是什么? 选下封闭的曲线试试看。  详情 回复 发表于 2013-11-28 23:03
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 40个

财富等级: 招财进宝

发表于 2013-11-28 23:03:50 | 显示全部楼层
混沌初开 发表于 2013-11-28 22:57
楼主在忙什么,怎么还不回复?

你选择的是什么? 选下封闭的曲线试试看。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 488个

财富等级: 日进斗金

发表于 2013-11-29 22:17:56 | 显示全部楼层
(and (vlax-curve-isclosed (car e))
   (vlax-curve-isPeriodic (car e))
      )
-----------
是不是应该是or

点评

没有测试那么多, 仅测试了 line pline ,程序的本意是可以在打断与点的时候选线,然后可以任意指定点,可以使用捕捉 按 break 的提示“无法仅在一点打断闭合的周期性曲线。” 作的判断  详情 回复 发表于 2013-11-29 22:55
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 593个

财富等级: 财运亨通

 楼主| 发表于 2013-11-29 22:55:53 | 显示全部楼层
aeo 发表于 2013-11-29 22:17
(and (vlax-curve-isclosed (car e))
   (vlax-curve-isPeriodic (car e))
      )

没有测试那么多, 仅测试了 line pline ,程序的本意是可以在打断与点的时候选线,然后可以任意指定点,可以使用捕捉

按 break  的提示“无法仅在一点打断闭合的周期性曲线。” 作的判断

论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 208个

财富等级: 日进斗金

发表于 2013-11-29 23:11:48 | 显示全部楼层
用非command打断可以参考
BreakMethod v2.0.lsp


  1. ;;  BreakMethod version 1.0
  2. ;;  Joe Burke  6/6/2005
  3. ;;
  4. ;;  Mlines, leaders, dimensions, regions, text objects,
  5. ;;  blocks and solids can't be broken with the break command.
  6. ;;  They are not supported.
  7. ;;  Donuts are supported since they are lwplines.
  8. ;;
  9. ;;  Change history
  10. ;;  ---------------------
  11. ;;  Version 1.1  6/8/2005
  12. ;;  Changed TrueColor property to Color at BreakCircle function.
  13. ;;
  14. ;;  Removed (trans p1 1 0) and (trans p2 1 0) at front end.
  15. ;;  Better to let the calling function ensure points passed are WCS.
  16. ;;  This avoids the possibility of WCS points wrongly transformed
  17. ;;  when the calling function is operating in a UCS.
  18. ;;
  19. ;;  6/11/2005
  20. ;;  At front end, moved type check to start to avoid error
  21. ;;  when passing an ename and trying to get its layer object.
  22. ;;
  23. ;;  6/14/2005
  24. ;;  Added fuzz factor to equal functions at various places.
  25. ;;  
  26. ;;  ---------------------
  27. ;;  Version 1.2  6/16/2005
  28. ;;  Added Tim Willey's suggestion. The function returns
  29. ;;  T when the break operation is successful, otherwise nil.
  30. ;;
  31. ;;  ---------------------
  32. ;;  Version 1.3  7/8/2005
  33. ;;  Changed how closed/open ellipse is determined.
  34. ;;  Revised front end: the locked layer check is after setting
  35. ;;  the space variable. So the return T or nil code at the end
  36. ;;  doesn't toss an error (vla-object nil) when the object is
  37. ;;  on a locked layer.
  38. ;;  Revised return T or nil method at end to be an or statement
  39. ;;  rather than condition.
  40. ;;
  41. ;;  Thinking about going back to "cond" rather than "or" 7/11/2005.
  42. ;;  So what's returned is a new object or a modified object.
  43. ;;  Rather than just T when successful.
  44. ;;
  45. ;;  Revised front end so the "and" function checks all setq's.
  46. ;;
  47. ;;  ---------------------
  48. ;;  Version 1.4  7/16/2005
  49. ;;  Added check for arguments obj p1 and p2.
  50. ;;  Moved return function inside "and" function. Revised calls
  51. ;;  to sub-functions so they return T.
  52. ;;
  53. ;;  Now returns a new object if one was created or a modified object,
  54. ;;  otherwise nil.
  55. ;;
  56. ;;  ---------------------
  57. ;;  Version 1.5 - list argument version - 7/19/2005
  58. ;;  BreakMethod may be used two ways. The calling function may
  59. ;;  be passing points derived from IntersectWith. In that case it's
  60. ;;  not desireable to do closest point to p1 p2 within BM because the points
  61. ;;  may not be where expected. But with closest point some point will
  62. ;;  be found regardless. So the object may be broken somewhere unexpected.
  63. ;;
  64. ;;  The other usage is passing points from entsel for instance.
  65. ;;  Having closest point in BM given that case is a convenience.
  66. ;;
  67. ;;  ---------------------
  68. ;;  Version 2.0 - 12/31/2005
  69. ;;  Added support for 3D plines, rays and xlines.
  70. ;;  revised 5/15/2006 to fix bug at end report.
  71. ;;  Added if the object was erased, return the object.
  72. ;;
  73. ;;  ---------------------
  74. ;;  Current version breaks lines, arcs, circles,
  75. ;;  ellipses (open or closed), lightweight plines
  76. ;;  (open or closed), heavy plines (open or closed),
  77. ;;  3D plines (open or closed), rays and xlines.
  78. ;;  Does not handle curve objects like splines
  79. ;;  or fitted, cubic, quadratic plines.
  80. ;;
  81. ;;  Additional functions by others welcome. For example,
  82. ;;  a function for breaking splines.
  83. ;;
  84. ;;  BreakMethod wants to be an alternative to
  85. ;;  (command "break"...) using VLisp which
  86. ;;  mimics the break command exactly given the "first
  87. ;;  point" "second point" method. Do whatever it
  88. ;;  does with a particular object type under a given set
  89. ;;  of circumstances. Includes things like keeping the
  90. ;;  original object and honoring which point is picked first.
  91. ;;  For instance with circles, picking clockwise or
  92. ;;  counter-clockwise determines the result. Similarly,
  93. ;;  maintain the angle of a line or direction of a
  94. ;;  pline after break.
  95. ;;
  96. ;;  Potential bugs not yet squashed: any condition which
  97. ;;  creates duplicate vertices at the start or end of a pline.
  98. ;;  Not to mention, things I simply haven't considered.  :-)

  99. ;;  TEST FUNCTIONS  ;;

  100. ;|
  101. ;; Revised for arglst 7/18/2005 version 1.5.
  102. ;; Revised version 2.0.
  103. ;; testCP calls closestpointto for p1 and p2.
  104. (defun c:testCP (/ *error* doc ent p1 p2)
  105.   (defun *error* (msg)
  106.     (cond
  107.       ((not msg))
  108.       ((wcmatch (strcase msg) "*QUIT*,*CANCEL*"))
  109.       (T (princ (strcat "\nError: " msg)))
  110.     )
  111.     (vla-EndUndoMark doc)
  112.     (princ)
  113.   ) ;end error
  114.   (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
  115.   (vla-EndUndoMark doc)
  116.   (vla-StartUndoMark doc)
  117.   (while (not (setq ent (car (entsel "\nSelect object: ")))))
  118.   (setq p1 (trans (getpoint "\nFirst break point: ") 1 0))
  119.   (setq p2 (trans (getpoint "\nSecond break point: ") 1 0))
  120.   (print (BreakMethod (list ent p1 p2 T))) ;<< opt-arg T
  121.   (*error* nil)
  122. ) ;end

  123. ;; Revised for arglst 7/18/2005 version 1.5.
  124. ;; Revised version 2.0.
  125. ;; testNCP doesn't call closestpointto.
  126. (defun c:testNCP (/ *error* doc ent p1 p2)
  127.   (defun *error* (msg)
  128.     (cond
  129.       ((not msg))
  130.       ((wcmatch (strcase msg) "*QUIT*,*CANCEL*"))
  131.       (T (princ (strcat "\nError: " msg)))
  132.     )
  133.     (vla-EndUndoMark doc)
  134.     (princ)
  135.   ) ;end error
  136.   (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
  137.   (vla-EndUndoMark doc)
  138.   (vla-StartUndoMark doc)
  139.   (while (not (setq ent (car (entsel "\nSelect object: ")))))
  140.   (setq p1 (trans (getpoint "\nFirst break point: ") 1 0))
  141.   (setq p2 (trans (getpoint "\nSecond break point: ") 1 0))
  142.   (print (BreakMethod (list ent p1 p2))) ;<< opt-arg not supplied
  143.   (*error* nil)
  144. ) ;end
  145. |;


  146. ;; Argument: a list (arglst) containing (object-to-break p1 p2 opt-arg).
  147. ;; Where opt-arg determines whether BreakMethod calls closestpointto for p1 and p2.
  148. ;; Obj - vla-object or ename. p1 and p2 - two WCS points.
  149. ;; Returns: new or modified object if successful, otherwise nil.
  150. (defun BreakMethod (arglst / doc space layobj typ startpt startparam
  151.                     endpt endparam p1param p2param minparam maxparam
  152.                     CalcBulge DelZ BreakLine BreakArc BreakCircle
  153.                     BreakClosedEllipse BreakOpenEllipse BreakOpenLWPline
  154.                     BreakClosedLWPline BreakOpenPline BreakClosedPline
  155.                     BreakOpen3DPline BreakClosed3DPline BreakXLine
  156.                     BreakRay spacecnt res)

  157.   ;;;; START SUBFUNCTIONS ;;;;

  158.   ;----------------------------
  159.   ;; Modified version of a function by Luis Esquivel (rcmd-getBulge)
  160.   ;; which was based on a function by John Uhden (getBulge).
  161.   ;; Arguments: obj - a vla-object pline either heavy or lightweight.
  162.   ;;            fromparam - parameter along the obj where the bulge starts.
  163.   ;;            toparam - parameter along the obj where the bulge ends.
  164.   ;; Returns: the bulge at fromparam.
  165.   (defun CalcBulge (obj fromparam toparam /
  166.                     frompt topt curvept ang chord midcrdpt alt)
  167.     (setq frompt (vlax-curve-getPointAtParam obj fromparam)
  168.           topt (vlax-curve-getPointAtParam obj toparam)
  169.           curvept (vlax-curve-getPointAtParam obj (* 0.5 (+ fromparam toparam)))
  170.           ang (angle frompt topt)
  171.           chord (distance frompt topt)
  172.           midcrdpt (mapcar '* (mapcar '+ frompt topt) '(0.5 0.5 0.5))
  173.           alt (distance midcrdpt curvept)
  174.     )
  175.     (cond
  176.       ((zerop chord) 0.0)
  177.       ((equal (angle curvept midcrdpt)
  178.         (rem (+ ang (* pi 0.5)) (* pi 2)) 1e-4)
  179.         (/ alt chord 0.5))
  180.       (T (/ alt chord -0.5))
  181.     )
  182.   ) ;end CalcBulge
  183.   ;----------------------------

  184.   ;----------------------------
  185.   ;; Argument: 3D point list.
  186.   ;; Returns: point list with Z value removed or
  187.   ;; the point passed if 2D.
  188.   (defun DelZ (pt)
  189.     (if (= 3 (length pt))
  190.       (list (car pt) (cadr pt))
  191.       pt
  192.     )
  193.   ) ;end DelZ
  194.   ;----------------------------

  195.   ;----------------------------
  196.   (defun BreakLine ( / copyobj)
  197.     (cond
  198.       ((and (equal startpt p1 1e-8) (equal endpt p2 1e-8))
  199.         (vla-delete obj))
  200.       ((equal startpt p1 1e-8)
  201.         (vlax-put obj 'StartPoint p2))
  202.       ((equal endpt p2 1e-8)
  203.         (vlax-put obj 'EndPoint p1))
  204.       (T
  205.         (setq copyobj (vlax-invoke obj 'Copy))
  206.         (vlax-put obj 'EndPoint p1)
  207.         (vlax-put copyobj 'StartPoint p2)
  208.       )
  209.     )
  210.   ) ;end BreakLine
  211.   ;----------------------------

  212.   ;----------------------------
  213.   (defun BreakArc ( / copyobj)
  214.     (cond
  215.       ((and (equal startpt p1 1e-8) (equal endpt p2 1e-8))
  216.         (vla-delete obj))
  217.       ((equal startpt p1 1e-8)
  218.         (vlax-put obj 'StartAngle maxparam))
  219.       ((equal endpt p2 1e-8)
  220.         (vlax-put obj 'EndAngle minparam))
  221.       (T
  222.         (setq copyobj (vlax-invoke obj 'Copy))
  223.         (vlax-put obj 'EndAngle minparam)
  224.         (vlax-put copyobj 'StartAngle maxparam)
  225.       )
  226.     )
  227.   ) ;end BreakArc
  228.   ;----------------------------

  229.   ;----------------------------
  230.   (defun BreakOpenEllipse ( / copyobj)
  231.     (cond
  232.       ((and (equal startpt p1 1e-8) (equal endpt p2 1e-8))
  233.         (vla-delete obj))
  234.       ((equal startpt p1 1e-8)
  235.         (vlax-put obj 'StartParameter maxparam))
  236.       ((equal endpt p2 1e-8)
  237.         (vlax-put obj 'EndParameter minparam))
  238.       (T
  239.         (setq copyobj (vlax-invoke obj 'Copy))
  240.         (vlax-put obj 'EndParameter minparam)
  241.         (vlax-put copyobj 'StartParameter maxparam)
  242.       )
  243.     )
  244.   ) ;end BreakOpenEllipse
  245.   ;----------------------------

  246.   ;----------------------------
  247.   (defun BreakClosedEllipse ( )
  248.     (vlax-put obj 'StartParameter maxparam)
  249.     (vlax-put obj 'EndParameter (+ minparam (* pi 2)))
  250.   ) ;end BreakClosedEllipse
  251.   ;----------------------------

  252.   ;----------------------------
  253.   (defun BreakCircle ( / layname rad cen ltyp ltypscl lwt thk clr)
  254.     (setq layname (vlax-get obj 'Layer)
  255.           rad (vlax-get obj 'Radius)
  256.           cen (vlax-get obj 'Center)
  257.           ltyp (vlax-get obj 'Linetype)
  258.           ltypscl (vlax-get obj 'LinetypeScale)
  259.           lwt (vlax-get obj 'Lineweight)
  260.           thk (vlax-get obj 'Thickness)
  261.           clr (vlax-get obj 'Color)
  262.     )
  263.     (vla-delete obj)
  264.     (setq obj (vlax-invoke space 'AddArc cen rad p2param p1param))
  265.     (vlax-put obj 'Layer layname)
  266.     (vlax-put obj 'Linetype ltyp)
  267.     (vlax-put obj 'LinetypeScale ltypscl)
  268.     (vlax-put obj 'Lineweight lwt)
  269.     (vlax-put obj 'Thickness thk)
  270.     (vlax-put obj 'Color clr)
  271.   ) ;end BreakCircle
  272.   ;----------------------------
  273.   
  274.   ;----------------------------
  275.   ;; Break xlines: two new rays are created. Second ray returned.
  276.   (defun BreakXLine ( / layname dirvec ltyp ltypscl lwt clr)
  277.     (setq layname (vlax-get obj 'Layer)
  278.           dirvec (vlax-get obj 'DirectionVector)
  279.           ltyp (vlax-get obj 'Linetype)
  280.           ltypscl (vlax-get obj 'LinetypeScale)
  281.           lwt (vlax-get obj 'Lineweight)
  282.           clr (vlax-get obj 'Color)
  283.     )
  284.     (vla-delete obj)
  285.     (setq obj (vlax-invoke space 'AddRay p1 (mapcar '- p1 dirvec)))
  286.     (vlax-put obj 'Layer layname)
  287.     (vlax-put obj 'Linetype ltyp)
  288.     (vlax-put obj 'LinetypeScale ltypscl)
  289.     (vlax-put obj 'Lineweight lwt)
  290.     (vlax-put obj 'Color clr)
  291.     (setq obj (vlax-invoke space 'AddRay p2 (mapcar '+ p2 dirvec)))
  292.     (vlax-put obj 'Layer layname)
  293.     (vlax-put obj 'Linetype ltyp)
  294.     (vlax-put obj 'LinetypeScale ltypscl)
  295.     (vlax-put obj 'Lineweight lwt)
  296.     (vlax-put obj 'Color clr)
  297.   ) ;end BreakXLine
  298.   ;----------------------------
  299.   
  300.   ;----------------------------
  301.   ;; Break rays: a new line is created beginning at ray basepoint and ending
  302.   ;; at break point closest to basepoint. The existing ray is modified and
  303.   ;; returned with basepoint at break point farthest from original basepoint.
  304.   ;; Mimics what (command "break" ...) does with rays.
  305.   ;; If break point closest to basepoint is at basepoint, a new line is
  306.   ;; not created and the modified ray is returned. If both break points
  307.   ;; are at basepoint, nothing happens and nil is returned.
  308.   (defun BreakRay ( / layname basept ltyp ltypscl lwt clr newobj)
  309.     (setq layname (vlax-get obj 'Layer)
  310.           basept (vlax-get obj 'BasePoint)
  311.           ltyp (vlax-get obj 'Linetype)
  312.           ltypscl (vlax-get obj 'LinetypeScale)
  313.           lwt (vlax-get obj 'Lineweight)
  314.           clr (vlax-get obj 'Color)
  315.     )
  316.     (cond
  317.       ;add line and modify ray
  318.       ((and
  319.          (not (equal basept p1 1e-8))
  320.          (not (equal basept p2 1e-8))
  321.         )
  322.         (vlax-put obj 'BasePoint p2)
  323.         (setq newobj (vlax-invoke space 'AddLine basept p1))
  324.         (vlax-put newobj 'Layer layname)
  325.         (vlax-put newobj 'Linetype ltyp)
  326.         (vlax-put newobj 'LinetypeScale ltypscl)
  327.         (vlax-put newobj 'Lineweight lwt)
  328.         (vlax-put newobj 'Color clr)
  329.       )
  330.       ;don't add line, just modify ray
  331.       ((and
  332.          (equal basept p1 1e-8)
  333.          (not (equal basept p2 1e-8))
  334.         )
  335.         (vlax-put obj 'BasePoint p2)
  336.       )
  337.     )
  338.   ) ;end BreakRay
  339.   ;----------------------------

  340.   ;----------------------------
  341.   (defun BreakOpenLWPline ( / copyobj fxparam1 fxparam1pt
  342.                               fxparam2 fxparam2pt ModEnd ModStart)

  343.     ;modify end of lwpline - keep start vertex
  344.     (defun ModEnd (obj / endblg idx blg blglst coord)

  345.       ;end bulge
  346.       (setq endblg (CalcBulge obj fxparam1 minparam))

  347.       ;bulge list before p1
  348.       (setq idx 0)
  349.       (repeat fxparam1
  350.         (setq blg (vlax-invoke obj 'GetBulge idx))
  351.         (setq blglst (append blglst (list blg)))
  352.         (setq idx (1+ idx))
  353.       )
  354.       ;add end bulge
  355.       (setq blglst (append blglst (list endblg)))

  356.       ;add vertex at p1 if minparam isn't on a vertex
  357.       ;and strip trailing vertices
  358.       (if (/= minparam (fix minparam))
  359.         (vlax-invoke obj 'AddVertex (1+ fxparam1) p1)
  360.       )
  361.       (setq coord (vlax-get obj 'Coordinates))
  362.       (repeat (fix (- endparam fxparam1))
  363.         (setq coord (reverse (cddr (reverse coord))))
  364.         (vlax-put obj 'Coordinates coord)
  365.       )

  366.       ;apply bulge list
  367.       (setq idx 0)
  368.       (foreach x blglst
  369.         (vlax-invoke obj 'SetBulge idx x)
  370.         (setq idx (1+ idx))
  371.       )
  372.     ) ;end ModEnd

  373.     ;modify start of lwpline - keep end vertex
  374.     (defun ModStart (obj / startblg idx blg blglst coord)

  375.       ;start bulge
  376.       (setq startblg (CalcBulge obj maxparam fxparam2))

  377.       ;bulge list after p2
  378.       (setq idx fxparam2)
  379.       (repeat (fix (- endparam fxparam2))
  380.         (setq blg (vlax-invoke obj 'GetBulge idx))
  381.         (setq blglst (append blglst (list blg)))
  382.         (setq idx (1+ idx))
  383.       )
  384.       ;add start bulge
  385.       (setq blglst (append (list startblg) blglst))

  386.       ;add vertex at p2 and and strip leading vertices
  387.       (vlax-invoke obj 'AddVertex fxparam2 p2)
  388.       (setq coord (vlax-get obj 'Coordinates))
  389.       (repeat (fix fxparam2)
  390.         (setq coord (cddr coord))
  391.         (vlax-put obj 'Coordinates coord)
  392.       )

  393.       ;apply bulge list
  394.       (setq idx 0)
  395.       (foreach x blglst
  396.          (vlax-invoke obj 'SetBulge idx x)
  397.          (setq idx (1+ idx))
  398.        )
  399.     ) ;end ModStart
  400.     ;; end subfunctions ;;

  401.     (setq startpt (DelZ startpt)
  402.           endpt (DelZ endpt)
  403.           ;vertex before minparam
  404.           fxparam1 (fix minparam)
  405.           fxparam1pt (vlax-curve-getPointAtParam obj fxparam1)
  406.           ;2D point closest to startpoint
  407.           p1 (DelZ p1)
  408.           ;2D point closest to endpoint
  409.           p2 (DelZ p2)
  410.     )

  411.     ;vertex after maxparam
  412.     (if (equal maxparam endparam 1e-8)
  413.       (setq fxparam2 endparam)
  414.       (setq fxparam2 (1+ (fix maxparam)))
  415.     )
  416.     (setq fxparam2pt (vlax-curve-getPointAtParam obj fxparam2))

  417.     (cond
  418.       ((and (equal p1 startpt 1e-8) (equal p2 endpt 1e-8))
  419.         (vla-delete obj))
  420.       ((equal p1 startpt 1e-8)
  421.         (ModStart obj)
  422.       )
  423.       ((equal p2 endpt 1e-8)
  424.         (ModEnd obj)
  425.       )
  426.       (T
  427.         (setq copyobj (vlax-invoke obj 'Copy))
  428.         (ModEnd obj)
  429.         (ModStart copyobj)
  430.       )
  431.     )
  432.   ) ;end BreakOpenLWPline
  433.   ;----------------------------

  434.   ;----------------------------
  435.   (defun BreakClosedLWPline ( / fxparam1 fxparam1pt fxparam2 fxparam2pt
  436.                                 idx pt blg startblg endblg prelst postlst
  437.                                 coord datalst p1lst p2lst fxparam1lst var)

  438.     (setq p1 (DelZ p1)
  439.           p2 (DelZ p2))
  440.     (cond
  441.       ;point at start vertex
  442.       ((= minparam 0)
  443.         (setq fxparam1 endparam)
  444.       )
  445.       ;point is on vertex
  446.       ((= minparam (fix minparam))
  447.         (setq fxparam1 (1- minparam))
  448.       )
  449.       ;point is not on vertex
  450.       (T (setq fxparam1 (fix minparam)))
  451.     )
  452.     (setq fxparam1pt (DelZ (vlax-curve-getPointAtParam obj fxparam1)))

  453.     ;vertex param after maxparam
  454.     (if (= maxparam endparam)
  455.       (setq fxparam2 startparam)
  456.       (setq fxparam2 (1+ (fix maxparam)))
  457.     )
  458.     (setq fxparam2pt (DelZ (vlax-curve-getPointAtParam obj fxparam2)))

  459.     ;bulge at p2
  460.     (setq startblg (CalcBulge obj maxparam fxparam2))
  461.     (setq p2lst (list maxparam p2 startblg))

  462.     ;bulge before p1
  463.     (setq endblg (CalcBulge obj fxparam1 minparam))
  464.     (setq fxparam1lst (list fxparam1 fxparam1pt endblg))

  465.     (setq p1lst (list minparam p1 endblg))

  466.     (setq idx 0)
  467.     (repeat (fix endparam)
  468.       (setq pt (DelZ (vlax-curve-getPointAtParam obj idx)))
  469.       (setq blg (vlax-invoke obj 'GetBulge idx))
  470.       (cond
  471.         ;vertices after maxparam
  472.         ((> idx maxparam)
  473.           (setq postlst (append postlst (list (list idx pt blg))))
  474.         )
  475.         ;vertices before minparam w/o the vertex immediately before minparam
  476.         ((< idx (1- minparam))
  477.           (setq prelst (append prelst (list (list idx pt blg))))
  478.         )
  479.       )
  480.       (setq idx (1+ idx))
  481.     )

  482.     ;avoid adding an unneeded vertex at param 0
  483.     (if (= 0 (car p1lst))
  484.       (setq datalst (append (list p2lst) postlst prelst
  485.                           (list fxparam1lst)))   
  486.       (setq datalst (append (list p2lst) postlst prelst
  487.                           (list fxparam1lst) (list p1lst)))
  488.     )

  489.     ;; Set lwpline not closed and delete one vertex at a
  490.     ;; time until two vertices remain. Avoids an "unwind error"
  491.     ;; which occurs with lwplines when more than one vertex
  492.     ;; is removed at a time.
  493.     (vla-put-closed obj :vlax-false)
  494.     (setq coord (vlax-get obj 'Coordinates))
  495.     (repeat (- (/ (length coord) 2) 2)
  496.       (setq coord (cddr coord))
  497.       (vlax-put obj 'Coordinates coord)
  498.     )

  499.     ;add vertices as needed
  500.     (repeat (- (length datalst) 2)
  501.       (vlax-invoke obj 'AddVertex (vlax-curve-getEndParam obj)
  502.         (DelZ (vlax-curve-getEndPoint obj)))
  503.     )

  504.     ;rearrange
  505.     (setq idx 0)
  506.     (foreach lst datalst
  507.       (setq var (vlax-make-variant (vlax-safearray-fill
  508.         (vlax-make-safearray vlax-vbdouble
  509.           (cons 0 (1- (length (cadr lst))))) (cadr lst))))
  510.       (vlax-put-property obj 'Coordinate idx var)
  511.       (vlax-invoke obj 'SetBulge idx (caddr lst))
  512.       (setq idx (1+ idx))
  513.     )
  514.   ) ;end BreakClosedLWPline
  515.   ;----------------------------

  516.   ;----------------------------
  517.   ;; open heavy plines
  518.   (defun BreakOpenPline ( / copyobj fxparam1 fxparam1pt
  519.                             fxparam2 fxparam2pt ModEnd ModStart)

  520.     ;modify end of heavy pline - keep start point
  521.     (defun ModEnd (obj / endblg idx blg blglst coord)

  522.       ;end bulge
  523.       (setq endblg (CalcBulge obj fxparam1 minparam))

  524.       ;bulge list before p1
  525.       (setq idx 0)
  526.       (repeat fxparam1
  527.         (setq blg (vlax-invoke obj 'GetBulge idx))
  528.         (setq blglst (append blglst (list blg)))
  529.         (setq idx (1+ idx))
  530.       )
  531.       ;add end bulge
  532.       (setq blglst (append blglst (list endblg)))

  533.       ;strip trailing vertices
  534.       (setq coord (vlax-get obj 'Coordinates))
  535.       (repeat (fix (- endparam fxparam1))
  536.         (setq coord (reverse (cdddr (reverse coord))))
  537.       )

  538.       ;add vertex at p1 if minparam isn't on a vertex
  539.       (if (/= minparam (fix minparam))
  540.         (vlax-put obj 'Coordinates (append coord p1))
  541.         (vlax-put obj 'Coordinates coord)
  542.       )

  543.       ;apply bulge list
  544.       (setq idx 0)
  545.       (foreach x blglst
  546.         (vlax-invoke obj 'SetBulge idx x)
  547.         (setq idx (1+ idx))
  548.       )
  549.     ) ;end ModEnd

  550.     ;modify start of heavy pline - keep end point
  551.     (defun ModStart (obj / startblg idx blg blglst coord)

  552.       ;start bulge
  553.       (setq startblg (CalcBulge obj maxparam fxparam2))

  554.       ;bulge list after p2
  555.       (setq idx fxparam2)
  556.       (repeat (fix (- endparam fxparam2))
  557.         (setq blg (vlax-invoke obj 'GetBulge idx))
  558.         (setq blglst (append blglst (list blg)))
  559.         (setq idx (1+ idx))
  560.       )
  561.       ;add start bulge
  562.       (setq blglst (append (list startblg) blglst))

  563.       ;strip leading vertices
  564.       (setq coord (vlax-get obj 'Coordinates))
  565.       (repeat (fix fxparam2)
  566.         (setq coord (cdddr coord))
  567.       )

  568.       ;put coordinates
  569.       (vlax-put obj 'Coordinates (append p2 coord))

  570.       ;apply bulge list
  571.       (setq idx 0)
  572.       (foreach x blglst
  573.          (vlax-invoke obj 'SetBulge idx x)
  574.          (setq idx (1+ idx))
  575.        )
  576.     ) ;end ModStart
  577.     ;; end subfunctions ;;

  578.     ;vertex before minparam
  579.     (setq fxparam1 (fix minparam))
  580.     (setq fxparam1pt (vlax-curve-getPointAtParam obj fxparam1))

  581.     ;vertex after maxparam
  582.     (if (equal maxparam endparam 1e-8)
  583.       (setq fxparam2 endparam)
  584.       (setq fxparam2 (1+ (fix maxparam)))
  585.     )
  586.     (setq fxparam2pt (vlax-curve-getPointAtParam obj fxparam2))

  587.     (cond
  588.       ((and (equal p1 startpt 1e-8) (equal p2 endpt 1e-8))
  589.         (vla-delete obj))
  590.       ((equal p1 startpt 1e-8)
  591.         (ModStart obj)
  592.       )
  593.       ((equal p2 endpt 1e-8)
  594.         (ModEnd obj)
  595.       )
  596.       (T
  597.         (setq copyobj (vlax-invoke obj 'Copy))
  598.         (ModEnd obj)
  599.         (ModStart copyobj)
  600.       )
  601.     )
  602.   ) ;end BreakOpenPline
  603.   ;----------------------------

  604.   ;----------------------------
  605.   ;; closed heavy plines
  606.   (defun BreakClosedPline ( / fxparam1 fxparam1pt fxparam1lst pt blg idx postlst
  607.                               prelst ptlst datalst blglst fxparam2 fxparam2pt
  608.                               startblg endblg p2lst p1lst)

  609.     (cond
  610.       ;point at start vertex
  611.       ((= minparam 0)
  612.         (setq fxparam1 endparam)
  613.       )
  614.       ;point is on vertex
  615.       ((= minparam (fix minparam))
  616.         (setq fxparam1 (1- minparam))
  617.       )
  618.       ;point is not on vertex
  619.       (T (setq fxparam1 (fix minparam)))
  620.     )
  621.     (setq fxparam1pt (vlax-curve-getPointAtParam obj fxparam1))

  622.     ;vertex param after maxparam
  623.     (if (= maxparam endparam)
  624.       (setq fxparam2 startparam)
  625.       (setq fxparam2 (1+ (fix maxparam)))
  626.     )
  627.     (setq fxparam2pt (vlax-curve-getPointAtParam obj fxparam2))

  628.     ;bulge at p2
  629.     (setq startblg (CalcBulge obj maxparam fxparam2))
  630.     (setq p2lst (list maxparam p2 startblg))

  631.     ;bulge before p1
  632.     (setq endblg (CalcBulge obj fxparam1 minparam))

  633.     (setq fxparam1lst (list fxparam1 fxparam1pt endblg))

  634.     (setq p1lst (list minparam p1 endblg))

  635.     ;make lists before and after vertices
  636.     (setq idx 0)
  637.     (repeat (fix endparam)
  638.       (setq pt (vlax-curve-getPointAtParam obj idx))
  639.       (setq blg (vlax-invoke obj 'GetBulge idx))
  640.       (cond
  641.         ;vertices after maxparam
  642.         ((> idx maxparam)
  643.           (setq postlst (append postlst (list (list idx pt blg))))
  644.         )
  645.         ;vertices before minparam w/o the vertex immediately before minparam
  646.         ((< idx (1- minparam))
  647.           (setq prelst (append prelst (list (list idx pt blg))))
  648.         )
  649.       )
  650.       (setq idx (1+ idx))
  651.     )

  652.     ;avoid adding an unneeded vertex at param 0
  653.     (if (= 0 (car p1lst))
  654.       (setq datalst (append (list p2lst) postlst prelst
  655.                           (list fxparam1lst)))
  656.       (setq datalst (append (list p2lst) postlst prelst
  657.                           (list fxparam1lst) (list p1lst)))
  658.     )

  659.     (foreach lst datalst
  660.       (setq ptlst (append ptlst (cadr lst)))
  661.       (setq blglst (append blglst (list (caddr lst))))
  662.     )

  663.     (vla-put-closed obj :vlax-false)
  664.     (vlax-put obj 'Coordinates ptlst)

  665.     ;apply blglst
  666.     (setq idx 0)
  667.     (foreach x blglst
  668.       (vlax-invoke obj 'SetBulge idx x)
  669.       (setq idx (1+ idx))
  670.     )
  671.   ) ;end BreakClosedPline
  672.   ;----------------------------

  673.   ;----------------------------
  674.   ;; open 3D plines
  675.   (defun BreakOpen3DPline ( / copyobj fxparam1 fxparam1pt
  676.                             fxparam2 fxparam2pt ModEnd ModStart)

  677.     ;modify end of 3D pline - keep start point
  678.     (defun ModEnd (obj / idx coord)

  679.       ;strip trailing vertices
  680.       (setq coord (vlax-get obj 'Coordinates))
  681.       (repeat (fix (- endparam fxparam1))
  682.         (setq coord (reverse (cdddr (reverse coord))))
  683.       )

  684.       ;add vertex at p1 if minparam isn't on a vertex
  685.       (if (/= minparam (fix minparam))
  686.         (vlax-put obj 'Coordinates (append coord p1))
  687.         (vlax-put obj 'Coordinates coord)
  688.       )
  689.     ) ;end ModEnd

  690.     ;modify start of heavy pline - keep end point
  691.     (defun ModStart (obj / idx coord)

  692.       ;strip leading vertices
  693.       (setq coord (vlax-get obj 'Coordinates))
  694.       (repeat (fix fxparam2)
  695.         (setq coord (cdddr coord))
  696.       )

  697.       ;put coordinates
  698.       (vlax-put obj 'Coordinates (append p2 coord))
  699.     ) ;end ModStart
  700.     ;; end subfunctions ;;

  701.     ;vertex before minparam
  702.     (setq fxparam1 (fix minparam))
  703.     (setq fxparam1pt (vlax-curve-getPointAtParam obj fxparam1))

  704.     ;vertex after maxparam
  705.     (if (equal maxparam endparam 1e-8)
  706.       (setq fxparam2 endparam)
  707.       (setq fxparam2 (1+ (fix maxparam)))
  708.     )
  709.     (setq fxparam2pt (vlax-curve-getPointAtParam obj fxparam2))

  710.     (cond
  711.       ((and (equal p1 startpt 1e-8) (equal p2 endpt 1e-8))
  712.         (vla-delete obj))
  713.       ((equal p1 startpt 1e-8)
  714.         (ModStart obj)
  715.       )
  716.       ((equal p2 endpt 1e-8)
  717.         (ModEnd obj)
  718.       )
  719.       (T
  720.         (setq copyobj (vlax-invoke obj 'Copy))
  721.         (ModEnd obj)
  722.         (ModStart copyobj)
  723.       )
  724.     )
  725.   ) ;end BreakOpen3DPline
  726.   ;----------------------------

  727.   ;----------------------------
  728.   ;; closed 3D plines
  729.   (defun BreakClosed3DPline ( / fxparam1 fxparam1pt fxparam1lst pt idx postlst
  730.                               prelst ptlst datalst fxparam2 fxparam2pt p2lst p1lst)

  731.     (cond
  732.       ;point at start vertex
  733.       ((= minparam 0)
  734.         (setq fxparam1 endparam)
  735.       )
  736.       ;point is on vertex
  737.       ((= minparam (fix minparam))
  738.         (setq fxparam1 (1- minparam))
  739.       )
  740.       ;point is not on vertex
  741.       (T (setq fxparam1 (fix minparam)))
  742.     )
  743.     (setq fxparam1pt (vlax-curve-getPointAtParam obj fxparam1))

  744.     ;vertex param after maxparam
  745.     (if (= maxparam endparam)
  746.       (setq fxparam2 startparam)
  747.       (setq fxparam2 (1+ (fix maxparam)))
  748.     )
  749.     (setq fxparam2pt (vlax-curve-getPointAtParam obj fxparam2))

  750.     (setq p2lst (list maxparam p2))

  751.     (setq fxparam1lst (list fxparam1 fxparam1pt))

  752.     (setq p1lst (list minparam p1))

  753.     ;make lists before and after vertices
  754.     (setq idx 0)
  755.     (repeat (fix endparam)
  756.       (setq pt (vlax-curve-getPointAtParam obj idx))
  757.       (cond
  758.         ;vertices after maxparam
  759.         ((> idx maxparam)
  760.           (setq postlst (append postlst (list (list idx pt))))
  761.         )
  762.         ;vertices before minparam w/o the vertex immediately before minparam
  763.         ((< idx (1- minparam))
  764.           (setq prelst (append prelst (list (list idx pt))))
  765.         )
  766.       )
  767.       (setq idx (1+ idx))
  768.     )

  769.     ;avoid adding an unneeded vertex at param 0
  770.     (if (= 0 (car p1lst))
  771.       (setq datalst (append (list p2lst) postlst prelst
  772.                           (list fxparam1lst)))
  773.       (setq datalst (append (list p2lst) postlst prelst
  774.                           (list fxparam1lst) (list p1lst)))
  775.     )

  776.     (foreach lst datalst
  777.       (setq ptlst (append ptlst (cadr lst)))
  778.     )

  779.     (vla-put-closed obj :vlax-false)
  780.     (vlax-put obj 'Coordinates ptlst)

  781.   ) ;end BreakClosed3DPline
  782.   ;----------------------------

  783.   ;;;; END SUBFUNCTIONS ;;;;


  784.   ;;;; FRONT END ;;;;

  785.   (vl-load-com)
  786.   (and
  787.     (or
  788.       (= 3 (length arglst))
  789.       (= 4 (length arglst))
  790.     )
  791.     (setq obj (car arglst))
  792.     (cond
  793.       ((= (type obj) 'VLA-OBJECT))
  794.       ((= (type obj) 'ENAME)
  795.         (setq obj (vlax-ename->vla-object obj))
  796.       )
  797.     )
  798.     (setq p1 (cadr arglst))
  799.     (setq p2 (caddr arglst))
  800.     (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))
  801.           layobj (vla-item (vla-get-Layers doc) (vlax-get obj 'Layer))
  802.     )
  803.     (if (= 1 (vlax-get doc 'ActiveSpace))
  804.       (setq space (vla-get-ModelSpace doc))
  805.       (setq space (vla-get-PaperSpace doc))
  806.     )
  807.     (setq spacecnt (vlax-get space 'Count))
  808.     (setq typ (vlax-get obj 'ObjectName))
  809.     (or
  810.       (= :vlax-false (vla-get-lock layobj))
  811.       (prompt "\nObject is on a locked layer. ")
  812.     )
  813.     (vl-position typ '("AcDbLine" "AcDbArc" "AcDbCircle" "AcDb3dPolyline"
  814.        "AcDbPolyline" "AcDb2dPolyline" "AcDbEllipse" "AcDbXline" "AcDbRay"))   
  815.     (if (cadddr arglst)
  816.       (setq p1 (vlax-curve-getClosestPointTo obj p1)
  817.             p2 (vlax-curve-getClosestPointTo obj p2)
  818.       )
  819.       T
  820.     )
  821.     ;With the vlax-curve functions,
  822.     ;rays have a startpoint but no endpoint.
  823.     ;Xlines have neither startpoint or endpoint.
  824.     (if (not (eq typ "AcDbXline"))
  825.       (and
  826.         (setq startpt (vlax-curve-getStartPoint obj))
  827.         (setq startparam (vlax-curve-getStartParam obj))
  828.       )
  829.       T
  830.     )
  831.     (if
  832.       (and
  833.         (not (eq typ "AcDbXline"))
  834.         (not (eq typ "AcDbRay"))
  835.       )
  836.       (and
  837.         (setq endpt (vlax-curve-getEndPoint obj))
  838.         (setq endparam (vlax-curve-getEndParam obj))
  839.       )
  840.       T
  841.     )
  842.     ;param at first point picked
  843.     ;Might be a problem here and next line,
  844.     ;unable to get paramatpoint even with lines, seen 7/10/2005.
  845.     ;May be due to the fact the param/point was 16 miles from 0,0.
  846.     (setq p1param (vlax-curve-getParamAtPoint obj p1))
  847.     ;param at second point picked
  848.     (setq p2param (vlax-curve-getParamAtPoint obj p2))
  849.     ;param closest to start
  850.     (setq minparam (min p1param p2param))
  851.     ;param closest to end
  852.     (setq maxparam (max p1param p2param))
  853.     ;point closest to start
  854.     (setq p1 (vlax-curve-getPointAtParam obj minparam))
  855.     ;point closest to end
  856.     (setq p2 (vlax-curve-getPointAtParam obj maxparam))

  857.     ;call object type sub-functions
  858.     (cond
  859.       ;line
  860.       ((= typ "AcDbLine")
  861.         (BreakLine)
  862.         T
  863.       )
  864.       ;arc
  865.       ((= typ "AcDbArc")
  866.         (BreakArc)
  867.         T
  868.       )
  869.       ;open ellipse
  870.       ((and (= typ "AcDbEllipse")
  871.             (not (vlax-curve-isClosed obj)))
  872.         (BreakOpenEllipse)
  873.         T
  874.       )
  875.       ;closed ellipse
  876.       ((and (= typ "AcDbEllipse")
  877.             (vlax-curve-isClosed obj)
  878.             (not (equal minparam maxparam 1e-12)))
  879.         (BreakClosedEllipse)
  880.         T
  881.       )
  882.       ;circle
  883.       ((and (= typ "AcDbCircle")
  884.             (not (equal minparam maxparam 1e-12)))
  885.         (BreakCircle)
  886.         T
  887.       )
  888.       ;xline
  889.       ((= typ "AcDbXline")
  890.         (BreakXLine)
  891.         T
  892.       )
  893.       ;ray
  894.       ((= typ "AcDbRay")
  895.         (BreakRay)
  896.         T
  897.       )

  898.       ;For break behavior which creates a new lwpline when
  899.       ;break points are at the same point on a closed lwpline.
  900.       ((and (= typ "AcDbPolyline")
  901.             (vlax-curve-isClosed obj)
  902.             (equal minparam maxparam 1e-12))

  903.         ;if /= 0 because break does nothing when
  904.         ;both points are at param 0
  905.         (if (/= 0 minparam)
  906.           (progn
  907.             (vlax-invoke obj 'AddVertex endparam (DelZ endpt))
  908.             (vla-put-closed obj :vlax-false)
  909.             (BreakOpenLWPline)
  910.           )
  911.         )
  912.         T
  913.       )

  914.       ;For break behavior which creates a new heavy pline when
  915.       ;break points are at the same point on a closed heavy pline.
  916.       ((and (= typ "AcDb2dPolyline")
  917.             (vlax-curve-isClosed obj)
  918.             (= 0 (vlax-get obj 'Type))
  919.             (equal minparam maxparam 1e-12))

  920.         ;if /= 0 because break does nothing when
  921.         ;both points are at param 0
  922.         (if (/= 0 minparam)
  923.           (progn
  924.             (vla-put-closed obj :vlax-false)
  925.             (vlax-invoke obj 'AppendVertex endpt)
  926.             (BreakOpenPline)
  927.           )
  928.         )
  929.         T
  930.       )

  931.       ;For break behavior which creates a new 3D pline when
  932.       ;break points are at the same point on a 3D pline.
  933.       ((and (= typ "AcDb3dPolyline")
  934.             (vlax-curve-isClosed obj)
  935.             (= 0 (vlax-get obj 'Type))
  936.             (equal minparam maxparam 1e-12))

  937.         ;if /= 0 because break does nothing when
  938.         ;both points are at param 0
  939.         (if (/= 0 minparam)
  940.           (progn
  941.             (vla-put-closed obj :vlax-false)
  942.             (vlax-invoke obj 'AppendVertex endpt)
  943.             (BreakOpen3DPline)
  944.           )
  945.         )
  946.         T
  947.       )

  948.       ;open lwpline
  949.       ((and (= typ "AcDbPolyline")
  950.             (not (vlax-curve-isClosed obj)))
  951.             (not (vlax-property-available-p obj 'Type))
  952.         (BreakOpenLWPline)
  953.         T
  954.       )
  955.       ;closed lwpline
  956.       ((and (= typ "AcDbPolyline")
  957.             (vlax-curve-isClosed obj))
  958.             (not (vlax-property-available-p obj 'Type))
  959.         (BreakClosedLWPline)
  960.         T
  961.       )
  962.       ;open heavy pline
  963.       ((and (= typ "AcDb2dPolyline")
  964.             (not (vlax-curve-isClosed obj))
  965.             (= 0 (vlax-get obj 'Type)))
  966.         (BreakOpenPline)
  967.         T
  968.       )
  969.       ;closed heavy pline
  970.       ((and (= typ "AcDb2dPolyline")
  971.             (vlax-curve-isClosed obj)
  972.             (= 0 (vlax-get obj 'Type)))
  973.         (BreakClosedPline)
  974.         T
  975.       )
  976.       ;open 3D pline
  977.       ((and (= typ "AcDb3dPolyline")
  978.             (not (vlax-curve-isClosed obj))
  979.             (= 0 (vlax-get obj 'Type)))
  980.         (BreakOpen3DPline)
  981.         T
  982.       )
  983.       ;closed 3D pline
  984.       ((and (= typ "AcDb3dPolyline")
  985.             (vlax-curve-isClosed obj)
  986.             (= 0 (vlax-get obj 'Type)))
  987.         (BreakClosed3DPline)
  988.         T
  989.       )
  990.     ) ;cond

  991.     ;Return: new or modified or deleted object, otherwise nil.
  992.     ;See additional notes at BreakRay and BreakXline sub-functions.
  993.     (cond
  994.       ;obj was erased, return the obj - added cond 5/15/2006
  995.       ((vlax-erased-p obj) (setq res obj))
  996.       ;new vla-object if one was created
  997.       ;((/= spacecnt (vlax-get space 'Count)) ;revised
  998.       ((< spacecnt (vlax-get space 'Count))
  999.         ;Special cond for rays: if a line was added, return the modified ray.
  1000.         ;If a line wasn't added, the next cond returns the modified ray
  1001.         ;given its start point changed.
  1002.         (if (= typ "AcDbRay")
  1003.           (setq res obj)
  1004.           (setq res (vla-item space spacecnt))
  1005.         )
  1006.       )
  1007.       ;or modified vla-object
  1008.       ((or
  1009.         (and startpt
  1010.           (not (equal (DelZ startpt) (DelZ (vlax-curve-getStartPoint obj)) 1e-12)))
  1011.         (and endpt
  1012.           (not (equal (DelZ endpt) (DelZ (vlax-curve-getEndPoint obj)) 1e-12)))
  1013.        )
  1014.        (setq res obj)
  1015.       )
  1016.     )   
  1017.   ) ;and
  1018.   res  
  1019. ) ;end BreakMethod

点评

这就没必要了,我写的那个选择集交点断开都有 上面的就是要用 Bread 命令,简单化  详情 回复 发表于 2013-11-29 23:52
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 593个

财富等级: 财运亨通

 楼主| 发表于 2013-11-29 23:52:39 | 显示全部楼层
xshrimp 发表于 2013-11-29 23:11
用非command打断可以参考
BreakMethod v2.0.lsp

这就没必要了,我写的那个选择集交点断开都有
上面的就是要用 Bread 命令,简单化

brp.gif
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2014-11-14 21:54:01 | 显示全部楼层
正需要,谢谢楼主分享
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 1094个

财富等级: 财源广进

发表于 2021-7-26 00:08:09 | 显示全部楼层
感谢楼主分享her
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 756个

财富等级: 财运亨通

发表于 2021-7-26 00:36:26 | 显示全部楼层
感谢分享源码
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2021-7-28 23:56:36 | 显示全部楼层
很给力的小功能
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-27 06:42 , Processed in 0.232346 second(s), 68 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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