- (defun $3dline->pline$ (3line lst / dxf p pick pl ps vt)
- ;三维多段线转PLINE
- (or 3line
- (and
- (setq pick (vl-catch-all-apply 'entsel (list "请点击三维多段线")))
- (progn (if (vl-catch-all-error-p pick)
- (setq pick nil)
- )
- (setq 3line (car pick))
- )
- )
- )
- (and 3line
- (setq dxf (entget 3line))
- (progn
- (and dxf
- (= "POLYLINE" (cdr (assoc 0 dxf)))
- (= (cdr (assoc 100 (vl-remove (assoc 100 dxf) dxf)))
- "AcDb3dPolyline"
- ) ;三维多段线
- (progn
- (setq dxf nil)
- (setq ps nil)
- (setq vt (entnext 3line))
- (while (= "VERTEX" (cdr (assoc 0 (entget vt))))
- (setq p (cdr (assoc 10 (entget vt))))
- (setq ps (cons (cons 10 p) ps))
- (setq vt (entnext vt))
- )
- (setq ps (reverse ps))
- (setq dxf (append (list
- (cons 0 "LWPOLYLINE")
- (cons 100 "AcDbEntity")
- (cons 100 "AcDbPolyline")
- (cons 90 (length ps))
- )
- ps
- )
- )
- (setq pl (vl-catch-all-apply 'entmakex (list dxf)))
- (if (vl-catch-all-error-p pl)
- (setq pl nil)
- )
- (if pl
- (progn (redraw) (entdel 3line))
- )
- )
- )
- (if pl()(print "转换多段线失败"))
- )
- )
- (if pl
- pl
- 3line
- )
- )
|