;返回直线段的中点
;用法: (ptmid 直线段图元)
(defun ptmid(Xent)
(setq dxf (entget Xent)
p10 (cdr (assco 10 dxf))
p11 (cdr (assoc 11 dxf))
mid (mapcar ' '(05 05 05) (mapcar '+ p10 p11))
)
)
(defun c:jxzb()
(vl-load-com)
(if (setq ent (car (entsel "\n请选取水平放置的矩形:")))
(progn
(setq obj (vlax-ename->vla-object ent))
(setq name (vlax-get-property obj "ObjectName"))
(If (not (wcmatch name "AcDbPolyline,AcDb3dPolyline"))
(alert "所选取的不多段线!")
(progn
(setq pts (vlax-get obj "Coordinates"))
(cond ((= name "AcDbPolyline") (setq n 2))
((= name "AcDb3dPolyline") (setq n 3))
)
(setq m (/ (length pts) n))
(If (/= m 4)
(alert "所选取的不是矩形!")
(progn
(vlax-invoke-method obj "GetBoundingBox" 'ptmin 'ptmax)
(setq s1 (vlax-safearray->list ptmin)) ;左下角
(setq s3 (vlax-safearray->list ptmax)) ;右上角
(setq s2 (list (car s3) (cadr s1) 0)) ;右下角
(setq s4 (list (car s1) (cadr s3) 0)) ;左上角
(princ "\n左下角S1=")(princ s1)
(princ "\n右下角S2=")(princ s2)
(princ "\n右上角S3=")(princ s3)
(princ "\n左上角S4=")(princ s4)
)
)
)
)
)
)
(princ)
)
以上就是关于请问,lisp中有什么函数可以直接取得直线中点坐标全部的内容,包括:请问,lisp中有什么函数可以直接取得直线中点坐标、lisp如何获得水平放置矩形的四个点坐标,按从左下角到右上角的顺序,赋值给s1 s2 s3 s4、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)