iCAx开思网

标题: 如何在图纸空间中获得图纸中图像的坐标?(autocad200) [打印本页]

作者: haha    时间: 2002-1-27 11:18
标题: 如何在图纸空间中获得图纸中图像的坐标?(autocad200)
问题:  
  
怎样编写一个命令响应程序,用于经常绘制和更新图框及标题栏,使其与布局中显示的图纸背景精确匹配。  
  
解决方法:  
  
可以通过变量LIMMIN和LIMMAX获得图纸空间中显示的图纸背景图像坐标。注意,只有在图纸背景或者图纸页边距显示时才能使用这种方法。
例如,在VBA中:
  
Option Explicit
  
Sub DrawPSBorder()
  
Dim vll As Variant
Dim vur As Variant
Dim ll(0 To 1) As Double
Dim ur(0 To 1) As Double
Dim aPLlineObj As Object
Dim vertexList(0 To 7) As Double
  
ThisDrawing.ActiveSpace = acPaperSpace
  
vll = ThisDrawing.GetVariable("LIMMIN")
vur = ThisDrawing.GetVariable("LIMMAX")
  
ll(0) = vll(0)
ll(1) = vll(1)
ur(0) = vur(0)
ur(1) = vur(1)
  
vertexList(0) = ll(0)
vertexList(1) = ll(1)
vertexList(2) = ur(0)
vertexList(3) = ll(1)
vertexList(4) = ur(0)
vertexList(5) = ur(1)
vertexList(6) = ll(0)
vertexList(7) = ur(1)
  
Set aPLlineObj = ThisDrawing.PaperSpace.AddLightWeightPolyline(vertexList)
aPLlineObj.Color = acRed
aPLlineObj.Closed = True
aPLlineObj.Update
  
End Sub
  
例如,在AutoLISP中:
  
(defun DrawBorder ()
(setvar "TILEMODE" 0)
(setq ll (getvar "LIMMIN"))
(setq ur (getvar "LIMMAX"))
(command "_RECTANG" ll ur)
(setq entLst (entget (entlast)))
(if (assoc '62 entLst)
(entmod (subst (cons 62 1) (assoc '62 entLst) entLst))
(entmod (append entLst (list (cons 62 1))))
)
(princ)
)
; (DrawBorder)
  




欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3