埃尔弗特,你为什么不帮自己一个忙,试着从这篇文章中的大量例子中学习呢?
李:如果我在最后一篇文章中没有“走得更远”,我很抱歉。我不是你在那里写的一个坏代码,但我不是我想要的。我会尽量胡闹/改变它。但如果是a,我的任务会更容易;;解释我做的每一行。
致塔尔瓦特:
实际上你的代码离我要找的不远。。。我可以试着愚弄/改变它,但如果有一个;;解释我做的每一行。我问过这个问题,见第1页:
我也知道这不是一个免费的lisp代码论坛。。。每个人都必须学习并努力使其发挥作用。对于像我这样的新手来说,破译每一行代码都是一件困难的工作。
对不起伙计们 通过刷极地命令开始学习,这将沿着pline计算出下一个点。
新点=(极点角距离)
还有一些提示,pt1 pt2得到它们之间的“距离”除以水平步长这是你需要“重复”水平线的次数,你的线型由4个步骤组成,右、上、右、下,最后一个步骤是余数线。
然后,您的过程变为pt1 pt2 height width right up right down right up right down,然后启动pline命令,并根据需要重复多次。
像往常一样,李将该项目提升到了最高水平,并通过允许拖拽来增强它。
除非有指定数量的给定长度的“x”段,否则计算的“y”段将只是两个拾取点之间距离的剩余部分除以“x”段的长度,再除以“x”段的数量减去一,这确实是一个很小的距离。
非常感谢Tharwat
为了证明这一点:
你说得对,y线段非常小。但我需要更改代码,以便y线段的计算如下示例所示:
假设1点和2点之间的距离为160mm。
焊缝长度为25mm。(X线段)
然后代码应计算y线段为20mm。
希望这有帮助!
我读过。。。和阅读但是我找不到更改代码的地方,请。。。。请帮助
除非我忽略了一些明显的东西,否则你用什么关系来计算Y的长度是20mm?
X的80%?
160/25=6.4,6x25=150,160-150=10,10x2=20?
首先,我需要找出2个点之间需要多少X线段:
160/2=80,80/25=3.2,(3+1)=4个线段。
其次,我需要计算出2个点之间需要多少Y线段:
160/25=6,4这个i四舍五入到6,(6+1)-4个线段=3个线段。
这意味着y线段的长度为。
160-(4x25)=60,60/3=20mm。
检查我是否正确:(4*25)+(3*20)=160mm。是的,它很合适。
我希望这有帮助。。。。Thx lee mac。 为了简化计算,请尝试以下快速模式:
我很确定数学是这样的:
n=d/x+y1+y
y=((d-x)/n)-(x+y1)
这意味着从
d=135mm x=25mm y1=20mm
n=135/25+20+10=24545=2。
y=((135-25)/2)-(25+20)=10mm。
请帮忙! Thanks lee mac for the last code that is was seeking in last week. (Great)
But to my surprise on Thursday i have to make another routine where the user guess a length between x line segment. I called this line segment y1. Then the code have to calculate the y line segment and add this to the y1 line segment to give the the space between the x line segments.
An example:
User input:
Distance between 1 st. pointand 2.nd is 135mm.
Weld length x is 25mm.
A guess weld length y1 is 20mm
Lisp routine:
- Then the code should calculate the y line segment to 10mm and draw the polyline.
I have tried to make some change to code but no luck:
(defun c:wzz ( / a d h i l n p q x y y1) (setq h 20.0) (if (and (setq x(getdist "\nWeld Length: ")) (setq y1 (getreal "\nGuess a Weld length space: ")) (setq p (getpoint "\n1st Point: ")) (setq q (getpoint "\n2nd Point: " p)) (setq p (trans p 1 0) q (trans q 1 0) a (angle p q) d (distance p q) i (/ pi 2.0) n (fix (/ d (x+y1))) ) ) (if (< 0 n) (progn (setq y (/ (- d (* x (1+ n))) n)) (repeat n (setq l (cons (cons 10 p) l) l (cons (cons 10 (setq p (polar p a x))) l) l (cons (cons 10 (setq p (polar p (- a i) h))) l) l (cons (cons 10 (setq p (polar p a y))) l) l (cons (cons 10 (setq p (polar p (+ a i) h))) l) ) ) (entmake (append (list '(000 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (1+ (length l))) '(70 . 0) ) (reverse (cons (cons 10 (polar p a x)) l)) ) ) ) (princ "\nDistance too small.") ) ) (princ))I pretty sure that math is something like this:
n=d/x+y1+y
y=((d-x)/n)-(x+y1)
This means from
d=135mm x=25mm y1=20mm
n=135/25+20+10=2,4545 = 2.
y=((135-25)/2)-(25+20)=10mm.
Please help!
页:
1
[2]