;;----------------=={ Add Object to Block }==-----------------;;
;; ;;
;; Add single object in the provided ENAME definition to ;;
;; definition of the specified block. ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;
;; slightly modified by M.R. for his purposes ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; doc - Document Object in which block resides. ;;
;; block - Entity name of reference insert ;;
;; ent - Object to add to definition [ENAME] ;;
;;------------------------------------------------------------;;
(defun LM:AddObjecttoBlock
( doc block ent
/ mat vlaentblk
)
mat (LM:Ref->Def block)
)
)
)
)
)
)
vlaentblk
)
;;-----------------=={ Remove From Block }==------------------;;
;; ;;
;; Removes an Entity from a Block Definition ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; ent - Entity name of Object to Delete from Block [ENAME] ;;
;;------------------------------------------------------------;;
(defun LM:RemovefromBlock
( doc ent
) )
;;------------------=={ Safearray Variant }==-----------------;;
;; ;;
;; Creates a populated Safearray Variant of a specified ;;
;; data type ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; datatype - variant type enum (eg vlax-vbDouble) ;;
;; data - list of static type data ;;
;;------------------------------------------------------------;;
;; Returns: VLA Variant Object of type specified ;;
;;------------------------------------------------------------;;
(defun LM:SafearrayVariant
( datatype data
) )
)
)
;;---------------=={ Block Ref -> Block Def }==---------------;;
;; ;;
;; Returns the Transformation Matrix and Translation Vector ;;
;; for transforming Block Reference Geometry to the Block ;;
;; Definiton. ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; e - Block Reference Entity ;;
;;------------------------------------------------------------;;
;; Returns: List of 3x3 Transformation Matrix, Vector ;;
;;------------------------------------------------------------;;
(defun LM:Ref
->Def
( e
/ _dxf a l n
)
(setq l
(entget e
) a
(- (_dxf
50 l
)) n
(_dxf
210 l
)) (
(mxv m
)
)
)
)
(mxm
(list (/ 1.
(_dxf
41 l
)) 0.
0.
) (list 0.
(/ 1.
(_dxf
42 l
)) 0.
) (list 0.
0.
(/ 1.
(_dxf
43 l
))) )
(mxm
)
'(
(1. 0. 0.)
(0. 1. 0.)
(0. 0. 1.)
)
)
)
)
)
)
;;---------------------=={ WCS->Geom }==----------------------;;
;; ;;
;; Returns the Transformation Matrix and Translation Vector ;;
;; for transforming Block Definition Geometry to a Block ;;
;; Reference. ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; SourceBlock - VLA Block Reference Object ;;
;;------------------------------------------------------------;;
;; Returns: List of 3x3 Transformation Matrix, Vector ;;
;;------------------------------------------------------------;;
(defun LM:WCS
->Geom
(SourceBlock
/ norm ang x y z
) ;; © Lee Mac 2010
)
'(x y z)
SourceBlock
prop
alt
)
)
)
'(XEffectiveScaleFactor
YEffectiveScaleFactor
ZEffectiveScaleFactor
)
'(XScaleFactor YScaleFactor ZScaleFactor)
)
)
m
'-
(mxv
m
)
)
)
)
)
'((1. 0. 0.) (0. 1. 0.) (0. 0. 1.))
)
)
)
)
)
)
;;-----------=={ 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
) ;; © Lee Mac 2010
target
'((0. 0. 0. 1.))
)
)
)
)
)
target
)
)
)
)
;; Matrix x Vector - Lee Mac 2010
;; Args: m - nxn matrix, v - vector in R^n
)
;; Matrix x Matrix - Lee Mac 2010
;; Args: m,n - nxn matrices
)
;; Matrix Transpose - Lee Mac 2010
;; Args: m - nxn matrix
(defun c:refeditblkbyname
( / loop def ss i ref defent p el ent entvla
) "BLOCK/XREF"
"Select Block - NOT Xref definition"
(ai_table "BLOCK" 4)
)
)
(alert "Selected definition belongs to XREF... Please choose Block definition...") "BLOCK/XREF"
"Select Block - NOT Xref definition"
(ai_table "BLOCK" 4)
)
)
)
"Model"
)
)
)
)
)
)
;; "_A" mode - excluded objects on frozen layers ;; 410 DXF code quiery for only entities on current space
i 0
)
1e-8
)
1e-8
)
1e-8
)
)
)
(=
4
4
)
)
)
)
)
defent
)
)
)
(=
1
1
)
)
)
)
)
)
)
)
"_.-REFEDIT"
(LM:ApplyMatrixTransformation
)
)
)
)
0
1
)
"Ok"
)
)
)
"_.-REFEDIT"
(LM:ApplyMatrixTransformation
)
)
)
)
0
1
)
"Ok"
)
)
)
)
)
)
)
)
)
)
)
)