明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1610|回复: 1

一段程式的奇怪现象,大家看看

[复制链接]
发表于 2010-6-26 18:50:00 | 显示全部楼层 |阅读模式
;如下一段程试,当将座标转动任意角度后执行不了;在世界座标下正常
;不明白为什么这段产生异常
  1.   ;(setq pt (vlax-curve-getClosestPointTo (car en) (cadr en)))
  2.   ;(setq endata (entget (car en))
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4. (defun c:test1 ( );(/ a0 a50 a51 a40 endata str zb en  paa pbb);enpt
  5.   (vl-load-com)
  6.   (while (not (and (setq en (entsel "\n请选择要拉伸多段线:"))
  7.      (ssget (cadr en)
  8.      (list (cons -4 "<or")
  9.     (cons 0 "*polyline")
  10.     (cons 0 "line")
  11.     (cons 0 "spline")
  12.     (cons 0 "mline")
  13.     (cons 0 "arc")
  14.     (cons -4 "or>")
  15.      )
  16.      )
  17.      
  18.        )   
  19.   )
  20.   )
  21.   (setq pt (vlax-curve-getClosestPointTo (car en) (cadr en)))
  22.      
  23.   (setq endata (entget (car en))
  24.   )
  25.   (setq newdyx (car en))
  26.   (if (or (= "LWPOLYLINE" (dxf 0 newdyx)) (= "SPLINE" (dxf 0 newdyx)) (= "MLINE" (dxf 0 newdyx)))
  27.    (progn
  28.    (command "explode" newdyx)
  29.    ))
  30.   (setq enpt (car (nentselp pt)))
  31.   (command "erase" enpt ""))
  32. ;;获取群码
  33. (defun dxf (n ename)
  34.   (cdr (assoc n (entget ename)))
  35. )

本帖子中包含更多资源

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

x
发表于 2012-5-28 09:50:04 | 显示全部楼层
函数vlax-curve-getClosestPointTo 在wcs坐标系里才会返回真确的值。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-9-25 11:01 , Processed in 0.164197 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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