Michaels 发表于 2022-7-6 08:07:31

多行的偏移

你好
 
我有一个立管,如图所示,我想选择黄线,偏移量应该是一个在右侧,一个在左侧,与红线相同。
 
希望通过lisp实现这一点
实例图纸

ReMark 发表于 2022-7-6 08:14:27

也许你可以从论坛成员李Mac的动态偏移lisp例程中受益。请在……查看。。。。
 
http://lee-mac.com/dynamicoffset.html
 
用户可以使用几个选项。

pBe 发表于 2022-7-6 08:16:35

 
“将对象偏移到…”
 
多次请求Autodesk应在下一个版本中包含名为ToOffsetThisandtothere或ToOffsetThisandtothere的命令
命令alia:TOTATATOT
 
随便。我在编写TOTATOT函数代码时遇到的问题。
 
对象类型
物体的方向
要偏移的边或要抑制“要偏移的边”提示的点值
新创建实体的图层/颜色/L类型
利用真实偏移或生成新对象
 
只有我的2美分

Michaels 发表于 2022-7-6 08:20:32

评论中给出的链接是Lee编写的非常好的代码,但在我的情况下不起作用。
 
pbe,我不明白你的想法,所以请你看一下图纸,看看我在裁判什么?
 
谢谢大家

pBe 发表于 2022-7-6 08:25:18

 
我在表达一个观点,迈克尔,不要在意
 
我看了你的画。当我在思考你的要求时,上面的问题不断浮现在我的脑海里。
 
告诉我,你打算怎么做?记住我发布的问题。你会怎么回答?

Michaels 发表于 2022-7-6 08:28:00

 
1-仅选择行(2个数字)
2-左侧的线及其偏移线应向左,右侧的线应向右。
3-(如果你是指偏移的距离)它总是50.0
4-层应遵循原始层(线)。
 
我回答对了吗?
 
非常感谢您的兴趣pBe。

pBe 发表于 2022-7-6 08:34:51

1、检查
2、检查
3、检查
4、检查
 
好吧,这就缩小了范围。
 
现在你需要做的就是等待。。。有人会过来写一个代码,或者给你指出正确的方向。
 
耐心,迈克尔

pBe 发表于 2022-7-6 08:37:12

哇。。。我很惊讶没有人为你写代码。。我在度假(至少是从cad来的)。我想我能做的就是提个建议。
<p>(if and (setq ss (ssget "_:L"))(= (setq i (sslength ss)) 2))</p><p>Get midpoint of both lines </p><p>Midpoint of two points as reference to test for "side to offset", the point will be oposite to where the new lines will be. easy huh?</p><p> </p><p>As soon as i can get my hands on CAD i'll write one for you, but i dont see that happening anytime soon. </p><p> </p><p>but i'm sure someone here will get it to later.</p><p> </p><p>again be patient Michaels</p>

pBe 发表于 2022-7-6 08:42:53

这里有一个快速的
 
(defun c:o2(/ _dxf ss pts rf pt1 pt2)
   (defun _dxf (e n) (cdr (assoc n (entget e))))
   (defun _mid(p1 p2)
         (mapcar (function (lambda (a b) (/ (+ a b) 2.))) p1 p2))
   (while
         (and (princ "\nSelect 2 Lines to offset")
(setq ss (ssget "_:L" '((0 . "LINE")))) (= (setq i (sslength ss)) 2))
                (setq pts (list (_dxf (setq 1st (ssname ss 0)) 10)
                              (_dxf 1st 11)
                              (_dxf (setq 2nd (ssname ss 1)) 10)
                              (_dxf 2nd 11)))
                (setq rf (_mid (setq pt1 (_mid (car pts) (cadr pts)))
                               (setq pt2 (_mid (caddr pts)
                                             (cadddr pts)))))
                (command "_offset"50.0
                      (ssname ss 0) "_non"
                      (polar rf
                           (angle rf pt1)
                           (+ (distance rf pt1) 50.0))
                      "")
                (command "_offset"
                      50.0 (ssname ss 1) "_non"
                      (polar rf
                           (angle rf pt2)
                           (+ (distance rf pt2) 50.0))
                      "")
                )
   (princ)
   )
 
我有点惊讶,真的没有其他人写了一个代码,这个刚刚从度假回来。
Anyhoo。。试试Michaels,告诉我你的想法(如果你的请求仍然需要lisp例程的话)

Lee Mac 发表于 2022-7-6 08:45:40

 
我们在这里不仅仅是为人们编写代码。
页: [1] 2
查看完整版本: 多行的偏移