画示坡线,效果不错
大多数的工作不需要另外加装很多线型有时把图发出去,对方可能看不全
临时做个边坡设计,写了个画示坡线.lsp
说明及完整程序的见下载文件
主函数也方便改造成画其他线型---实际是线性阵列变种
;画示坡线,短线长可默认,画在那一侧按光标位置
(defun c:spx ( / str ob p1 p2 p3 fx)
(while(setq ob(entsel "\n选择线:"))
(setq p1(cadr ob) ob(car ob))
(if(wcmatch (cdr(assoc 0(entget ob)))"*POLYLINE,LINE,SPLINE,CIRCLE,ARC,ELLIPSE")
(progn
(setq ob(vlax-ename->vla-object ob))
(setq p1(vlax-curve-getclosestpointto ob p1))
(princ "\n光标位为示坡线方向")
(setq str "\n指定短线长")
(if spxdist (setq str(strcat str ":")))
(while(cond
((and (setq p3(getpoint p1 str))(> (setq d(distance p1 p3))0))
(setq spxdist d)nil
)
(spxdist(setq p3(polar p1(angle p1(cadr(grread '(2 13)))) spxdist))nil)
;获取当前光标坐标(cadr(grread '(2 13)))或(cadr(grread T 15 0))
(t)
));可使用默认短线长度spxdist
(setq p2(vlax-curve-getPointAtDist ob (+ spxdist(vlax-curve-getDistAtPoint ob p1))))
(setq fx(- (angle p2 p3)(angle p1 p2)))
(shipoxian ob spxdist (not(or(and( fx (- 0 pi)))(> fx pi))))
)
)
)
)
**** Hidden Message *****
你可以用这个改,步距,起点至底坡交点为长短线的长
刚试了,效果非常好.楼主大大提供的源码,方便了需要的人修改.非常棒.
简化更新有误,已改 这个好玩,复制试试效果
主函数也方便改造成画其他线型---实际是线性阵列变种 效果不错,试试看 是不是有BUG啊,多段线画的生成不了,输入短线长度后就没动静了
大佬作品就是牛 比较冷门,但是很专业,
页:
[1]
2