73哥 另类(作图法)三角网内插高程点
- (defun PoInPl(pt lst / i p1 p2 an anl ret)
- (setq i -1 p1 (last lst))
- (while(and(not ret)(setq p2(nth(setq i(1+ i))lst)))
- (cond((equal p2 pt 1e-6)(setq ret t))
- (t(setq an(-(angle pt p1)(angle pt p2)))
- (if(equal pi(abs an) 1e-6)
- (setq ret t)
- (setq anl(cons(rem an PI)anl)))))
- (setq p1 p2))
- (cond(ret 0);线上;
- (t(if(equal PI(abs(apply'+ anl))1e-6)1 -1))))
- (defun xyofen(e / q p i)
- (if(member(cdr(assoc 0(setq e(entget e))))'("LINE""TEXT""MTEXT""INSERT""SOLID"))
- (vl-remove'nil(mapcar'(lambda(x)(cdr(assoc x e)))'(10 11 12 13 14)))
- (progn(setq i -1 q(if(=(logand(cdr(assoc 70 e))1)1)0 1)e(cdr(assoc -1 e)))
- (repeat(fix(+(vlax-curve-getEndParam e)q))
- (setq i(1+ i)q(vlax-curve-getPointAtParam e i)
- p(if(or(equal(last p)q 1e-5)(equal(car p)q 1e-5))p(cons q p))))
- (reverse p)
- )))
- (defun c:tt(/ p e q q1 a);;另类(作图法)三角网内插高程点
- (while(setq p(getpoint))
- (if(and(setq e(ssget"F"(list'(-1e18 0)p)'((0 . "polyline")(100 . "AcDb3dPolyline"))))
- (setq e(car(vl-remove-if'(lambda(x)(=(poinpl p(setq pl(xyofen(cadr x))))-1))(ssnamex e)))));;p点所在三角网图元e
- (setq q(osnap(inters p(polar p(angle(mapcar'+(car pl)'(0 0))(cadr pl))(distance(mapcar'+(car pl)'(0 0))(cadr pl)))
- (mapcar'+(cadr pl)'(0 0))(mapcar'+(last pl)'(0 0))nil)"nea");;过p作1,2点的平行线相交于2,3所在边q
- q1(osnap(polar(cadr pl)(angle(cadr pl)(mapcar'+(car pl)'(0 0)))(distance(mapcar'+'(0 0)p)q))"nea");;在2 1边上截取pq长度于q1
- a(entmakex(list'(0 . "text")(cons 10 p)(cons 1(rtos(+(last q)(last q1)(-(last(cadr pl))));q点高程加上2,q1高差
- 2 3))'(40 . 2)'(7 . "standard")))))))
|