你好
我想创建一个程序,将2d横截面转换为3dpoint Entytes,将其放置在平面上的横截面轴上。
首先,我创建新的ucs原点,使顶点x=3dpoint xvalue;y=3点Z值;
现在我开始编程:
- ;;a) First I get 2d cross section polyline vertex points from polyline.
- (vl-load-com)
- (setq acadObject (vlax-get-acad-object))
- (and
- (setq theobj (car (entsel "\nSelect a Polyline: ")))
- (setq theobj (vlax-ename->vla-object theobj))
- (eq (vlax-get-property theobj 'ObjectName) "AcDbPolyline")
- (setq thelist (vlax-get theobj 'coordinates))
- ;;b) converting point coordinates from wsc to currentucs
- (setq n 0)
- (while (/= (nth n thelist) nil)
- (setq thelist1
- (cons
- (trans
- (list (nth n thelist) (nth (setq n (1+ n)) thelist))
- 0
- 1
- ) ;end trans
- thelist1
- ) ;end cons
- ) ;end setq
- (setq n (1+ n))
- ) ;end while
- )
- ;;c) Rotateing ucs - determinig crosssecton axe
- (setq t1 (getpoint "\nOdaberite ishosište koordinatnog sustava"))
- (setq t2 (getpoint "\nKliknite na točku na pozitivnoj strani"))
- ;(vl-cmdf -.UCS "w")
- (setq ms (vla-get-modelspace
- (vla-get-ActiveDocument
- (vlax-get-acad-object)
- )
- )
- )
- (setq lin1 (vla-addline
- ms
- (vlax-3d-point (trans t1 1 0))
- (vlax-3d-point (trans t2 1 0))
- )
- )
- (setq lin (vlax-vla-object->ename lin1))
- (princ)
- ;(command "._UCS" "e" lin)
- (vl-cmdf "._UCS" "e" lin)
- (entdel lin)
- ;;d) drawing points
- (setq n 0)
- (while (/= (nth n thelist1) nil)
- (setq toc
- (trans
- (list (nth n thelist1) (nth (setq n (1+ n)) thelist1))
- 1
- 0
- ) ;end trans
- ) ;end setq
- (vla-addpoint ms
- (vlax-3d-point (list (nth 0 toc) 0.0 (nth 1 toc)))
- )
- )
- (setq toc nil)
- (setq n (1+ n))
- ) ;end while
|