马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
柱子的形心事先生成好了,想要框选柱形心,让旁边的独立的形心对正柱子的,写了一段,但是移动不了,看了很久真不知道哪里有问题,麻烦大家帮看下,谢谢!!!
- (defun c:xxxz ()
- (setvar "osmode" 0)
- (setvar "cmdecho" 0)
- (setq ssb (ssget '((0 . "POINT"))))
- (setq p 0)
- (repeat (sslength ssb)
- (setq name_pt (ssname ssb p))
- (setq pt_cen (cdr (assoc 10 (entget name_pt))))
- (setq pt_a (polar pt_cen (/ pi 2) 3000))
- (setq pt_b (polar pt_cen (/ (* 5 pi) 4) 3000))
- (zxx pt_a pt_b pt_cen)
- (setq p (1+ p))
- )
- (princ)
- )
- ;找形心
- (defun zxx (a b c)
- (vl-load-com)
- (setq ss (ssget "C" a b))
- (setq i 0)
- (repeat (sslength ss)
- (setq name (ssname ss i))
- (setq nameb name)
- (setq obj_type (cdr (assoc 0 (entget name))))
- (setq obj_layer (cdr (assoc 8 (entget name))))
- (if (and (= obj_type "LWPOLYLINE") (= obj_layer "S-DJ"))
- (progn
- (command "copy" name "" 0 0)
- (command "region" name "")
- (setq name2 (entlast))
- (setq name (vlax-ename->vla-object (entlast)))
- (setq centroid (vla-get-Centroid name))
- (setq pt_x (vlax-safearray-get-element
- (vlax-variant-value centroid)
- 0))
- (setq pt_y (vlax-safearray-get-element
- (vlax-variant-value centroid)
- 1))
- (setq pt (list pt_x pt_y 0))
- (command "point" pt)
- (entdel name2)
- (command "move" nameb "" pt c)
- ;;; (princ "11111111111111111")
- )
- )
- (setq i (1+ i))
- )
- )
|