明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1399|回复: 3

聚合线两端缩短的问题?

[复制链接]
发表于 2005-7-27 21:20 | 显示全部楼层 |阅读模式

请各位大侠指点一下,有没有办法在输入一个数值后,能够将未闭合的聚合线缩短,且两端同时缩短?

发表于 2005-7-28 12:47 | 显示全部楼层
  1. ;;no error check
  2. (defun C:TT (/ DIST ENDPT ENT OBJ STARTPT NAME)
  3.   (setq ENT (car (entsel)))
  4.   (setq STARTPT
  5.   (vlax-curve-getstartpoint
  6.     (setq OBJ (vlax-ename->vla-object ENT))
  7.   )
  8.   )
  9.   (setq ENDPT (vlax-curve-getendpoint OBJ))
  10.   (setq NAME (vla-get-objectname OBJ))
  11.   (setq DIST (* -1 (getdist "\n縮短距離: ")))
  12.   (command "_.lengthen"
  13.     "de"
  14.     DIST
  15.     (list ENT STARTPT)
  16.     (if (= "AcDb2dPolyline" NAME)
  17.       (list (entlast) ENDPT)
  18.       (list ENT ENDPT)
  19.     )
  20.     ""
  21.   )
  22.   (princ)
  23. )
发表于 2005-7-28 20:51 | 显示全部楼层
  1. 以前写的
复制代码
  1. ;; dlen = 双向伸缩曲线长度v1.1---lxx2005.3.25!.
  2. (defun c:tt ( / d ss i e lst1 lst2 l1 l2 %k)
  3.   ;(setq lst1 nil lst2 nil)
  4.   (vl-cmdf ".undo" "be")
  5.   (initget 128)
  6.   (setq d (getdist "\n 输入双向伸缩长度(加%为百分比,支持正负数):")
  7. i -1)
  8.   (if (and (= 'STR (type d))(wcmatch d "*%")(> 50 (setq dd (distof(substr d 1 (1-(strlen d)))))))
  9.     (setq %k T)
  10.   )
  11.   (setq ss (ssget '((0 . "LINE,ARC,ELLIPSE,*POLYLINE,SPLINE"))))
  12.   (while (setq e (ssname ss (setq i (1+ i))))
  13.     (setq lst1 (list e (vlax-curve-getstartpoint e))
  14.    lst2 (list e (vlax-curve-getendpoint e)))
  15.     (if %k
  16.       (setq l1 (vlax-curve-getdistatparam e (vlax-curve-getstartparam e))
  17.      l2 (vlax-curve-getdistatparam e (vlax-curve-getendparam e))
  18.      d  (* (/ dd 100) (abs(- l2 l1))))
  19.     )
  20.     (vl-cmdf ".LENGTHEN" "de" d lst1 lst2 "")
  21.   )
  22.   (vl-cmdf ".undo" "e")
  23.   (princ)
  24. )
 楼主| 发表于 2005-7-30 13:16 | 显示全部楼层

感谢两位大侠的热心帮助!

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

本版积分规则

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

GMT+8, 2024-5-21 11:52 , Processed in 0.146469 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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