±¾Ìû×îºóÓÉ lisperado ÓÚ 2018-10-29 14:10 ±à¼
ллl¶¥ÉÏ
µ«²»¼ûÔ°æÖ÷»Ø¸´ËùÒÔÖ»Ìṩº¯Êý £¬ÆäËûÓ÷¨Ö»Ðè×ÔÐиü¸Ä²ÎÊý°É£¡
¼òµ¥Ë¼Â·Ö»Ìṩ²Î¿¼£¬ÔÒòº¯Êý·µ»Ø±íÖµ²¢²»´ú±íÇúÏßÍä¹Â¶ÈËùÒÔ²¢²»¾«×¼£¡ÓÈÆäÍä¶È½Ç¶ÈÌ«´óÇë±ÜÃ⣡£¡
 - ;|
- --------------- vlax-curve-DivideBetweenPair ---------------
-
- Returns a approximate point list between two cross-section
- curves by a dividing parameter, concept of LOFT command
- ------------------------------------------------------------
- Author: lisperado
- ------------------------------------------------------------
- Arguments:
- e1,e2 - Curve entities/objects SPLINE,LWPOLYLINE etc..
- x - Direction mode 0 or 1, integer
- y - Divide parameter, integer
-
- ------------------------------------------------------------
- Returns: list of Point list (WCS)
- ------------------------------------------------------------|;
- ;;Note: NOT accurate for sharp curve
- (defun vlax-curve-DivideBetweenPair ( e1 e2 y / m i d p o l a r )
- (setq i 32.0 ;;;×ÝÏòÃܶÈÓû§×ÔÐÐÉ趨
- a (list e1 e2)
- )
- (foreach e a
- (setq r nil
- d (vlax-curve-getdistatparam e (vlax-curve-getendparam e))
- m (/ d i)
- l 0.0
- )
- (while (and (< l d) (setq p (vlax-curve-getpointatdist e l)))
- (setq l (+ l m)
- r (cons p r)
- )
- )
- (setq o (cons (reverse r) o))
- ) ; foreach
- (setq r nil
- p '((x) (mapcar '* '(1. 1. 0.) x)) ; ת»»2D
- o (mapcar '(lambda (a b) (append a (list (vlax-curve-getendpoint b)))) o (reverse a))
- )
- (foreach x (apply 'mapcar (cons '(lambda (a b) (list (setq b (p b) a (p a) ) (angle a b) (/ (distance a b) y))) o))
- (setq
- l nil
- p (car x)
- )
- (repeat (1- y)
- (setq
- p (apply 'polar (cons p (cdr x)))
- l (cons p l)
- )
- ) ; repeat
- (setq r (cons l r))
- ) ; foreach
- (apply 'mapcar (cons 'list r))
- )
;; ¾ÙÀý £º e1 & e2 ¸÷ÊÇÇúÏߣ¬Æ½·ÝÓÚ 5
( vlax-curve-DivideBetweenPair e1 e2 5 )
;; ·µ»Ø±í£º
;(((113.88 294.633 0.0) (98.7727 293.563 0.0) (83.6605 292.562 0.0) (68.539 291.699 0.0) ....
;;±à¼£º 1. ¸üÕý: ÒÆ³ý¶àÓà±äÁ¿ setq i 0 & setq i 1+ i
2. ÔÝʱֻ֧³Ö2DÒòΪpolarº¯Êý¾àÀë²ÎÊýÒÔÆ½ÃæÎª»ù´¡
|