(defun TransformAttDefsFromBlkRefToVport
( handleBlkRef handleVport
/ TransformToSpace GetAttDefs GetVportMatrix RefGeom
)
(defun TransformToSpace
( oL mat space bDel bRegen
/ acDoc r
) )
r
); defun TransformToSpace
(defun GetAttDefs
( blkref
/ L
) ); vlax-for
L
); defun
; Used Lee Mac's "modelspace to paperspace" program to create this subfunction - refgeom for a viewport object
(defun GetVportMatrix
( vport
/ enx ang nor scl mat
) mat ; http://lee-mac.com/ms2ps.html
(setq mat
;; The following is adapted from gile's WCS2PCS function: (mxm
'(0.0 0.0 1.0)
)
'(
(1.0 0.0 0.0)
(0.0 1.0 0.0)
(0.0 0.0 1.0)
)
)
)
)
)
)
'((0.0 0.0 0.0 1.0))
)
); vlax-tmatrix
); setq
); defun GetVportMatrix
;; RefGeom (gile)
;; Returns a list which first item is a 3x3 transformation matrix (rotation, scales, normal)
;; and second item the object insertion point in its parent (xref, block or space)
;; Argument : an ename
(defun RefGeom
( ent
/ mxv trp mxm ang ang mat ocs
)
;; Matrix x Vector - Vladimir Nesterovsky
;; Args: m - nxn matrix, v - vector in R^n
;; Matrix Transpose - Doug Wilson
;; Args: m - nxn matrix
;; Matrix x Matrix - Vladimir Nesterovsky
;; Args: m,n - nxn matrices
)
(mxm
'(
(1.0 0.0 0.0)
(0.0 1.0 0.0)
(0.0 0.0 1.0)
)
)
(mxm
'(0.0 0.0 1.0)
)
)
)
)
); setq mat
)
); list
); defun RefGeom
( ; Main
(lambda ( handleBlkRef handleVport
/ acDoc blkref vport mat1 oL mat2 r
) (refgeom blkref)
); apply
); setq mat1
(setq oL
(TransformToSpace
(GetAttDefs blkref
) mat1
(vla-get-ModelSpace acDoc
) nil nil)) ; transform the entities into MSPACE (setq mat2
(GetVportMatrix vport
)) (TransformToSpace oL mat2 ; transform the entities above the VPORT
)
t t
)
); setq r
); and
r
); lambda
handleBlkRef handleVport
); Main
); defun TransformAttDefsFromBlkRefToVport