benhubel 发表于 2022-7-5 17:42:35

软选择/比例编辑

在Maya中,它被称为软选择。在Blender中,它被称为比例编辑模式。我正在寻找一种工具,可以让我移动夹点,使附近的所有顶点朝同一方向移动。移动量取决于距离选定夹点的距离以及设置衰减的锐度。
 
一些视频让你了解我在说什么:
软选择-
比例编辑-
 
总体思路是,当用户选择夹点时,LISP将搜索最大衰减范围内的所有有效顶点。接下来,当用户移动(或缩放,缩放也会很酷)该夹点时,每个受影响的顶点都会以目标顶点移动距离的百分比向该方向移动,这取决于它与该目标顶点的距离。
 
如果还有一个选项允许代码仅影响作为同一多段线的一部分连接到目标顶点的线,则会获得额外的分数。如果代码被大量注释,那么我可以看到发生了什么,这将获得额外的加分。这个节目太离谱了,我真的很想知道怎么做。
 
 
**编辑**
我不在乎它是否在3d中工作。在使用AutoCAD时,我通常只使用2d。

marko_ribar 发表于 2022-7-5 17:52:29

你好我想我已经使用了直观的变量名,所以我没有对代码进行注释,但是如果你不理解什么,只要问一下。。。我和其他人可能会给你正确的解释。。。
 
(defun c:softselvertmod ( / *error* barycent *adoc* ucsf osm 3dosm ss e ch pl p vl c r v v1 vln eg ex xx p1 p2 rf gr ux uy uc )

(vl-load-com)

(defun *error* ( m )
   (if ucsf
   (command "_.UCS" "_P")
   )
   (if osm
   (setvar 'osmode osm)
   )
   (if 3dosm
   (setvar '3dosmode 3dosm)
   )
   (vla-endundomark *adoc*)
   (if m
   (prompt m)
   )
   (princ)
)

(defun barycent ( l )
   (mapcar '(lambda ( x ) (/ x (length l))) (list (apply '+ (mapcar 'car l)) (apply '+ (mapcar 'cadr l)) (apply '+ (mapcar 'caddr l))))
)

(vla-startundomark (setq *adoc* (vla-get-activedocument (vlax-get-acad-object))))
(if (= (getvar 'worlducs) 0)
   (progn
   (command "_.UCS" "_W")
   (setq ucsf t)
   )
)
(setq osm (getvar 'osmode))
(if (getvar '3dosmode)
   (setq 3dosm (getvar '3dosmode))
)
(prompt "\nPick editable entity for softselvertmod (SPLINE,POLYLINE,MESH,POLYFACE MESH) on unlocked layer...")
(setq ss (ssget "_+.:E:S:L" '((0 . "*POLYLINE,SPLINE,MESH"))))
(while (not ss)
   (prompt "\nMissed - empty sel.set... Please pick editable entity for softselvertmod (SPLINE,POLYLINE,MESH,POLYFACE MESH) on unlocked layer...")
   (setq ss (ssget "_+.:E:S:L" '((0 . "*POLYLINE,SPLINE,MESH"))))
)
(setq e (ssname ss 0))
(initget "Move-Stretch Twist Scale-Shrink")
(setq ch (getkword "\nChoose mode <Move-Stretch> : "))
(if (null ch)
   (setq ch "Move-Stretch")
)
(cond
   ( (= ch "Move-Stretch")
   (cond
       ( (= (cdr (assoc 0 (entget e))) "LWPOLYLINE")
         (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget e)))) e 0)) (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e)))))
         (command "_.UCS" "_E" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons (trans p 1 0) vl))
         (print (trans p 1 0))
         )
         (setvar 'osmode 0)
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.CIRCLE" "_non" (trans c 0 1) "\\")
         (setq r (cdr (assoc 40 (entget (entlast)))))
         (entdel (entlast))
         (setq p1 (getpoint (trans c 0 1) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (trans p2 1 0) (trans p1 1 0)))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_3P" "_non" p1 "_non" p2 "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (mapcar '+ p (mapcar '* v (list (/ (- r (distance c p)) r) (/ (- r (distance c p)) r) (/ (- r (distance c p)) r))))) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) (mapcar '+ '(0.0 0.0) (trans y 0 e)) 1e-6)) vl)) (cons 10 (mapcar '+ '(0.0 0.0) (trans (nth (vl-position (car xx) vl) vln) 0 e))) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( (and (= (cdr (assoc 0 (entget e))) "POLYLINE") (= "AcDb2dPolyline" (cdr (assoc 100 (reverse (entget e)))))) ;;; - it's old heavy 2D POLYLINE
         (command "_.CONVERTPOLY" "_L" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget e)))) e 0)) (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e)))))
         (command "_.UCS" "_E" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons (trans p 1 0) vl))
         (print (trans p 1 0))
         )
         (setvar 'osmode 0)
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.CIRCLE" "_non" (trans c 0 1) "\\")
         (setq r (cdr (assoc 40 (entget (entlast)))))
         (entdel (entlast))
         (setq p1 (getpoint (trans c 0 1) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (trans p2 1 0) (trans p1 1 0)))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (setq eg (entget e))
         (command "_.UCS" "_3P" "_non" p1 "_non" p2 "")
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (mapcar '+ p (mapcar '* v (list (/ (- r (distance c p)) r) (/ (- r (distance c p)) r) (/ (- r (distance c p)) r))))) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) (mapcar '+ '(0.0 0.0) (trans y 0 e)) 1e-6)) vl)) (cons 10 (mapcar '+ '(0.0 0.0) (trans (nth (vl-position (car xx) vl) vln) 0 e))) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
         (command "_.CONVERTPOLY" "_H" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
       )
       ( (= (cdr (assoc 0 (entget e))) "POLYLINE") ;;; it's 3DPOLYLINE or POLYFACE MESH
         (setq v e)
         (while (= (cdr (assoc 0 (entget (setq v (entnext v))))) "VERTEX")
         (setq pl (cons (cdr (assoc 10 (entget v))) pl))
         )
         (setq pl (reverse pl))
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setvar 'osmode 0)
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (mapcar '+ p (mapcar '* v (list (/ (- r (distance c p)) r) (/ (- r (distance c p)) r) (/ (- r (distance c p)) r))))) vl))
         (setq v e)
         (while (= (cdr (assoc 0 (entget (setq v (entnext v))))) "VERTEX")
             (if (setq xx (vl-member-if '(lambda ( p ) (equal p (cdr (assoc 10 (entget v))) 1e-6)) vl))
               (entupd (cdr (assoc -1 (entmod (subst (cons 10 (nth (vl-position (car xx) vl) vln)) (assoc 10 (entget v)) (entget v))))))
             )
         )
         (entupd e)
         (setq vl vln)
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( (= (cdr (assoc 0 (entget e))) "MESH") ;;; it's MESH
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e))))
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setvar 'osmode 0)
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (setq eg (entget e))
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (mapcar '+ p (mapcar '* v (list (/ (- r (distance c p)) r) (/ (- r (distance c p)) r) (/ (- r (distance c p)) r))))) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) y 1e-6)) vl)) (cons (car x) (nth (vl-position (car xx) vl) vln)) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( t ;;; else - it's SPLINE
         (if (assoc 11 (entget e))
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 11)) (entget e))))
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e))))
         )
         (if (getvar '3dosmode)
         (progn
             (setvar '3dosmode 16)
             (setvar 'osmode 0)
         )
         (setvar 'osmode 1)
         )
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (if (getvar '3dosmode)
         (progn
             (setvar '3dosmode 0)
             (setvar 'osmode 0)
         )
         (setvar 'osmode 0)
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (setq eg (entget e))
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (mapcar '+ p (mapcar '* v (list (/ (- r (distance c p)) r) (/ (- r (distance c p)) r) (/ (- r (distance c p)) r))))) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) y 1e-6)) vl)) (cons (car x) (nth (vl-position (car xx) vl) vln)) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
   )
   )
   ( (= ch "Twist")
   (cond
       ( (= (cdr (assoc 0 (entget e))) "LWPOLYLINE")
         (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget e)))) e 0)) (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e)))))
         (command "_.UCS" "_E" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons (trans p 1 0) vl))
         (print (trans p 1 0))
         )
         (setvar 'osmode 0)
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.CIRCLE" "_non" (trans c 0 1) "\\")
         (setq r (cdr (assoc 40 (entget (entlast)))))
         (entdel (entlast))
         (setq p1 (getpoint (trans c 0 1) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (trans p2 1 0) (trans p1 1 0)))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (setq c (mapcar '+ c (mapcar '* (mapcar '- c (barycent vl)) (list 0.5 0.5 0.5))))
         (initget 2)
         (setq rf (getreal "\nSpecify rotation factor per vector intensity in decimal degrees <10.0> : "))
         (if (null rf)
         (setq rf 10.0)
         )
         (command "_.UCS" "_3P" "_non" p1 "_non" p2 "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 e) (+ (angle (trans p1 0 e) (trans p 0 e)) (* (if (equal (distance c p) 0.0 1e-6) (/ (distance '(0.0 0.0 0.0) v) 0.1) (/ (distance '(0.0 0.0 0.0) v) (distance c p))) (cvunit rf "degree" "radian"))) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 e)) (trans p 0 e)))) (list (caddr (trans p 0 e)))) e 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) (mapcar '+ '(0.0 0.0) (trans y 0 e)) 1e-6)) vl)) (cons 10 (mapcar '+ '(0.0 0.0) (trans (nth (vl-position (car xx) vl) vln) 0 e))) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( (and (= (cdr (assoc 0 (entget e))) "POLYLINE") (= "AcDb2dPolyline" (cdr (assoc 100 (reverse (entget e)))))) ;;; - it's old heavy 2D POLYLINE
         (command "_.CONVERTPOLY" "_L" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget e)))) e 0)) (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e)))))
         (command "_.UCS" "_E" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons (trans p 1 0) vl))
         (print (trans p 1 0))
         )
         (setvar 'osmode 0)
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.CIRCLE" "_non" (trans c 0 1) "\\")
         (setq r (cdr (assoc 40 (entget (entlast)))))
         (entdel (entlast))
         (setq p1 (getpoint (trans c 0 1) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (trans p2 1 0) (trans p1 1 0)))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (setq c (mapcar '+ c (mapcar '* (mapcar '- c (barycent vl)) (list 0.5 0.5 0.5))))
         (initget 2)
         (setq rf (getreal "\nSpecify rotation factor per vector intensity in decimal degrees <10.0> : "))
         (if (null rf)
         (setq rf 10.0)
         )
         (command "_.UCS" "_3P" "_non" p1 "_non" p2 "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 e) (+ (angle (trans p1 0 e) (trans p 0 e)) (* (if (equal (distance c p) 0.0 1e-6) (/ (distance '(0.0 0.0 0.0) v) 0.1) (/ (distance '(0.0 0.0 0.0) v) (distance c p))) (cvunit rf "degree" "radian"))) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 e)) (trans p 0 e)))) (list (caddr (trans p 0 e)))) e 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) (mapcar '+ '(0.0 0.0) (trans y 0 e)) 1e-6)) vl)) (cons 10 (mapcar '+ '(0.0 0.0) (trans (nth (vl-position (car xx) vl) vln) 0 e))) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
         (command "_.CONVERTPOLY" "_H" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
       )
       ( (= (cdr (assoc 0 (entget e))) "POLYLINE") ;;; it's 3DPOLYLINE or POLYFACE MESH
         (setq v e)
         (while (= (cdr (assoc 0 (entget (setq v (entnext v))))) "VERTEX")
         (setq pl (cons (cdr (assoc 10 (entget v))) pl))
         )
         (setq pl (reverse pl))
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setvar 'osmode 0)
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (setq c (mapcar '+ c (mapcar '* (mapcar '- c (barycent vl)) (list 0.5 0.5 0.5))))
         (initget 2)
         (setq rf (getreal "\nSpecify rotation factor per vector intensity in decimal degrees <10.0> : "))
         (if (null rf)
         (setq rf 10.0)
         )
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 v) (+ (angle (trans p1 0 v) (trans p 0 v)) (* (if (equal (distance c p) 0.0 1e-6) (/ (distance '(0.0 0.0 0.0) v) 0.1) (/ (distance '(0.0 0.0 0.0) v) (distance c p))) (cvunit rf "degree" "radian"))) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)))) (list (caddr (trans p 0 v)))) v 0)) vl))
         (setq v e)
         (while (= (cdr (assoc 0 (entget (setq v (entnext v))))) "VERTEX")
             (if (setq xx (vl-member-if '(lambda ( p ) (equal p (cdr (assoc 10 (entget v))) 1e-6)) vl))
               (entupd (cdr (assoc -1 (entmod (subst (cons 10 (nth (vl-position (car xx) vl) vln)) (assoc 10 (entget v)) (entget v))))))
             )
         )
         (entupd e)
         (setq vl vln)
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( (= (cdr (assoc 0 (entget e))) "MESH") ;;; it's MESH
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e))))
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setvar 'osmode 0)
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (setq c (mapcar '+ c (mapcar '* (mapcar '- c (barycent vl)) (list 0.5 0.5 0.5))))
         (initget 2)
         (setq rf (getreal "\nSpecify rotation factor per vector intensity in decimal degrees <10.0> : "))
         (if (null rf)
         (setq rf 10.0)
         )
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1))
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 v) (+ (angle (trans p1 0 v) (trans p 0 v)) (* (if (equal (distance c p) 0.0 1e-6) (/ (distance '(0.0 0.0 0.0) v) 0.1) (/ (distance '(0.0 0.0 0.0) v) (distance c p))) (cvunit rf "degree" "radian"))) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)))) (list (caddr (trans p 0 v)))) v 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) y 1e-6)) vl)) (cons (car x) (nth (vl-position (car xx) vl) vln)) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( t ;;; else - it's SPLINE
         (if (assoc 11 (entget e))
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 11)) (entget e))))
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e))))
         )
         (if (getvar '3dosmode)
         (progn
             (setvar '3dosmode 16)
             (setvar 'osmode 0)
         )
         (setvar 'osmode 1)
         )
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (if (getvar '3dosmode)
         (progn
             (setvar '3dosmode 0)
             (setvar 'osmode 0)
         )
         (setvar 'osmode 0)
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (setq c (mapcar '+ c (mapcar '* (mapcar '- c (barycent vl)) (list 0.5 0.5 0.5))))
         (initget 2)
         (setq rf (getreal "\nSpecify rotation factor per vector intensity in decimal degrees <10.0> : "))
         (if (null rf)
         (setq rf 10.0)
         )
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1))
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 v) (+ (angle (trans p1 0 v) (trans p 0 v)) (* (if (equal (distance c p) 0.0 1e-6) (/ (distance '(0.0 0.0 0.0) v) 0.1) (/ (distance '(0.0 0.0 0.0) v) (distance c p))) (cvunit rf "degree" "radian"))) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)))) (list (caddr (trans p 0 v)))) v 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) y 1e-6)) vl)) (cons (car x) (nth (vl-position (car xx) vl) vln)) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
   )
   )
   ( (= ch "Scale-Shrink")
   (cond
       ( (= (cdr (assoc 0 (entget e))) "LWPOLYLINE")
         (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget e)))) e 0)) (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e)))))
         (command "_.UCS" "_E" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons (trans p 1 0) vl))
         (print (trans p 1 0))
         )
         (setvar 'osmode 0)
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.CIRCLE" "_non" (trans c 0 1) "\\")
         (setq r (cdr (assoc 40 (entget (entlast)))))
         (entdel (entlast))
         (setq p1 (getpoint (trans c 0 1) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (trans p2 1 0) (trans p1 1 0)))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_3P" "_non" p1 "_non" p2 "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 e) (angle (trans p1 0 e) (trans p 0 e)) (if (equal (distance c p) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance c p))))) (list (caddr (trans p 0 e)))) e 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) (mapcar '+ '(0.0 0.0) (trans y 0 e)) 1e-6)) vl)) (cons 10 (mapcar '+ '(0.0 0.0) (trans (nth (vl-position (car xx) vl) vln) 0 e))) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( (and (= (cdr (assoc 0 (entget e))) "POLYLINE") (= "AcDb2dPolyline" (cdr (assoc 100 (reverse (entget e)))))) ;;; - it's old heavy 2D POLYLINE
         (command "_.CONVERTPOLY" "_L" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget e)))) e 0)) (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e)))))
         (command "_.UCS" "_E" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons (trans p 1 0) vl))
         (print (trans p 1 0))
         )
         (setvar 'osmode 0)
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.CIRCLE" "_non" (trans c 0 1) "\\")
         (setq r (cdr (assoc 40 (entget (entlast)))))
         (entdel (entlast))
         (setq p1 (getpoint (trans c 0 1) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (trans p2 1 0) (trans p1 1 0)))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_3P" "_non" p1 "_non" p2 "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 e) (angle (trans p1 0 e) (trans p 0 e)) (if (equal (distance c p) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance c p))))) (list (caddr (trans p 0 e)))) e 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) (mapcar '+ '(0.0 0.0) (trans y 0 e)) 1e-6)) vl)) (cons 10 (mapcar '+ '(0.0 0.0) (trans (nth (vl-position (car xx) vl) vln) 0 e))) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
         (command "_.CONVERTPOLY" "_H" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
       )
       ( (= (cdr (assoc 0 (entget e))) "POLYLINE") ;;; it's 3DPOLYLINE or POLYFACE MESH
         (setq v e)
         (while (= (cdr (assoc 0 (entget (setq v (entnext v))))) "VERTEX")
         (setq pl (cons (cdr (assoc 10 (entget v))) pl))
         )
         (setq pl (reverse pl))
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setvar 'osmode 0)
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 v) (angle (trans p1 0 v) (trans p 0 v)) (if (equal (distance c p) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance c p))))) (list (caddr (trans p 0 v)))) v 0)) vl))
         (setq v e)
         (while (= (cdr (assoc 0 (entget (setq v (entnext v))))) "VERTEX")
             (if (setq xx (vl-member-if '(lambda ( p ) (equal p (cdr (assoc 10 (entget v))) 1e-6)) vl))
               (entupd (cdr (assoc -1 (entmod (subst (cons 10 (nth (vl-position (car xx) vl) vln)) (assoc 10 (entget v)) (entget v))))))
             )
         )
         (entupd e)
         (setq vl vln)
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( (= (cdr (assoc 0 (entget e))) "MESH") ;;; it's MESH
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e))))
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setvar 'osmode 0)
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1))
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 v) (angle (trans p1 0 v) (trans p 0 v)) (if (equal (distance c p) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance c p))))) (list (caddr (trans p 0 v)))) v 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) y 1e-6)) vl)) (cons (car x) (nth (vl-position (car xx) vl) vln)) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( t ;;; else - it's SPLINE
         (if (assoc 11 (entget e))
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 11)) (entget e))))
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e))))
         )
         (if (getvar '3dosmode)
         (progn
             (setvar '3dosmode 16)
             (setvar 'osmode 0)
         )
         (setvar 'osmode 1)
         )
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for softselvertmod - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (if (getvar '3dosmode)
         (progn
             (setvar '3dosmode 0)
             (setvar 'osmode 0)
         )
         (setvar 'osmode 0)
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of softselvertmod : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of softselvertmod : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1))
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 v) (angle (trans p1 0 v) (trans p 0 v)) (if (equal (distance c p) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance c p))))) (list (caddr (trans p 0 v)))) v 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) y 1e-6)) vl)) (cons (car x) (nth (vl-position (car xx) vl) vln)) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
   )
   )
)
(*error* nil)
)
HTH,M.R。

benhubel 发表于 2022-7-5 17:53:27

啊,是的!虽然它有点笨重,但它肯定有我开始使用所需的一切。非常感谢。
我将研究如何简化界面,以及允许用户更改衰减。我的主要目标是使用某种形式的钟形曲线。

marko_ribar 发表于 2022-7-5 18:02:12

我已经更新了它,包括扭曲选项。。。
 
M、 R。

marko_ribar 发表于 2022-7-5 18:06:03

我已经将其更新为包括缩放收缩选项。。。还添加了(grread while loop)以使视觉上更容易接受。。。
 
M、 R。

marko_ribar 发表于 2022-7-5 18:12:18

代码再次更新,但没有我预期的那么好。。。

benhubel 发表于 2022-7-5 18:16:50

live adjust使其更为有用。它还帮助我了解它的工作原理,以便我可以更轻松地编辑它。
不过,我对扭曲选项有点困惑。看起来很奇怪。

marko_ribar 发表于 2022-7-5 18:22:17

 
这是因为我已经尝试并成功地从您发布的视频剪辑示例中复制了vulcano教程。。。关键是,最上面的面应该旋转(扭曲)最多,而最接近底部的面旋转(扭曲)最少——所以我在(setq vln…)的公式中包含了这一点。。。但你是对的-在大多数情况下,像我最新的测试,这是奇怪的,但什么。M、 R。

benhubel 发表于 2022-7-5 18:27:27

我稍微修改了代码,使工作流更快,更易于使用。它不再要求向量的第一个点,现在使用圆半径使用的同一点。
 
有没有一种合理的方法可以根据光标位置动态地改变矢量的方向,就像比例那样?在我看来,向量方向似乎改变了UCS,我不确定这样不断更新UCS是否合适。
 
**编辑**
似乎我在将第一个向量点更改为比例圆心时,在获取比例特征方面遇到了轻微的困难。
 
(defun c:sse () (c:SoftSelectEdit)) ;shortcut to call SoftSelectEdit
(defun c:SoftSelectEdit ( / *error* barycent *adoc* ucsf osm 3dosm ss e ch pl p vl c r v v1 vln eg ex xx p1 p2 rf gr ux uy uc )

(vl-load-com)

(defun *error* ( m )
   (if ucsf
   (command "_.UCS" "_P")
   )
   (if osm
   (setvar 'osmode osm)
   )
   (if 3dosm
   (setvar '3dosmode 3dosm)
   )
   (vla-endundomark *adoc*)
   (if m
   (prompt m)
   )
   (princ)
)

(defun barycent ( l )
   (mapcar '(lambda ( x ) (/ x (length l))) (list (apply '+ (mapcar 'car l)) (apply '+ (mapcar 'cadr l)) (apply '+ (mapcar 'caddr l))))
)

(vla-startundomark (setq *adoc* (vla-get-activedocument (vlax-get-acad-object))))
(if (= (getvar 'worlducs) 0)
   (progn
   (command "_.UCS" "_W")
   (setq ucsf t)
   )
)
(setq osm (getvar 'osmode))
(if (getvar '3dosmode)
   (setq 3dosm (getvar '3dosmode))
)
(prompt "\nPick editable entity for SoftSelectEdit (SPLINE,POLYLINE,MESH,POLYFACE MESH) on unlocked layer...")
(setq ss (ssget "_+.:E:S:L" '((0 . "*POLYLINE,SPLINE,MESH"))))
(while (not ss)
   (prompt "\nMissed - empty sel.set... Please pick editable entity for SoftSelectEdit (SPLINE,POLYLINE,MESH,POLYFACE MESH) on unlocked layer...")
   (setq ss (ssget "_+.:E:S:L" '((0 . "*POLYLINE,SPLINE,MESH"))))
)
(setq e (ssname ss 0))
(initget "Move-Stretch Twist Scale-Shrink")
(setq ch (getkword "\nChoose mode <Move-Stretch> : "))
(if (null ch)
   (setq ch "Move-Stretch")
)
(cond
   ( (= ch "Move-Stretch")
   (cond
       ( (= (cdr (assoc 0 (entget e))) "LWPOLYLINE")
         (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget e)))) e 0)) (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e)))))
         (command "_.UCS" "_E" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons (trans p 1 0) vl))
         (print (trans p 1 0))
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.CIRCLE" "_non" (trans c 0 1) "\\")
         (setq r (cdr (assoc 40 (entget (entlast)))))
         (entdel (entlast))
         (setq p1 (trans c 0 1)) ;use the circle center point as the vector start point
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (trans p2 1 0) (trans p1 1 0)))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_3P" "_non" p1 "_non" p2 "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (mapcar '+ p (mapcar '* v (list (/ (- r (distance c p)) r) (/ (- r (distance c p)) r) (/ (- r (distance c p)) r))))) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) (mapcar '+ '(0.0 0.0) (trans y 0 e)) 1e-6)) vl)) (cons 10 (mapcar '+ '(0.0 0.0) (trans (nth (vl-position (car xx) vl) vln) 0 e))) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( (and (= (cdr (assoc 0 (entget e))) "POLYLINE") (= "AcDb2dPolyline" (cdr (assoc 100 (reverse (entget e)))))) ;;; - it's old heavy 2D POLYLINE
         (command "_.CONVERTPOLY" "_L" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget e)))) e 0)) (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e)))))
         (command "_.UCS" "_E" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons (trans p 1 0) vl))
         (print (trans p 1 0))
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.CIRCLE" "_non" (trans c 0 1) "\\")
         (setq r (cdr (assoc 40 (entget (entlast)))))
         (entdel (entlast))
         (setq p1 (getpoint (trans c 0 1) "\nPick or specify start point of vector of softselvertmod : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (trans p2 1 0) (trans p1 1 0)))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (setq eg (entget e))
         (command "_.UCS" "_3P" "_non" p1 "_non" p2 "")
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (mapcar '+ p (mapcar '* v (list (/ (- r (distance c p)) r) (/ (- r (distance c p)) r) (/ (- r (distance c p)) r))))) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) (mapcar '+ '(0.0 0.0) (trans y 0 e)) 1e-6)) vl)) (cons 10 (mapcar '+ '(0.0 0.0) (trans (nth (vl-position (car xx) vl) vln) 0 e))) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
         (command "_.CONVERTPOLY" "_H" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
       )
       ( (= (cdr (assoc 0 (entget e))) "POLYLINE") ;;; it's 3DPOLYLINE or POLYFACE MESH
         (setq v e)
         (while (= (cdr (assoc 0 (entget (setq v (entnext v))))) "VERTEX")
         (setq pl (cons (cdr (assoc 10 (entget v))) pl))
         )
         (setq pl (reverse pl))
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1) "")
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (mapcar '+ p (mapcar '* v (list (/ (- r (distance c p)) r) (/ (- r (distance c p)) r) (/ (- r (distance c p)) r))))) vl))
         (setq v e)
         (while (= (cdr (assoc 0 (entget (setq v (entnext v))))) "VERTEX")
             (if (setq xx (vl-member-if '(lambda ( p ) (equal p (cdr (assoc 10 (entget v))) 1e-6)) vl))
               (entupd (cdr (assoc -1 (entmod (subst (cons 10 (nth (vl-position (car xx) vl) vln)) (assoc 10 (entget v)) (entget v))))))
             )
         )
         (entupd e)
         (setq vl vln)
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( (= (cdr (assoc 0 (entget e))) "MESH") ;;; it's MESH
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e))))
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (setq eg (entget e))
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1) "")
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (mapcar '+ p (mapcar '* v (list (/ (- r (distance c p)) r) (/ (- r (distance c p)) r) (/ (- r (distance c p)) r))))) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) y 1e-6)) vl)) (cons (car x) (nth (vl-position (car xx) vl) vln)) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( t ;;; else - it's SPLINE
         (if (assoc 11 (entget e))
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 11)) (entget e))))
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e))))
         )
         (if (getvar '3dosmode)
         (progn
             (setvar '3dosmode 16)
             (setvar 'osmode 0)
         )
         (setvar 'osmode 1)
         )
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (setq eg (entget e))
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1) "")
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (mapcar '+ p (mapcar '* v (list (/ (- r (distance c p)) r) (/ (- r (distance c p)) r) (/ (- r (distance c p)) r))))) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) y 1e-6)) vl)) (cons (car x) (nth (vl-position (car xx) vl) vln)) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
   )
   )
   ( (= ch "Twist")
   (cond
       ( (= (cdr (assoc 0 (entget e))) "LWPOLYLINE")
         (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget e)))) e 0)) (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e)))))
         (command "_.UCS" "_E" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons (trans p 1 0) vl))
         (print (trans p 1 0))
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.CIRCLE" "_non" (trans c 0 1) "\\")
         (setq r (cdr (assoc 40 (entget (entlast)))))
         (entdel (entlast))
         (setq p1 (getpoint (trans c 0 1) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (trans p2 1 0) (trans p1 1 0)))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (initget 2)
         (setq rf (getreal "\nSpecify rotation factor per vector intensity in decimal degrees <10.0> : "))
         (if (null rf)
         (setq rf 10.0)
         )
         (command "_.UCS" "_3P" "_non" p1 "_non" p2 "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 e) (+ (angle (trans p1 0 e) (trans p 0 e)) (* (if (equal (distance (mapcar '+ '(0.0 0.0) (trans p1 0 e)) (trans p 0 e)) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 e)) (trans p 0 e)))) (cvunit rf "degree" "radian"))) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 e)) (trans p 0 e)))) (list (caddr (trans p 0 e)))) e 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) (mapcar '+ '(0.0 0.0) (trans y 0 e)) 1e-6)) vl)) (cons 10 (mapcar '+ '(0.0 0.0) (trans (nth (vl-position (car xx) vl) vln) 0 e))) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( (and (= (cdr (assoc 0 (entget e))) "POLYLINE") (= "AcDb2dPolyline" (cdr (assoc 100 (reverse (entget e)))))) ;;; - it's old heavy 2D POLYLINE
         (command "_.CONVERTPOLY" "_L" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget e)))) e 0)) (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e)))))
         (command "_.UCS" "_E" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons (trans p 1 0) vl))
         (print (trans p 1 0))
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.CIRCLE" "_non" (trans c 0 1) "\\")
         (setq r (cdr (assoc 40 (entget (entlast)))))
         (entdel (entlast))
         (setq p1 (getpoint (trans c 0 1) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (trans p2 1 0) (trans p1 1 0)))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (initget 2)
         (setq rf (getreal "\nSpecify rotation factor per vector intensity in decimal degrees <10.0> : "))
         (if (null rf)
         (setq rf 10.0)
         )
         (command "_.UCS" "_3P" "_non" p1 "_non" p2 "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 e) (+ (angle (trans p1 0 e) (trans p 0 e)) (* (if (equal (distance (mapcar '+ '(0.0 0.0) (trans p1 0 e)) (trans p 0 e)) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 e)) (trans p 0 e)))) (cvunit rf "degree" "radian"))) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 e)) (trans p 0 e)))) (list (caddr (trans p 0 e)))) e 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) (mapcar '+ '(0.0 0.0) (trans y 0 e)) 1e-6)) vl)) (cons 10 (mapcar '+ '(0.0 0.0) (trans (nth (vl-position (car xx) vl) vln) 0 e))) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
         (command "_.CONVERTPOLY" "_H" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
       )
       ( (= (cdr (assoc 0 (entget e))) "POLYLINE") ;;; it's 3DPOLYLINE or POLYFACE MESH
         (setq v e)
         (while (= (cdr (assoc 0 (entget (setq v (entnext v))))) "VERTEX")
         (setq pl (cons (cdr (assoc 10 (entget v))) pl))
         )
         (setq pl (reverse pl))
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (initget 2)
         (setq rf (getreal "\nSpecify rotation factor per vector intensity in decimal degrees <10.0> : "))
         (if (null rf)
         (setq rf 10.0)
         )
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1) "")
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 v) (+ (angle (trans p1 0 v) (trans p 0 v)) (* (if (equal (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)))) (cvunit rf "degree" "radian"))) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)))) (list (caddr (trans p 0 v)))) v 0)) vl))
         (setq v e)
         (while (= (cdr (assoc 0 (entget (setq v (entnext v))))) "VERTEX")
             (if (setq xx (vl-member-if '(lambda ( p ) (equal p (cdr (assoc 10 (entget v))) 1e-6)) vl))
               (entupd (cdr (assoc -1 (entmod (subst (cons 10 (nth (vl-position (car xx) vl) vln)) (assoc 10 (entget v)) (entget v))))))
             )
         )
         (entupd e)
         (setq vl vln)
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( (= (cdr (assoc 0 (entget e))) "MESH") ;;; it's MESH
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e))))
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (initget 2)
         (setq rf (getreal "\nSpecify rotation factor per vector intensity in decimal degrees <10.0> : "))
         (if (null rf)
         (setq rf 10.0)
         )
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1) "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 v) (+ (angle (trans p1 0 v) (trans p 0 v)) (* (if (equal (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)))) (cvunit rf "degree" "radian"))) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)))) (list (caddr (trans p 0 v)))) v 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) y 1e-6)) vl)) (cons (car x) (nth (vl-position (car xx) vl) vln)) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( t ;;; else - it's SPLINE
         (if (assoc 11 (entget e))
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 11)) (entget e))))
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e))))
         )
         (if (getvar '3dosmode)
         (progn
             (setvar '3dosmode 16)
             (setvar 'osmode 0)
         )
         (setvar 'osmode 1)
         )
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (initget 2)
         (setq rf (getreal "\nSpecify rotation factor per vector intensity in decimal degrees <10.0> : "))
         (if (null rf)
         (setq rf 10.0)
         )
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1) "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 v) (+ (angle (trans p1 0 v) (trans p 0 v)) (* (if (equal (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)))) (cvunit rf "degree" "radian"))) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)))) (list (caddr (trans p 0 v)))) v 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) y 1e-6)) vl)) (cons (car x) (nth (vl-position (car xx) vl) vln)) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
   )
   )
   ( (= ch "Scale-Shrink")
   (cond
       ( (= (cdr (assoc 0 (entget e))) "LWPOLYLINE")
         (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget e)))) e 0)) (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e)))))
         (command "_.UCS" "_E" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons (trans p 1 0) vl))
         (print (trans p 1 0))
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.CIRCLE" "_non" (trans c 0 1) "\\")
         (setq r (cdr (assoc 40 (entget (entlast)))))
         (entdel (entlast))
         (setq p1 (getpoint (trans c 0 1) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (trans p2 1 0) (trans p1 1 0)))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_3P" "_non" p1 "_non" p2 "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 e) (angle (trans p1 0 e) (trans p 0 e)) (if (equal (distance (mapcar '+ '(0.0 0.0) (trans p1 0 e)) (trans p 0 e)) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 e)) (trans p 0 e)))))) (list (caddr (trans p 0 e)))) e 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) (mapcar '+ '(0.0 0.0) (trans y 0 e)) 1e-6)) vl)) (cons 10 (mapcar '+ '(0.0 0.0) (trans (nth (vl-position (car xx) vl) vln) 0 e))) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( (and (= (cdr (assoc 0 (entget e))) "POLYLINE") (= "AcDb2dPolyline" (cdr (assoc 100 (reverse (entget e)))))) ;;; - it's old heavy 2D POLYLINE
         (command "_.CONVERTPOLY" "_L" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget e)))) e 0)) (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e)))))
         (command "_.UCS" "_E" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons (trans p 1 0) vl))
         (print (trans p 1 0))
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.CIRCLE" "_non" (trans c 0 1) "\\")
         (setq r (cdr (assoc 40 (entget (entlast)))))
         (entdel (entlast))
         (setq p1 (getpoint (trans c 0 1) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (trans p2 1 0) (trans p1 1 0)))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_3P" "_non" p1 "_non" p2 "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 e) (angle (trans p1 0 e) (trans p 0 e)) (if (equal (distance (mapcar '+ '(0.0 0.0) (trans p1 0 e)) (trans p 0 e)) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 e)) (trans p 0 e)))))) (list (caddr (trans p 0 e)))) e 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) (mapcar '+ '(0.0 0.0) (trans y 0 e)) 1e-6)) vl)) (cons 10 (mapcar '+ '(0.0 0.0) (trans (nth (vl-position (car xx) vl) vln) 0 e))) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
         (command "_.CONVERTPOLY" "_H" e)
         (while (< 0 (getvar 'cmdactive))
         (command "")
         )
       )
       ( (= (cdr (assoc 0 (entget e))) "POLYLINE") ;;; it's 3DPOLYLINE or POLYFACE MESH
         (setq v e)
         (while (= (cdr (assoc 0 (entget (setq v (entnext v))))) "VERTEX")
         (setq pl (cons (cdr (assoc 10 (entget v))) pl))
         )
         (setq pl (reverse pl))
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1) "")
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 v) (angle (trans p1 0 v) (trans p 0 v)) (if (equal (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)))))) (list (caddr (trans p 0 v)))) v 0)) vl))
         (setq v e)
         (while (= (cdr (assoc 0 (entget (setq v (entnext v))))) "VERTEX")
             (if (setq xx (vl-member-if '(lambda ( p ) (equal p (cdr (assoc 10 (entget v))) 1e-6)) vl))
               (entupd (cdr (assoc -1 (entmod (subst (cons 10 (nth (vl-position (car xx) vl) vln)) (assoc 10 (entget v)) (entget v))))))
             )
         )
         (entupd e)
         (setq vl vln)
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( (= (cdr (assoc 0 (entget e))) "MESH") ;;; it's MESH
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e))))
         (setvar 'osmode 1)
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1) "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 v) (angle (trans p1 0 v) (trans p 0 v)) (if (equal (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)))))) (list (caddr (trans p 0 v)))) v 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) y 1e-6)) vl)) (cons (car x) (nth (vl-position (car xx) vl) vln)) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
       ( t ;;; else - it's SPLINE
         (if (assoc 11 (entget e))
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 11)) (entget e))))
         (setq pl (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= (car x) 10)) (entget e))))
         )
         (if (getvar '3dosmode)
         (progn
             (setvar '3dosmode 16)
             (setvar 'osmode 0)
         )
         (setvar 'osmode 1)
         )
         (while (setq p (getpoint "\nPick or specify main vertex-vertices for SoftSelectEdit - ENTER TO FINISH : "))
         (setq vl (cons p vl))
         (print p)
         )
         (setq c (barycent vl))
         (prompt "\nPick or specify radius of SoftSelectEdit : ")
         (command "_.SPHERE" "_non" c "\\")
         (setq r (expt (/ (* 3.0 (vla-get-volume (vlax-ename->vla-object (entlast)))) 4.0 pi) (/ 1.0 3.0)))
         (entdel (entlast))
         (initget 1 "XY YZ ZX")
         (setq uc (getkword "\nChoose option of setting UCS : "))
         (cond
         ( (= uc "XY")
             (setq ux (mapcar '+ c '(1.0 0.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 1.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "YZ")
             (setq ux (mapcar '+ c '(0.0 1.0 0.0)))
             (setq uy (mapcar '+ c '(0.0 0.0 1.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         ( (= uc "ZX")
             (setq ux (mapcar '+ c '(0.0 0.0 1.0)))
             (setq uy (mapcar '+ c '(1.0 0.0 0.0)))
             (command "_.UCs" "_3P" "_non" c "_non" ux "_non" uy)
         )
         )
         (setq p1 (getpoint '(0.0 0.0 0.0) "\nPick or specify start point of vector of SoftSelectEdit : "))
         (setq p2 (getpoint p1 "\nPick or specify end point of vector of SoftSelectEdit : "))
         (setq v (mapcar '- (setq p2 (trans p2 1 0)) (setq p1 (trans p1 1 0))))
         (setq v1 (mapcar '/ v (list (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v) (distance '(0.0 0.0 0.0) v))))
         (setq vl (vl-remove-if-not '(lambda ( x ) (< (distance c x) r)) pl))
         (command "_.UCS" "_ZA" "_non" (trans p1 0 1) "_non" (trans p2 0 1) "")
         (setq eg (entget e))
         (while (= 5 (car (setq gr (grread t))))
         (setq v (mapcar '* v1 (list (car (cadr gr)) (car (cadr gr)) (car (cadr gr)))))
         (setq vln (mapcar '(lambda ( p ) (trans (append (mapcar '+ '(0.0 0.0) (polar (trans p1 0 v) (angle (trans p1 0 v) (trans p 0 v)) (if (equal (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)) 0.0 1e-6) 0.0 (/ (distance '(0.0 0.0 0.0) v) (distance (mapcar '+ '(0.0 0.0) (trans p1 0 v)) (trans p 0 v)))))) (list (caddr (trans p 0 v)))) v 0)) vl))
         (setq ex (mapcar '(lambda ( x / xx ) (if (setq xx (vl-member-if '(lambda ( y ) (equal (cdr x) y 1e-6)) vl)) (cons (car x) (nth (vl-position (car xx) vl) vln)) x)) eg))
         (entupd (cdr (assoc -1 (entmod ex))))
         )
         (command "_.UCS" "_P")
         (command "_.UCS" "_P")
       )
   )
   )
)
(*error* nil)
)

benhubel 发表于 2022-7-5 18:32:27

此外,我不确定选择多个主顶点的能力是否正常。只有一个似乎效果很好。我可能倾向于完全放弃多个vert功能,除非你认为它可以做得更顺利。
页: [1] 2
查看完整版本: 软选择/比例编辑