李·麦克,
很高兴你回复了这篇文章,因为我正在尝试修改你的Lisp程序。最初,用户要求我修改它,以便他可以指定半径。所以我为他这么做了。现在他想要我指定的附加功能。
我已经阅读了你发给我的链接(顺便说一句,这很好),我有一个问题,不确定我是否完全理解。它始终不会读取最后输入的值。
您将看到,我注释掉了我的原始更改(setq bDis(getreal“\n为跳转半径输入新值:”),它确实有效。
- ;;; JMPR.lsp
- ;;;
- ;;; Description
- ;;; Jumper will auto-create the radius jump for pipe crossings.
- ;;;
- ;;; Author: Lee Mac (CADTutor)
- ;;; Date: 03/25/10
- ;;;
- ;;; Revision: 1
- ;;; Revision Date: 10/30/15
- ;;; Description - Modified by David Prontnicki
- ;;; Added the ability to select your radius at the beginning of the command.
- ;;; Changed interface verbage
- ;;;
- ;;; Command: JMPR
- ;;; -----------------------------------------------------------------------------;
- (defun c:jmpr (/ *error* A AENT B1 B2 BDIS BENT DOC ENT OV P1 P2 UFLAG VL O W)
- ; (setq bDis (getreal "\n Enter new value for Jump Radius: ")) ; Modified by David Prontnicki
- (setq bDis
- (cond
- (
- (getreal
- (strcat "\n Enter new value for Jump Radius <"
- (itoa
- (setq bDis
- (cond ( bDis ) (1) )
- )
- )
- ">: "
- )
- )
- )
- ( bDis )
- )
- )
- (defun *error* (msg)
- (and uFlag (vla-EndUndoMark doc))
- (and ov (mapcar (function setvar) vl ov))
- (and msg (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
- (princ (strcat "\n** Error: " msg " **"))))
- (princ))
- (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))
- vl '("PEDITACCEPT" "CMDECHO" "OSMODE") ov (mapcar (function getvar) vl))
- (setvar "PEDITACCEPT" 1)
- (while (and (setq uFlag (not (vla-StartUndoMark doc)))
- (mapcar (function setvar) (cdr vl) '(0 32))
- (setq p1 (getpoint "\nPick the crossing intersection: ")) ; Modified by David Prontnicki
- (setq ent (entsel "\nSelect the line to break: "))) ; Modified by David Prontnicki
- (setq p2 (osnap (cadr ent) "_nea")
- b1 (polar p1 (setq a (angle p1 p2)) bDis)
- b2 (polar p1 (+ pi a) bDis))
-
- (setvar "OSMODE" 0)
- (command "_.break" b1 b2)
- (setq bEnt (entlast))
- (if (> a (/ pi 2.))
- (command "_.arc" b2 "_E" b1 "_A" 180.)
- (command "_.arc" b1 "_E" b2 "_A" 180.))
- (setq aEnt (entlast))
- (if (eq "LWPOLYLINE" (cdr (assoc 0 (entget (setq ent (car ent))))))
- (progn
- (setq w (vla-get-ConstantWidth (setq o (vlax-ename->vla-object ent))))
- (command "_.pedit" "_M" bEnt aEnt ent "" "_J" "" "")
- (vla-put-ConstantWidth (vlax-ename->vla-object (entlast)) w)))
- (setq uFlag (vla-EndUndoMark doc)))
- (*error* nil)
- (princ))
任何帮助都将不胜感激。提前谢谢你。 |