AutoCAD Visual LISP / AutoLISP :: Cancel Command With Reactor

Nov 24, 2011

It is possible to cancel a command using visual lisp reactors. If this is not there another way I could do that. I tried to use UNDEFINE but it works only with own CAD ​​commands and not with Visual Lisp command.

View 1 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Disable Command MOVE On Reactor?

Feb 7, 2012

I use the following code to assign a reactor to an object:

(setq marReactor (vlr-object-reactor (list (vlax-ename->vla-object oggmar)) "TEST" '( (:vlr-erased . reactor_upd) (:vlr-modified . reactor_upd) ) ))
 
"reactor_upd" is the name of the function that starts every change or delete the object.

I would like to exclude the command "MOVE", ie if I move the object, I do not want that part to the"reactor_upd" function.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Cancel Return Value Of REPEAT Command

Jan 10, 2013

I use the Repeat command with an index, and when it exits, it writes the last index.

I cannot move it to a new line,nor cancel it.

If i insert a (princ "") inside the loop it moves it to a new line, but also all  the outputs of the loop get extra line spaces

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Good Replacement For SAVE Command To Use It Within Reactor?

Nov 17, 2013

I need to find a way to find a good replacement for "SAVE" command to use it within Reactor. I want to save A COPY of my current ("active") DWG document to another place *without making it current* (just like command "SAVE" does and did it always). I know I could use (vla-saveAs ...) to save it first to another Folder and then use (vla-save ...) to save it back to its current Folder, but there must be a way to do it simply and fast.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Detecting The Object Name With A Reactor

Dec 9, 2011

i am trying to add a reactor to ddatte command,  would like to know which object was being edited, the ename or object name (ssget "P") does not seem to be the one

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Assign Reactor To Object?

Feb 7, 2012

I use the following code to assign a reactor to an object.

Now I noticed that if I close the dwg file after you successfully saved, when I open even if I load the lisp, the reactor does not work.

Another problem: when I use the command "erase" or "explode" the reactor is started twice, why? you can run it at once?

(setq marReactor (vlr-object-reactor (list (vlax-ename->vla-object oggmar)) "TEST" '( (:vlr-erased . reactor_upd) (:vlr-modified . reactor_upd) ) ))

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Detect Dimstyle Change In Reactor?

May 17, 2012

I need ot append events when the dimstyle is change using the AutoCAD dimstyle popup list, but don't know which reactoer to use. I tried with Comman begin and end, and Sysvawill change and changed, but they don't detect the dimstyle changes.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Redefine Block Inside Reactor

Dec 4, 2012

I have the following code to redefine a block after a command has ended:
 
(vl-load-com);*********************************************************(defun Redefine() (command "_.INSERT" "reactortest=reactortest" nil)(princ "Block redefined."));****************************************(vlr-command-reactor nil '((:vlr-commandEnded . endCommand)));******************************************************(defun endCommand (calling-reactor endcommandInfo / thecommandend) ; Get the name of the command.(setq thecommandend (nth 0 endcommandInfo)); Check name of the command.(cond ((= thecommandend "PLINE") (Redefine)));cond(princ));defun(princ)

It doesn't work because INSERT is an interactive function and can't be called while a reactor is active. Is there another way to redefine a block that can be used in a reactor? The block is in one of the default search path's.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check If An Object Already Has A Reactor Connected

Mar 30, 2012

how can I check whether an object has a reactor connected?

I wrote the following
 
(defun c:**** (/ ogg collegaReactor) (setq ogg (car (entsel))) (setq collegaReactor (vlr-object-reactor (list (vlax-ename->vla-object ogg)) "NOMEAPP" '( (:vlr-modified . testedit) (:vlr-objectClosed . endedit) ) ) ))(defun testedit (notifier-object reactor-object parameter-list / ogg collegaReactor) (alert "testedit"))(defun endedit (notifier-object reactor-object parameter-list / ogg collegaReactor) (alert "endedit"))
 
If I start two or three or more times the "c:****" and select the same object, when I changethe "alert" appear several times.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Object Reactor And Load Function LSP

Mar 13, 2012

I open the drawing without loading the function, when I modify an object with the reactors appears the following error message:

function definition: NAMEFUNCTION

You can avoid this annoying message without removing the persistent reactors? 

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Reactor Triggers Fatal Error

Jun 15, 2012

I have created a very basic reactor as a test. As you can see, it doesn't actually do anything other than set a variable so I know the error isn't caused by something I'm doing with the reactor.

 (defun np:test (reactor callbackdata / ) (setq abc 123))(if (not np:reactor1) (setq np:reactor1 (vlr-command-reactor nil '((:vlr-commandwillstart . np:test))) ))
 
OK, so the problem I have found is that if I load this reactor into a drawing and then use the MVSETUP command but escape out without completing the command, AutoCAD throws an error and becomes unusable. When I then close AutoCAD down I am met with multiple unhandled exception errors before the app finally closes.

I then altered the reactor from a vlr-command-reactor to a vlr-editor-reactor and found that with this, I am no longer met with the same error while escaping out of MVSETUP. However, when I close CAD down I am eventually left with an 'AutoCAD Application has stopped working' error dialog on screen which reports that acad.exe as crashed.

I am working on AutoCAD Architecture 2012 (although I have tried it on 2013 to with the same results) on Windows 7 64bit. I have also tried this on ACA2012 x32 and found the same error exists.

I am doing something fundamentally wrong in the way I am handling reactors?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Object Reactor Owner Size Limitation?

Dec 28, 2011

Does Object Reactor has an owner size limitation?

when the owner size is big (about 1000) trying to disable the reactor (vlr-remove ReactorObj) causes AutoCAD to crash right on spot.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Reactor - How To Change Xdata Length If Line Is Modified

May 18, 2010

I need a Reactor to Modify Xdata - Length - contained in Line Object if this Line is modified (stretched, breaked, trimmed, etc).The routine need to verify if Line contain Xdata and modify it (and works with multiple selection).

I tried for long hours, but without success. I tried to create a list of entities while the reactor is applied, but doing so need another reactor to change these entities after the first Reactor works.The codes I used are below:

{code}
;If it just 1 string only you want to add
(defun add_xdata_str (e a v);;;EName APPID String_value
(and (not (tblsearch "APPID" a))
(regapp a))
(and (= (type e) 'ENAME)
[code]....

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Xref Reactor Object ID To Xref Name

Oct 2, 2012

I am using (trying to anyway) a :VLR-xrefSubcommandReloadItem reactor.  My only question is how to get the xref/block name from the 'reactor callback data' Object ID.

I am ultimately trying to pass it to (vla-get-xrefdatabase ....), but I cannot figure out how to turn the second parameter from the reactor callback data into something I can use - for example the second parameter returned may be "65" or some other number. 

Civil 3D 2011
Windows 7 x64

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Annotation Command Set Correct Layer For Duration Of Command

Nov 21, 2010

I am currently writing a series of routines for setting the layers for text, leaders and dimension commands. The end goal is a system where any annotation command sets the correct layer for the duration of the command, then reverts back to the layer that was active before the command.

I have managed to complete all the code, and it appears to be working fine, I just have one question: I have used -layer "m" "Lay_name" etc... for all layer setting commands, rather than any code to see if the layer exists already. In my limited testing this seems to be suitable, nothing that exists on that layer seems to be affected.

I know how to write code to determine if the layer exists already and set the layer instead, but so far it seems unnecessary??

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Write A Lisp Routine That Invoke The Mleader Command

Oct 11, 2012

I'm trying to write a lisp routine that, when I invoke the mleader command, osmode is set to "nearest" & orthomode is set off. I then would like the original settings to be returned.

attached is what I have written so far:-

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Nil At The End Of Command

Jun 22, 2012

I have a routine that work fine, but I receive a nil at the end of command. How to fix that?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: DOS DIR Command

Oct 27, 2012

I need a program that simulate this DOS command: dir /on/b *.dwg >list.txt

it list all dwg files on current open dwg file folder and sort them and finally put them in a text file with list.txt name. something like thistype list.txt)

test1.dwg
test2.dwg
test100.dwg
test256.dwg
test1005.dwg

(sort alphabetically and logically) because of disabled DOS utility in my PC I need a pure lisp functions, I tried to wrote this program but I couldn't!!

(defun c:listMaker()
(vl-load-com)
(setq path (getvar "dwgprefix"))
(setq fn "list.txt")
[code]...

and also I need a append a string(='This Is EOF') in the last line of the "list.txt" file.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Can't Get While Command Right?

Apr 13, 2012

I am trying to get my original layer and lintype reinstated after the user is finished with the pline..I know Im suppose to use the while command but am now completely lost on which way to do this

(DEFUN c:TEST1 ()(if (not (tblsearch "LTYPE" "MYWC")) (command "-linetype" "LOAD" "MYWC" "C:/COUNTER.LIN" ""));SECOND PROGRAM...;CREATE CORESPONDING LAYER...(command "._Layer" "Make" "WC LEIDING" "Ltype" "Continuous" "" "Color" "211" "" "")(SETQ MYOLDCELTYPE (GETVAR "CELTYPE"))(SETVAR "CELTYPE" "MYWC")(while (PROGN(COMMAND "pline")(SETVAR "CELTYPE" MYOLDCELTYPE)))

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Error In While Command

May 22, 2013

We have a lisp routine that I co-authored ages ago and then haven't done much programming in about 7 years.  I seem to have forgotten much of my language skills.  This portion of the lisp routine was running fine in autocad 2005 which is what the computer had on it, and it doesn't run on autocad 2010. 

I've narrowed it down to the while statement which is why you see it commented out, but that portion is necessary.   My main question is was there a change in the language specifically the while statement between 2005 and 2010? 
 
; GET LINES OVER 10" AND THROW OUT (if (= (cdr(assoc 0 outerinfo)) "LWPOLYLINE") (progn (setq remlenouter 0.0) (setq numseg (cdr(assoc 90 outerinfo))) (setq edd (member(assoc 10 outerinfo) outerinfo)) (setq n1 0) ;(while (< n1 (- (* numseg 4) 4)) ;(setq dist (distance (cdr(nth n1 edd)) (cdr(nth (+ n1 4) edd)))) ;(if (>= dist edmmax) (setq remlenouter (+ remlenouter dist))) ;(setq n1 (+ n1 4)) ;) ; end while (setq dist (distance (cdr(nth n1 edd)) (cdr(nth 0 edd)))) (if (>= dist edmmax) (setq remlenouter (+ remlenouter dist))) ) ; end progn ) ; END IF

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Looping A Command

Aug 26, 2013

I am using AutoCAD 2011. I have a lisp that I have created/modified.

What it does:

Allows me to Select a layer that I call out and change its color properties back to bylayer.

(i primarily use this when i am cleaning up my drawings, I turn them all to gray with another command i have then i run this one to find all the entities on that specified layer)

What i am trying to do: 

I would like this command to do a loop.  So say i type in a layer name that does not exist, instead of running through the rest of the command i want it to revert back to "specify layer name" until the correct name is entered for that layer.

Here is the lisp:

(defun cLL ()
(setq varLayer (getstring t "
Specify Layer Name: "))
(sssetfirst nil (ssget "X" (list (cons 8 varLayer))))
(command "change" "p" "" "p" "c" "bylayer" "")
(princ)

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check For Last Command

Jan 8, 2014

We have developed processes, standard operating procedures, work instructions (whatever you want to call it) for several tasks we do on a regular basis.  More importantly, tasks that we don't do on a regular basis.  On some processes, performing certain commands is a critical step in the quality of the product.  I have also developed a lot of lisps to streamline these processes.  Of course there are commands that just don't make sense to try and include into existing lisps.

The problem we're having though, is that people are not following the processes.  I don't know if they think they are smarter than the process, or if they don't understand the process, or if they are just complacent.

One of the things that would really work to get everyone to follow the process, is to have my lisp routines check to see what the last entry at the command line was.

For example, if one of my lisps depended on the drawing be saved, well, instead of putting the save command in the lisp, sometimes it would be beneficial to check to see if the drawing was saved in the first place.  Kudos to those who do follow the process, they do save the drawing, and then run the lisp.  On rather large files, I would prefer not to save the drawing twice, back to back.

There are a lot more benefits to checking to see what the last user entry was, in a certain drawing. 

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: DCL Command Locking Up

Aug 8, 2012

 I am new to DCL programming and am having an issue getting a button to recognize a command.  As a simple first attempt, I am trying to create a dcl with a button called "draw test line"  that will draw a line from 0,0 to 1,1.  The lisp loads correctly and the "cancel" button works fine.  However when the "draw test line" button is pressed, autocad locks up and the only solution is to restart.  here is the dcl

testline : dialog {
          label = "draw line test";
          : column {
            : boxed_column {
              : button {
                key = "but1";
                label = "draw a line";
                is_default = false;
[code]....

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Can't Redefine ID Command

Nov 5, 2013

I've written a script that improves the default "ID" command, but it's not working.

I was able to redefine the "DI" command.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Return Last Command

Jun 27, 2013

Trying to diable the spacebar = (return last command) function!

commandlinehide does te job in the working interface, but a space in scriptmode (in the filename e.g.) still repeats last command!

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Control UCS Without Using Command Line?

Nov 9, 2012

Is it possible to control the UCS without using the command line?  I'd like to access it and control it with vlisp much the same way I can access DXF groups and manipulate insertions.  Seems like it should be possible to play with it's definition inside the object model.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Prevent Command From Repeating?

Jul 6, 2012

I am working on a lisp to scale drawings of various sizes to a predetermined size.  After the lisp has run and scaled the drawing, the prompts for base point and reference point run a second time.  How can I get this to run through once?  I think it has something to do with the way the reference length is being entered.  The base point and first reference point are the lower left corner of the drawing, while the second reference point is the lower right corner.

(COMMAND "SCALE" "ALL" "" (SETQ A (GETPOINT "
SELECT BASE POINT :")) "R" A
 (GETPOINT "
SELECT REFERENCE POINT : "))
  "1'-5"")

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Command Alias Transfer?

May 23, 2012

Most efficient way to transfer my custom pgp commands? I'm constantly moving between different computers and autodesk versions.

I used to just be able to overwrite the acad.pgp file in the support directory but this doesn't seem to work in the newer versions and I'm hesitant to continue like that in case their are new commands introduced in newer versions that I don't know about then they'd be over written.

Is there anyway to include my command overrides (eg. c=copy) in my back up cui file?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Add Text To Command Line

Nov 18, 2013

I have a custom command that I can initiate (c:TxtE).  The function starts running but I need to begin adding several inputs at the command line following this.  (ex:  "4" "all" "" "oldtext" "newtext").  How do i do that within lisp once the custom command has already begun?  If I need to modify the function how would i pass all these as optional type variables?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating An Export Command?

Feb 11, 2013

I am attempting to create a export command for our surveyors that deletes all there point layers and seal layer, then audits and saves the file before opening the etransmit command.

Below is what I currently have.I know there is a better way to do this, but it is above my programing skill right now.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SURVey export(defun C:SRVY () (command "-laydel" ; Delete Survey data "Name" "F0" "Name" "F1" "Name" "F2" "Name" "F3" "Name" "F4" "Name" "F5" "Name" "F6" "Name" "F7" "Name" "F8" "Name" "F9" "Name" "F10" "Name" "F11" "Name" "F99" "Name" "SHEET-SEAL" ENTER "YES" ) (command ".audit" "y") ; Audits file (command "_qsave") ; Save changes (command "-etransmit" "Choose Setup" "ACAD2010" "Create transmittal package" ) (princ))

AutoCAD Civil 3D 2012 (Primary), 2011 by contract.

Dell Percision T3500: MS Windows 7 64-bit SP1; Intel Xeon CPU W3505 @ 2.53GHz, 12.00 GB RAM, NVIDIA Quadro 600

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Command / If Layer Is Frozen

Mar 29, 2012

I have a  Layer named "Arch - Niveau 1".I would like to enter in the command prompt  "a1"..It would read if the layer is frozen or thawed and if it is frozen, it will thaw it?

And if the layer is thawed, it would freeze it..What could be added is: To check up if the layer exists and if not, create it.Would do the same for 2 other layer named "Arch - Niveau 2" command "a2"   and  "Arch - Niveau 3" command "a3". Is it clear?Now the lisp I've found and modified is this:

(defun c:a1 (/ lay ldef flag) (setq layn "Arch - Niveau 1") (command "_.LAYER") (if (not (tblsearch "LAYER" layn)) (command "_Make" layn) (progn (setq ldef (tblsearch "LAYER" layn) flag (cdr (assoc 70 ldef))) (and (= (logand flag 1) 1) (command "_Thaw" layn)) )) (command ""))
 This lisp looks if it exists, if not, create it and only thaw the layer.

I'm not enough familiar with the "not", the "progn" the "flag", "and" and "logand"  (!!!!)

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved