Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/15/2020 in all areas

  1. ok it is done. I should have respected the trans command more. (defun c:test (/ layout vpcenter xlen ylen ptlowleft pthighright vpentity sprsel) ; *acDoc* is global (if (not (eq (getvar 'CTAB) "Model")) (if (and (setq vpentity (car (entsel "\nSelect viewport: "))) (eq (cdr (assoc 0 (setq layout (entget vpentity)))) "VIEWPORT") ) (progn (setq vpcenter (cdr (assoc 10 layout))) (setq xlen (cdr (assoc 40 layout))) (setq ylen (cdr (assoc 41 layout))) (setq ptlowleft (trans (mapcar '- vpcenter (list (/ xlen 2) (/ ylen 2) 0.0)) 3 2)) (setq pthighright (trans (mapcar '+ vpcenter (list (/ xlen 2) (/ ylen 2) 0.0)) 3 2)) (vla-put-mspace *acDoc* :vlax-true) (vla-put-activepviewport *acDoc* (vlax-ename->vla-object vpentity)) (setq sprsel (ssget "_W" ptlowleft pthighright '((0 . "INSERT")))) (vla-put-mspace *acDoc* :vlax-false) (if sprsel (alert (itoa (sslength sprsel)))) ) ) (prompt "\nCommand cannot be invoked in model space.") ) (princ) )
    1 point
×
×
  • Create New...