明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1089|回复: 0

[提问] 半圆 wipeout

[复制链接]
发表于 2016-4-24 01:20:12 | 显示全部楼层 |阅读模式
本帖最后由 baoxiaozhong 于 2016-4-24 01:21 编辑
  1. ;;-------------------=={ Circular Wipeout }==-----------------;;
  2. ;;                                                            ;;
  3. ;;  Enables the user to create a circular wipeout with a      ;;
  4. ;;  given center and radius. Works in all UCS & Views.        ;;
  5. ;;------------------------------------------------------------;;
  6. ;;  Author: Lee Mac, Copyright ?2013 - www.lee-mac.com       ;;
  7. ;;------------------------------------------------------------;;

  8. (defun c:cwipe ( / cen rad )
  9.     (cond
  10.         (   (not
  11.                 (or (member "acwipeout.arx" (arx)) (arxload "acwipeout.arx" nil)
  12.                     (member "acismui.arx"   (arx)) (arxload "acismui.arx"   nil) ;; 2013
  13.                 )
  14.             )
  15.             (princ "\nUnable to load wipeout arx files.")
  16.         )
  17.         (   (and
  18.                 (setq cen (getpoint "\nSpecify Center: "))
  19.                 (setq rad (getdist  "\nSpecify Radius: " cen))
  20.             )
  21.             (LM:CircularWipeout cen rad)
  22.         )
  23.     )
  24.     (princ)
  25. )

  26. ;;-------------------=={ Circle to Wipeout }==----------------;;
  27. ;;                                                            ;;
  28. ;;  Enables the user to convert a selection of circles to     ;;
  29. ;;  wipeout objects matching the original circle properties.  ;;
  30. ;;  Works with circles constructed in any UCS.                ;;
  31. ;;------------------------------------------------------------;;
  32. ;;  Author: Lee Mac, Copyright ?2013 - www.lee-mac.com       ;;
  33. ;;------------------------------------------------------------;;

  34. (defun c:c2wipe ( / ent enx inc sel wip )
  35.     (cond
  36.         (   (not
  37.                 (or (member "acwipeout.arx" (arx)) (arxload "acwipeout.arx" nil)
  38.                     (member "acismui.arx"   (arx)) (arxload "acismui.arx"   nil) ;; 2013
  39.                 )
  40.             )
  41.             (princ "\nUnable to load wipeout arx files.")
  42.         )
  43.         (   (setq sel (ssget "_:L" '((0 . "CIRCLE"))))
  44.             (repeat (setq inc (sslength sel))
  45.                 (setq ent (ssname sel (setq inc (1- inc)))
  46.                       enx (entget ent)
  47.                       wip (LM:CircularWipeout (trans (cdr (assoc 10 enx)) ent 1) (cdr (assoc 40 enx)))
  48.                 )
  49.                 (if wip
  50.                     (progn
  51.                         (entmod (cons (cons -1 wip) (LM:defaultprops (entget wip))))
  52.                         (entdel ent)
  53.                     )
  54.                 )
  55.             )
  56.         )
  57.     )
  58.     (princ)
  59. )

  60. ;; Default Properties  -  Lee Mac
  61. ;; Returns a list of DXF properties for the supplied DXF data,
  62. ;; substituting default values for absent DXF groups

  63. (defun LM:defaultprops ( elist )
  64.     (mapcar
  65.         (function
  66.             (lambda ( pair )
  67.                 (cond ((assoc (car pair) elist)) ( pair ))
  68.             )
  69.         )
  70.        '(
  71.             (008 . "0")
  72.             (006 . "BYLAYER")
  73.             (039 . 0.0)
  74.             (062 . 256)
  75.             (048 . 1.0)
  76.             (370 . -1)
  77.         )
  78.     )
  79. )

  80. ;; Circular Wipeout  -  Lee Mac
  81. ;; Creates a circular wipeout with the given center (UCS) & radius

  82. (defun LM:CircularWipeout ( cen rad / ang inc lst )
  83.     (setq acc 50
  84.           inc (/ pi acc 0.5)
  85.           ang 0.0
  86.     )
  87.     (repeat acc
  88.         (setq lst (cons (list 14 (* 0.5 (cos ang)) (* 0.5 (sin ang))) lst)
  89.               ang (+ ang inc)
  90.         )
  91.     )
  92.     (entmakex
  93.         (append
  94.             (list
  95.                '(000 . "WIPEOUT")
  96.                '(100 . "AcDbEntity")
  97.                '(100 . "AcDbWipeout")
  98.                 (cons 10 (trans (mapcar '- cen (list rad rad)) 1 0))
  99.                 (cons 11 (trans (list (+ rad rad) 0.0) 1 0 t))
  100.                 (cons 12 (trans (list 0.0 (+ rad rad)) 1 0 t))
  101.                '(280 . 1)
  102.                '(071 . 2)
  103.             )
  104.             (cons (last lst) lst)
  105.         )
  106.     )
  107. )
  108. (princ)
上面的代碼是 LEE MAC寫的全圓 WIPEOUT ,但是我只需要半圓WIPEOUT,而且需要設定方向性,也就是可設定是零度、90度、180 度 、270度的方向 WIPEOUT,請問要如何修改上面代碼?
"觉得好,就打赏"
还没有人打赏,支持一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-1 02:51 , Processed in 0.167736 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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