也许这是一个简单的代码,但要小心选择和输入参考点。。。
- (defun c:radialmove ( / *error* pick k ent p entplst c orth pp d )
- (defun *error* ( msg )
- (if pick (setvar 'pickbox pick))
- (if orth (setvar 'orthomode orth))
- (if msg (prompt msg))
- (princ)
- )
- (command "_.ucs" "_W")
- (setq pick (getvar 'pickbox))
- (setvar 'pickbox 5)
- (setq k 0)
- (while
- (setq ent (car (entsel (strcat "\nPick entity (" (itoa (setq k (1+ k))) ") on which to perform radial move (ENTER OR RIGHT CLICK OR MISSED SELECTION WITH LEFT CLICK - FINISH)"))))
- (setq p (getpoint (strcat "\nPick or specify reference point of entity (" (itoa k) ") from which to perform radial move : ")))
- (setq entplst (cons (cons p ent) entplst))
- (if ent t nil)
- )
- (setq c (getpoint "\nPick or specify center point for radial move : "))
- (setq orth (getvar 'orthomode))
- (setvar 'orthomode 1)
- (command "_.ucs" "_3P" c (car (last entplst)) "")
- (command "_.move" (cdr (last entplst)) "" (trans (car (last entplst)) 0 1) "\")
- (setq pp (trans (getvar 'lastpoint) 1 0))
- (command "_.ucs" "_P")
- (setq d (- (distance c (car (last entplst))) (distance c pp)))
- (setq entplst (cdr (reverse entplst)))
- (foreach entp entplst
- (command "_.move" (cdr entp) "" (car entp) (polar c (angle c (car entp)) (- (distance c (car entp)) d)))
- )
- (command "_.ucs" "_P")
- (*error* nil)
- (princ)
- )
另一个代码-您现在可以确保不会错过选择。。。它与sel一起工作。集合,但您可以单独选择每个实体,而不用担心会错过选择。。。
- (defun c:radialmove ( / *error* k loop entss ent p i entplst c orth pp d )
- (defun *error* ( msg )
- (if orth (setvar 'orthomode orth))
- (if msg (prompt msg))
- (princ)
- )
- (command "_.ucs" "_W")
- (setq k 0)
- (setq loop t)
- (while loop
- (prompt (strcat "\nPick entity sel.set (" (itoa (setq k (1+ k))) ") on which to perform radial move (ENTER OR RIGHT CLICK - FINISH)"))
- (setq entss (ssget "_:L"))
- (if entss
- (progn
- (setq p (getpoint (strcat "\nPick or specify reference point of entity sel.set (" (itoa k) ") from which to perform radial move : ")))
- (setq i (sslength entss))
- (while (setq ent (ssname entss (setq i (1- i))))
- (setq entplst (cons (cons p ent) entplst))
- )
- )
- (setq loop nil)
- )
- )
- (setq c (getpoint "\nPick or specify center point for radial move : "))
- (setq orth (getvar 'orthomode))
- (setvar 'orthomode 1)
- (command "_.ucs" "_3P" c (car (last entplst)) "")
- (command "_.move" (cdr (last entplst)) "" (trans (car (last entplst)) 0 1) "\")
- (setq pp (trans (getvar 'lastpoint) 1 0))
- (command "_.ucs" "_P")
- (setq d (- (distance c (car (last entplst))) (distance c pp)))
- (setq entplst (cdr (reverse entplst)))
- (foreach entp entplst
- (command "_.move" (cdr entp) "" (car entp) (polar c (angle c (car entp)) (- (distance c (car entp)) d)))
- )
- (command "_.ucs" "_P")
- (*error* nil)
- (princ)
- )
M、 R。 |