- 积分
- 13089
- 明经币
- 个
- 注册时间
- 2022-8-12
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2022-11-16 11:28:14
|
显示全部楼层
vla-GetBoundingBox 用这个函数试试,我用这个函数给标题加下划线 挺好用。
;;;从AutoCAD 2013 Active Reference帮助中code Examples中提取
;;;本源代码由 xshrimp 2013.2.20 搜集整理,版权归原作者所有!
(vl-load-com)
(defun c:Example_GetBoundingBox()
;; This example creates a line in model space. It then finds the
;; bounding box for the line and displays the corners of the box.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Create the Line object in model space
(setq startPoint (vlax-3D-point 2 2 0))
(setq endPoint (vlax-3D-point 4 4 0))
(setq modelSpace (vla-get-ModelSpace doc))
(setq lineObj (vla-AddLine modelSpace startPoint endPoint))
(vla-ZoomAll acadObj)
;; Return the bounding box for the line and return the minimum
;; and maximum extents of the box in the minExt and maxExt variables.
(vla-GetBoundingBox lineObj 'minExt 'maxExt)
(setq minExt (vlax-safearray->list minExt)
maxExt (vlax-safearray->list maxExt))
;; Print the min and max extents
(alert (strcat "The extents of the bounding box for the line are:"
"\nMin Extent: " (rtos (nth 0 minExt) 2) "," (rtos (nth 1 minExt) 2) "," (rtos (nth 2 minExt) 2)
"\nMax Extent: " (rtos (nth 0 maxExt) 2) "," (rtos (nth 1 maxExt) 2) "," (rtos (nth 2 maxExt) 2)))
)
|
|