;========================= Begin < Mk-Pt-Lst > Function =============================;
; Function to retrieve vertex point data from Pline in the listed block ;
; The Pline handle name is stored in the SADATA_DICT ;
; Syntax for function call; ;
; (Mk-Pt-Lst < Block Name >) ;
; Example - (Mk-Pt-Lst "Septic AssistantESStandard6x35Level") ;
; ;
; ;
(defun Mk
-Pt
-Lst
( blk
/ a i e q LM:RotateByMatrix Mk
-PL
-EntLst ent
-lst pnt
-lst
LM:TranslateByMatrix LM:ApplyMatrixTransformation
)(vl-load-com)
(defun Mk
-PL
-EntLst
( blk
/ ss lst
) )
x
)
ss
)
(setq lst
(cons (vlax
-vla
-object
->ename x
) lst
)) ) ;_ if
) ; vlax-for
)
)
);defun (setq ent-lst(Mk-PL-EntLst "Septic AssistantESStandard6x35Level"))
;========================== Begin < LM:mAssoc > Function ==============================;
; ;
; Increments the value of a key in an association list if present, ;
; else adds key to the list. ;
; key - [any] Key of an element in the list ;
; lst - [lst] Association list (may be nil) ;
; mAssoc - Lee Mac ;
; Returns all associations of a key in an association list ;
; http://www.lee-mac.com/assocplusplus.html ;
; ;
(defun LM:mAssoc
( key lst
/ itm
) )
);defun
; ;
; ;
;=========================== End < LM:mAssoc > Function ================================;
;;----------------=={ Translate by Matrix }==-----------------;;
;; ;;
;; Translates a VLA-Object or Point List using a ;;
;; Transformation Matrix ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2010 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; target - VLA-Object or Point List to transform ;;
;; p1, p2 - Points representing vector by which to translate ;;
;;------------------------------------------------------------;;
(defun LM:TranslateByMatrix
( target p1 p2
) (LM:ApplyMatrixTransformation target
)
)
)
;;------------------=={ Rotate by Matrix }==------------------;;
;; ;;
;; Rotates a VLA-Object or Point List using a ;;
;; Transformation Matrix ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2010 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; target - VLA-Object or Point List to transform ;;
;; p1 - Base Point for Rotation Transformation ;;
;; ang - Angle through which to rotate object ;;
;;------------------------------------------------------------;;
(defun LM:RotateByMatrix
( target p1 ang
) (LM:ApplyMatrixTransformation target
)
)
)
)
;;-----------=={ Apply Matrix Transformation }==--------------;;
;; ;;
;; Transforms a VLA-Object or Point List using a ;;
;; Transformation Matrix ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2010 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; target - VLA-Object or Point List to Transform ;;
;; matrix - 3x3 Matrix by which to Transform object ;;
;; vector - 3D translation vector ;;
;;------------------------------------------------------------;;
(defun LM:ApplyMatrixTransformation
( target matrix vector
)
'((0. 0. 0. 1.))
)
)
)
)
)
target
)
)
)
)
;; Matrix x Vector - Vladimir Nesterovsky ;;
;; Args: m - nxn matrix, v - vector in R^n ;;
)
(setq i '
(0 0 0) ; insert point where block was created ; ent
-lst
(reverse (Mk
-PL
-EntLst blk
)) ; makes entity list of Plines in block ; pnt
-lst
(LM:mAssoc
10 (entget (last ent
-lst
))) ; list of verticies of last LWPOLYLINE created ; pnt
-lst
(LM:TranslateByMatrix pnt
-lst
(trans i
1 0) (trans q
1 0))) ; Points translated to insert point of block ; (LM:RotateByMatrix pnt
-lst
(trans q
1 0) a
) ; points rotated to insert angle of block ; )
)
)
);defun (setq pt (Mk-Pt-Lst "Septic AssistantESStandard6x35Level"))