写法有很多
1、DIST函数计算
 - (defun XD::PNTS:Peremiter (pts)
- (apply
- '+
- (mapcar
- '(lambda (x)
- (apply
- 'distance
- x
- )
- )
- (xd::list:snakepair pts)
- )
- )
- )
2、getpropertyvalue 实体查询
 - (defun XD::PNTS:Peremiter (pts)
- (setq len (xdrx_getpropertyvalue (xdrx_polyline_make pts) "length"))
- (xdrx_entity_delete (entlast))
- len
- )
3、使用ARX几何库查询(构建每段的AcGeLineSeg3d,然后SetCurvelist)
 - (defun XD::Pnts:Peremiter (pts)
- (setq g (xdge::constructor "kCompositeCrv3d")
- gl (mapcar
- '(lambda (x)
- (xdge::constructor "kLineSeg3d" (car x) (cadr x))
- )
- (xd::list:snakepair pts)
- )
- ) (xdge::setpropertyvalue g "setcurvelist" gl)
- (setq len (xdge::getpropertyvalue g "length"))
- (xdge::free (list g gl))
- len
- )
4、ARX几何库查询最新写法,直接点表构建AcGeCompositeCrv3d,使用几何库的好处是不仅仅可以求LENGTH,支持的几何量都可以查询,
 - (defun XD::Pnts:Peremiter(pts)
- (setq g (xdge::constructor "kCompositecrv3d" pts)
- len (xdge::getpropertyvalue g "length")
- )
- (xdge::free g)
- len
- )
5、ARX几何库查询最新写法变种(省略的变量赋值),API 2016.0609版本以后支持
 - (defun XD::Pnts:Peremiter(pts)
- (setq g (xdge::constructor "kCompositecrv3d" pts))
- (xdge::getpropertyvalue g "length")
- (xdge::free g)
- length
- )
6、getpropertyvalue 实体查询的变种(省略变量赋值)
 - (defun XD::PNTS:Peremiter (pts)
- (xdrx_getpropertyvalue (xdrx_polyline_make pts) "length")
- (xdrx_entity_delete (entlast))
- length
- )
上面代码顺序的过程,也是API发展的过程
|