马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 Lispboy 于 2013-11-17 22:42 编辑
 - ;|
- 表格线转换成CELL单元格子,对普通LINE表格进行前处理,生成单元格,自动生成(从上到下,从左到右排序的)单元格。
- 参数:
- ss --- 选择集(表格线)
- 返回值:
- 表 (表格最大外框句柄 ((h01 h02 ...h0n)(h11 h12 ...h1n)(hn1 hn2....hnn)))
- |;
- (defun XD::Table:GridLine2Cells (ss / basept cells el ell entl header i len lxd n pts temp x x1 x2)
- (setq ss (xdrx_geom_searchregions (xdrx_curve_intersectbreak ss 0) 0)
- entl (xdrx_pickset->ents ss)
- temp entl
- entl (mapcar
- '(lambda (x)
- (cons (car (xdrx_getarea x)) x)
- )
- entl
- )
- entl (vl-sort entl '(lambda (x1 x2)
- (> (car x1) (car x2))
- )
- )
- entl (mapcar
- 'cdr
- entl
- )
- temp (cdr entl)
- )
- (setq header (car entl)
- cells (XD::Pickset:TableSort (XD::Entity->PickSet (cdr entl)) 0 3 '> '<)
- )
- (foreach n cells
- (setq i 0
- len (length n)
- )
- (setq el (mapcar
- '(lambda (x)
- (setq pts (xdrx_getpropertyvalue x "Vertices")
- lxd pts
- basept (car (if (= (+ 1 i) len)
- (XD::Pnts:MaxY->MaxX pts 1e-5)
- (XD::Pnts:MaxY->MinX pts 1e-5)
- )
- )
- pts (if (= (+ 1 i) len)
- (XD::PntS:unClockWise pts basePt 1e-5)
- (XD::PntS:ClockWise pts basePt 1e-5)
- )
- )
- (apply
- 'xdrx_polyline_make
- (cons t pts)
- )
- (xdrx_entity_setPropertiesFrom (entlast) x)
- (setq i (1+ i))
- (xdrx_getpropertyvalue (entlast) "handle")
- )
- n
- )
- ell (cons el ell)
- )
- (xdrx_entity_delete n)
- )
- (list (xdrx_getpropertyvalue header "handle") (reverse ell))
- )
|