给你个模拟程序

- ;函 数: C:OAS_Object_Spline->Polyline
- ;功 能: 将SPLINE实体模拟转换成POLYLINE, 图层继承原SPLINE实体的, 同时删除此SPLINE实体
- ;格 式: (C:OAS_Object_Spline->Polyline SPLINE实体[ENAME])
- ;返回值: [成功]: 新建的POLYLINE实体名[ENAME]
- ; [失败]: NIL
- ;示 例: (C:OAS_Object_Spline->Polyline (car (entsel)))
- ; =><Entity name: xxxxxxxx>
- ;==================================================================================================
- (Defun C:OAS_Object_Spline->Polyline
- (SPline / OldLayer Item Point PointX Pline Rtn)
- (if (= (type SPline) 'ENAME)
- (setq SPline (entget SPline))
- )
- (setq OldLayer (cdr (assoc 8 SPline))
- Rtn nil
- )
- (SetVar "Osmode" 0)
- (command "_.Pline")
- (foreach Item SPline
- (if (= (car Item) 10)
- (command (if (null PointX)
- (setq PointX (cdr Item))
- (setq Point (cdr Item))
- )
- )
- )
- )
- (if (equal Point PointX)
- (command "_c")
- (command "")
- )
- (command "_.PEdit" (setq Pline (entlast)) "_S" "")
- (entdel (cdr (assoc -1 SPline)))
- (setq SPline Pline)
- (if (entmake
- (list (cons 0 "POLYLINE")
- (cons 8 OldLayer)
- (cons 70 (logand 1 (cdr (assoc 70 (entget Pline)))))
- )
- )
- (while (/= "SEQEND"
- (cdr (assoc 0 (entget (setq Pline (entnext Pline)))))
- )
- (if (member (cdr (assoc 70 (entget Pline)))
- (list 8 1)
- )
- (entmake (list (assoc 0 (entget Pline))
- (assoc 10 (entget Pline))
- (assoc 42 (entget Pline))
- )
- )
- )
- )
- )
- (entmake (list (cons 0 "SEQEND")))
- (setq Rtn (entlast))
- (entdel SPline)
- Rtn
- )
|