bsimpson 发表于 2022-7-6 11:07:37

垂直线

你好
 
我有一个lisp文件,它在两条多段线之间运行垂直线,并生成一个ascii文件。lisp文件还在AutoCAD2010中绘制线条。我想通过包括以下改进来更新该文件:
 
1、测量的宽度应在测量线的中点绘制为文字。
 
2.多段线起点的注释(文本对象)应为缩进和多段线的终点。
 
3.需要在ascii文件中生成坐标X和Y。
 
这个lisp例程正在产生奇妙的结果。
 
谢谢
 
bsimpson。
垂直度。lsp

Lee Mac 发表于 2022-7-6 11:15:11

哇-这是一个很长的时间以来,我写的。。。
 
试试看,它使用了不同的方法:
 
(defun c:LPerp(/*error*DER DOC E1 E2 EDIS FILE ILST L LLST OBJ2 of ile PA PT SDIS SPC TMP)(vl load com);;Lee Mac 17.05.10(defun*error*(msg)(and tmp(entdel tmp))(and ofile(close ofile))(或(wcmatch(strcase msg)“*BREAK,*CANCEL*,*EXIT*”)(princ(strcat“\n**error:”msg“**”)(princ))(setq spc(if(或(eq AcModelSpace(vla get ActiveSpace)(setq doc(vla get ActiveDocument)(vlax get acad object))))(等式:vlax true(vla get MSpace doc))(vla get ModelSpace doc)(vla get PaperSpace doc))(if(apply(function and)(append(mapcar(function(lambda(sym str)(set sym(curveiffo isCurveObject str)))'(e1 e2)“(选择第一条曲线:”“\n选择要测量的曲线:”))(list(setq file(getfield“Create Output file”“”“txt”1)))(progn(initget 6)(setq*step*(cond((getdist(strcat“\n指定步骤:))(*step*))(mapcar(function set)”(obj1 obj2)(mapcar(function vlax ename->vla object)(list e1 e2)))(mapcar(函数(lambda(实体)(mapcar(函数(lambda(ipt str)(MText spc ipt str acAttachmentPointMiddleCenter)))(列表(vlax curve getStartPoint实体)(vlax curve getEndPoint实体))(列表“Start”“End”)))(列表e1 e2))(setq sDis(-(vlax curve getDistatParam e1(vlax curve getStartParam e1))*步骤*)eDis(vlax curve getDistatParam e1(vlax curve getEndParam e1)))(而(vla对象(setq tmp(线pt(极性pt(+(角度'(0 0 0)(vlax曲线getFirstDeriv e1(vlax曲线getParamatDist e1 sDis)))(/pi 2)1.)))’与Obj2 acExtendThisEntity相交))(entdel tmp)(setq tmp nil)iLst)(progn(setq lLst(cons(list(car iLst)(cadr iLst)(vlax curve getDistatParam)(setq l(Line pt(list(car iLst)(cadr iLst)(caddr iLst)))(vlax curve getEndParam l)))lLst))(vla put rotation(MText spc(polar(vlax curve getPointatParam l(setq pa(/(vlax curve getEndParam l)2.))(+(/pi 2)(设置顺序(角度)(0.0.0。)(vlax curve getFirstDeriv l pa))(/(getvar’TEXTSIZE)2)(rtos(vlax curve getDistatParam l(vlax curve getEndParam l)))acAttachmentPointMiddleCenter(MakeReadable der)))(文件集(打开文件“w”))(mapcar(函数(lambda(line)(写入行(lst2str(mapcar(函数rtos)行)“ofile”))lLst)(setq ofile(close ofile)))(princ))(defun MAKEREABILED(a)(cond((and(>a(/pi 2))(a pi)(

bsimpson 发表于 2022-7-6 11:21:07

嗨,李,
 
感谢这一点,宽度在图纸中绘制得非常完美。仍然存在以下异常:;
 
1、坐标与图纸不符,我分不清是从哪里来的。
 
2.当我打开ascii文件时,我无法判断测量是从多段线的哪一侧进行的。如果道路宽度相同,则会发生这种情况。
 
也许你可以把增量放在垂直线底部旁边的图形上,然后把增量放在ascii文件中。
 
再次感谢
 
bsimpson8)

Lee Mac 发表于 2022-7-6 11:25:55

辛普森先生,
 
代码的工作方式是沿着第一个选定对象以设定的距离递增移动,并创建一条从第一个对象延伸到第二个对象的垂直线(如果可能)。
 
您在ASCII文件中看到的点是与第二个对象的交点。
 
然而,我必须强调,请记住,我在这个论坛上的时间是自愿的,我没有收到任何提供这些代码的报酬。

bsimpson 发表于 2022-7-6 11:30:53

嗨,李,
 
我很感激这里没有换货。我能看到这项业务的潜力,并能在全国范围内将你与合适的公司联系起来,这家公司需要对他们的软装进行这种改进。
 
我在实验基础上使用此文件仅供参考,并试图改善道路设计中存在的设计时间。
 
人们在问这些信息来自哪里。
 
谢谢
bsimpson。

bsimpson 发表于 2022-7-6 11:37:24

你好
 
我需要偏离规范。
 
发送到ascii文件的坐标点需要更改为测量垂直角度的其他相关点。
 
步长增量需要在直线和垂直线的交点处绘制在图形上,并插入到ascii文件中。
 
谢谢
 
 
bsimpson公司
测试v3。txt文件
测试v3。图纸

Lee Mac 发表于 2022-7-6 11:42:12

这应该适合你的需要,但我郑重建议你改变要求这样做的方式。
 
(defun c:LPerp(/*error*DOC E1 E2 EDIS FILE ILST L LLST OBJ2 of ile PA PT SDIS SPC TANG TMP TOBJ UNDO)(vl load com);;Lee Mac ~ 17.05.10(defun*error*(msg)(and Undo(vla EndUndoMark doc))(and tmp(entdel tmp))(and ofile(close ofile))(or(wcmatch(strcase msg)“*BREAK,*CANCEL*,*EXIT*”)(princ(strcat“\n**error:”msg“**”)(princ))(setq spc(if(or(eq AcModelSpace(vla get ActiveSpace(setq doc))(vla get ActiveDocument(vlax get acad object)))(等式:vlax true(vla get MSpace doc))(vla get ModelSpace doc)(vla get PaperSpace doc))(if(apply(function and)(append(mapcar)(function(lambda(sym str)(set sym(curveiffo isCurveObject str)))“(e1 e2)”(\n选择第一条曲线:“\n选择要测量的曲线:”)(列表(setq file(getfield“Create Output file”“”“txt”1)))(progn(setq Undo(not(vla StartUndoMark doc)))(initget 6)(setq*步骤*(cond((getdist(strcat“\n指定步骤:))))(*步骤*))(mapcar(功能集)'(obj1 obj2)(mapcar(功能vlax ename->vla对象)(列表e1 e2))(mapcar(功能(lambda(实体)(mapcar(功能(lambda(ipt str)(MText spc ipt str acAttachmentPointMiddleCenter)))(列表(vlax curve getStartPoint实体)(vlax curve getEndPoint实体))(列表“Start”“End”))(列表e1 e2))(setq sDis(-vlax curve getDistatParam e1(vlax curve getStartParam e1))*步骤*)eDis(vlax curve getDistatParam e1(vlax curve getEndParam e1))(而(vla对象(setq tmp(线pt(极性pt(+(角度’(0 0 0)(vlax curve getFirstDeriv e1(vlax curve getParamatDist e1 sDis)))(/pi 2)1.)))’与Obj2 acExtendThisEntity相交))(entdel tmp)(setq tmp nil)iLst)(progn(setq lLst(cons(list(car pt)(cadr pt)(vlax curve getDistatParam)(setq l(Line pt(list(car iLst)(cadr iLst)(caddr iLst)))(vlax curve getEndParam l)))lLst))(vla put rotation(setq tObj(MText spc(vlax曲线getPointatParam l(setq pa

bsimpson 发表于 2022-7-6 11:42:54

Hi,
 
Thanks for the advice, :wink:
 
The program is working but still the results could be better. There are points between the increments that are missed so in additon a lisp file that measures slightly differently to pick up these points is in need.
 
This will be done by measureing the line from the vertex of the polyline (red) to the perpendicular angle of the polyline (blue)
 
No need to step at an increment along the first curve (blue) as before but the text measurement is needed for the distance from the start to the point of intersection on the first curve (blue). This text is also needed in the ascii file for the location of the perpendicular measurement + coordinates. see attachments.
 
Hope you will find time to help out
 
cheers
bsimpson
TEST_V4.dwg
TEST_V9.txt

alanjt 发表于 2022-7-6 11:52:22

I think it's time someone learned to write their own LISP routines.

Lee Mac 发表于 2022-7-6 11:56:27

That's a different thing entirely... it would have been niceto have had that drawing from the first post - that would have saved a lot of time. So much for 'refinements'.
页: [1] 2
查看完整版本: 垂直线