需要现有offse的帮助
以前通过用户名Kent Cooper找到此lisp。lisp例程将允许在两侧偏移用户输入的距离,并能够连接两侧的端点,使其成为一个对象。
有人能帮我修改一下,使两端在连接之前也延伸到与偏移相同的距离吗。
谢谢
;;OffsetBothSidesJoin.lsp
;;To Offset the same object to Both Sides at the same distance, and
;; if open-ended, Join the resulting objects with PEDIT.
;;On first use, offers regular Offset command's default distance,
;; but only if numerical .
;;Remembers specified offset distance, separately from regular
;; Offset command's default, and offers as default on later use.
;;Kent Cooper, 21 March 2014
;
(defun C:OBSJ (/ osd disttemp obj); = Offset to Both Sides
;
(setq osd (getvar 'offsetdist))
(setvar 'peditaccept 1)
;
(if *obsjdist (initget 6) (initget 7))
; no 0, no negative, no Enter on first use
(setq
disttemp
(getdist
(strcat
"\nBoth-sides-offset distance"
(strcat
(if (or *obsjdist (> osd 0))
(strcat ; then - construct default
" <"
(if *obsjdist
(rtos *obsjdist)
(rtos osd)
); end if
">"
); end strcat
"" ; else - no default offered on first use if Offset's is Through
); end if
); end strcat
": "
); end strcat
); end getdist
*obsjdist
(cond
(disttemp); User specified something other than Enter - use it
(*obsjdist); Enter with prior value set - use that
((> osd 0) osd)
; Enter on first use with non-Through Offset default - use that
); end cond & *obsjdist
); end setq
;
(while T
(if
(setq obj
(vlax-ename->vla-object
(car (entsel "\nSelect object to Offset to Both Sides : "))
); end vlax-...
); end setq
(progn
(vla-offset obj *obsjdist)
(setq ent1 (entlast))
(vla-offset obj (- *obsjdist))
(if (not (vlax-curve-isClosed obj)); e.g. Line, Arc, open Polyline
(command "_.pedit" "_m" ent1 (entlast) "" "_j" "_j" "_b" (* *obsjdist 2.5) "")
); if
); end progn
); end if
); end while
;
(princ)
); end defun
(prompt "Type OBSJ to Offset to Both Sides by the same distance and Join if possible.")
Kent经常在Autodesk customization论坛上发表文章。如果你在这里没有收到回复,我打赌如果你在那里发帖,他会帮你的。 可能的解决方法是偏移0.00000001并连接记住此对象(setq obj(entlast))然后偏移99.9999999擦除obj。手动测试需要将entlast添加到代码0.001,然后添加到50
我已经PM了他&碰巧他为另一个需要类似我的查询的用户提供了另一个lisp。我试过了,但由于他强调的一些限制,我没有成功。
但这很好,因为当前代码有一个变通方法。我只需要偏移比我需要的更小,然后使用法线偏移,这样端点就会更长。一个额外的步骤,但我可以接受。
谢谢
查看代码,但没有看到任何“(setq obj(entlast))”?
但是很好,因为我将使用变通方法。
谢谢
页:
[1]