Cylis0509 Posted January 20, 2017 Share Posted January 20, 2017 Hi everyone, I am modifying a LiSP I found online and I have been able to figure out most of what I want to change. The one issue I am having is with an active command. When the LiSP calls the revcloud command I do not have access to the revcloud settings. How do I modify the code to allow this. See pics. If you look at the pic whatiget.png you will see that the settings display differently, I noticed that I could type a, s, or t and I can change the settings but they do not appear as they should while under the normal command. (With the blue letters to denote what to type, see pic commandsettings.png) I fear this will confuse users. Any help would be greatly appreciated. Thank you, ( (setq *rev* (cond ( (= "" (setq rv (getstring t (strcat "\nSpecify Revision Number" (if *rev* (strcat " <" *rev* ">: ") ": "))))) *rev* ) ( rv ) ) ) (command "_.revcloud") (while (= 1 (logand 1 (getvar 'cmdactive))) (command "\\")) (setvar 'cmdecho 0) (setvar 'attreq 0) (setq el (entlast)) (princ "\nSpecify Insertion Point for Revision Block: ") (command "_.-insert" bn "_S" 1.0 "_R" 0.0 "\\") (if (not (eq el (setq el (entlast)))) (progn (setq el (entget (entnext el))) (if (entmod (subst (cons 1 *rev*) (assoc 1 el) el)) (entupd (cdr (assoc -1 el))) ) ) ) Quote Link to comment Share on other sites More sharing options...
Hippe013 Posted January 20, 2017 Share Posted January 20, 2017 It would help if you are able to post your code in its entirety. When I test what you have listed I get the options for REVCLOUD. Quote Link to comment Share on other sites More sharing options...
Cylis0509 Posted January 21, 2017 Author Share Posted January 21, 2017 Sorry about that, I have pasted the complete code below. Keep in mind it still needs a little clean up and TLC... (defun c:rv ( / *error* doc layers ent ar bn cm el fn rv ) (vl-load-com) ;;Set the active document (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) ;;Set the active layer list (setq layers (vla-get-layers (vla-get-ActiveDocument(vlax-get-acad-object)))) ;;Get the current layer and store it for reuse (setq olayer (vlax-variant-value (vla-getvariable (vla-get-activedocument (vlax-get-acad-object)) "clayer"))) ;;Set start of undo mark (vla-startundomark doc) ;;Create the layer for revisions if it does not exist (foreach lay '("T-ANNO-REVS-TEXT") ( (if (setq ent (tblobjname "layer" lay)) (lambda ( lst ) (entmod (cons (cons -1 ent) lst))) entmake ) (list '(000 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") '(070 . 0) '(062 . 241) (cons 002 lay) ) ) ) (vlax-for l layers (progn (member (strcase (vla-get-name l)) '("T-ANNO-REVS-TEXT")) (vlax-put-property l 'PlotStyleName "B040(7)") ) ) ;;set layer to T-ANNO-REVS-TEXT (setvar "CLAYER" "T-ANNO-REVS-TEXT") ;;Set the revision cloud attribute block (setq bn "revisionblock") ;;Error handling for break, cancel, or exit (defun *error* ( msg ) (if cm (setvar 'cmdecho cm)) (if ar (setvar 'attreq ar)) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\nError: " msg)) (setvar "CLAYER" olayer) ) (princ) ) (setq cm (getvar 'cmdecho) ar (getvar 'attreq) ) (cond ( (not (or (tblsearch "BLOCK" bn) (and (setq fn (findfile (strcat bn ".dwg"))) (progn (setvar 'cmdecho 0) (command "_.-insert" fn nil) (setvar 'cmdecho cm) (tblsearch "BLOCK" bn) ) ) ) ) (princ (strcat "\n" bn ".dwg not found.")) ) ( (zerop (logand 2 (cdr (assoc 70 (tblsearch "BLOCK" bn))))) (princ (strcat "\n" bn " not attributed.")) ) ( (setq *rev* (cond ( (= "" (setq rv (getstring t (strcat "\nSpecify Revision Number" (if *rev* (strcat " <" *rev* ">: ") ": "))))) *rev* ) ( rv ) ) ) (command "_.revcloud") (while (= 1 (logand 1 (getvar 'cmdactive))) (command "\\")) (setvar 'cmdecho 0) (setvar 'attreq 0) (setq el (entlast)) (princ "\nSpecify Insertion Point for Revision Block: ") (command "_.-insert" bn "_S" 1.0 "_R" 0.0 "\\") (if (not (eq el (setq el (entlast)))) (progn (setq el (entget (entnext el))) (if (entmod (subst (cons 1 *rev*) (assoc 1 el) el)) (entupd (cdr (assoc -1 el))) ) ) ) (setvar 'attreq ar) (setvar 'cmdecho cm) ) ) (princ) ;;Restore old layer (vla-setvariable (vla-get-activedocument (vlax-get-acad-object)) "clayer" olayer) ;;Set end of undo mark (vla-endundomark doc) ) (princ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 21, 2017 Share Posted January 21, 2017 Bit shorter really no need to use vl (setq olayer (vlax-variant-value (vla-getvariable (vla-get-activedocument (vlax-get-acad-object)) "clayer"))) (setq olayer (getvar "clayer")) (vla-setvariable (vla-get-activedocument (vlax-get-acad-object)) "clayer" olayer) (setvar "clayer" olayer) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 21, 2017 Share Posted January 21, 2017 Found this via a google So I used: (command "revcloud" "A" (* 0.3125 (getvar "DIMSCALE")) "") It's probably a bit messy: I'm not the greatest at LISP. After the user runs this once, the arc length will then scale with the dimscale automatically. The trick is telling the tool that the arc length should always be 0.3125 of the dimscale. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.