oyxx1023 发表于 2006-12-21 10:55:00

如何得到模型空间当前视图的最大坐标和最小坐标

<p>也就是左下角点和右上角点坐标。</p><p>viewctr只能得到中心坐标,viewsize只能得到高度。如何得到宽度?</p>

Andyhon 发表于 2006-12-21 11:57:00

<p>AutoLISP FAQ (part 2/2) - samples, code </p><p> Select all visible objects: zoom coordinates</p><p>&nbsp; Beware that with (ssget) you will only get visible objects, because<br/>&nbsp; all interface functions (entsel,ssget,osnap) work with pixel, only<br/>&nbsp; (ssget "X") will select not visible objects.</p><p>&nbsp; ;;; returns a list of the actual viewport corners in WCS<br/>&nbsp; (defun ZOOMPTS ( / ctr h screen ratio size size_2)<br/>&nbsp;&nbsp;&nbsp; (setq ctr (xy-of (getvar "VIEWCTR")) ;3D -&gt; 2D<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; h&nbsp;&nbsp; (getvar "VIEWSIZE")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;real<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; screen (getvar "SCREENSIZE")&nbsp;&nbsp; ;2D: Pixel x,y<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ratio (/ (float (car screen))&nbsp; ;aspect ratio<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (cadr screen))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; size (list (* h ratio) h)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;screensize in coords<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; size_2 (mapcar '/ size '(2.0 2.0)))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (list (mapcar '- ctr size_2)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (mapcar '+ ctr size_2)))</p>

phoenixdjq 发表于 2006-12-21 12:39:00

<p>vxmax和vxmin</p>

yaojing38 发表于 2023-4-24 13:12:31

用到了谢谢,分享
页: [1]
查看完整版本: 如何得到模型空间当前视图的最大坐标和最小坐标