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


ADVERTISEMENT

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 :: 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 :: 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 :: 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 :: Show (read / Assign Variables) To Normal Or Custom Properties In Object?

Apr 9, 2012

Looking for Lisp command to show (read/assign variables) to normal or custom properties in an object?

View 7 Replies View Related

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 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 :: 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 :: 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 :: 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 :: 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 :: 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 :: How To Assign Value To List Of Variables

Oct 31, 2013

I am unsure why my Lisp does not work.

(DEFUN C:Clear_values (/ GLBLS) (SETQGLBLS '(*DATEDRAWN* *DRAFTNAME* *JOBNUMBER* *OWNERNAME**JOBCOE* *PERMITREVDATE* *PERMITCONTACT* *HOMEBUILDER**SUBDIVISION* *ADDRESS**CITY* *STATE* *ZIP* *LOT#**PARCEL#* *NSCOORD* *EWCOORD* *STANDARDDETAIL#**SUPERNAME* *SALESMAN**GATECODE* *HOMEPHONE* *WORKPHONE* *ALTPHONE1**ALTPHONE2* *EMAIL1* *EMAIL2* *ACCESS**EXCAVATIONTYP* *EXCATDEMO1**EXCATDEMO2* *SKIMRUN* *AWLRUN*

[code]....

 I've tried several options such as (mapcar 'set GLBLS "%%") but nothing happens, and with the above code nothing happens; the code only returns nil.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Assign Elevations To Polylines Sequentially At A Set Interval

Nov 27, 2013

have a lisp routine that will ask you the starting elevation and the elevation interval, then allows you start selecting polylines and it assigns them new elevations based on your choices?

It seems years ago I had a routine that did this and it also changed the color of the polyline so you could tell which ones you had already changed, but I can't seem to find it now.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Assign Variable Based On The Number Of Characters To Be Removed

Apr 1, 2013

(defun layun (target_obj / original_layer original_layer_info target_obj_atts new_layer )(setqoriginal_layer (cdr (assoc 8 (entget target_obj)))original_layer_info (tblsearch "layer" original_layer)target_obj_atts (entget target_obj));setq(if (or(wcmatch original_layer "*-P123"); REMOVES 4 CHARACTERS(wcmatch original_layer "*-P123456"); REMOVES 7 CHARACTERS(wcmatch original_layer "*-P123456789"); REMOVES 10 CHARACTERS );or(progn(setq new_layer (substr original_layer 1 (- (strlen original_layer) ??))) ; NEED TO ASSIGN VARIABLE TO MATCH THE NUMBER OF CHARACTERS TO REMOVE(if (not (tblsearch "layer" new_layer))(progn(entmake ;;;begin to make new layer(list'(0 . "LAYER")'(100 . "AcDbSymbolTableRecord")'(100 . "AcDbLayerTableRecord")(cons 2 new_layer) ;;; layer name(assoc 6 original_layer_info) ;;;re-use original linetype'(70 . 0) ;;;flags - use default flags(assoc 62 original_layer_info) ;;;re-use original color);list);entmake);progn);if(entmod (subst (cons 8 new_layer) (assoc 8 target_obj_atts) target_obj_atts)));progn);if);defun

assign a character where ? is shown so that it matches with the number of characters to remove based on the 3 lines above (see wcmatch lines).  At present, whatever number I replace that ?? with, it removes that number of characters from the layer that I selected (if it meets that WCMATCH criteria).  Another option which may be more difficult is to be able to have the routine look at the object layer and if it contains -N- or -D- or -NEW- or -DEMO- then to remove all the characters that follow these layer modifiers.  This way I can cleanly add another project modifier behind these modifers. 

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Possible To Pull Out Coordinates From Object When Object Snap Applied?

Aug 29, 2011

I have a rather simple 3rd party custom object... I tried to get its bounding box but the coordinates that come back don't seem to relate at all to the object.

What I'd like are the coordinates of two nodes the object contains...

Is it possible to apply the autocad cursor in some why with the node object snap to get their coordinates?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Block Name To VLA-object?

Feb 21, 2013

I need to get VLA-Object from block name.

here there is a code to get block name from VLA-Object:

(vlax-get-property obj (if (vlax-property-available-p obj 'EffectiveName) 'EffectiveName 'Name) )

 but I need the inverse of this code exactly:

blockname(as a string)==>VLA-object

(defun GetVLA_BName (BName).......

so, how can I do it?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Flatten 3d Object To 2d

Mar 15, 2013

I am trying to write a simple (or at least I thought it was) code to flatten a 3d object into a 2d shape.  For some reason after ACAD runs the lisp it recognizes the flatten command but it will not select all.  this is what I have:

(defun c:fl () (command "flatten" "all") ) 

I have even tried the pick first command, to select all then run the flatten command but that still doesn't work. 

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Accessing Data From An Object

Jun 19, 2013

How to access the information stored with an AcDbScale object using Visual Lisp.  I can convert the vla-object to an ename and then use association codes to extract the data, but surely there's an easier, more direct alternative.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Fade Object (block) In And Out

Jun 24, 2012

How to fade an object (block) in and out?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Mirror Object Automatically

Nov 10, 2011

I am looking for a lisp routine which will allow me to mirror an object that I pick automatically.  I don't want to have to pick the two points to set the mirror line.  I just want the point I pick on of the object I select to be the point of the mirror.  If that can't happen, I was wondering if the object could mirror at its insertion point (like if it were a block or a text.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Find Object Associated To A Field

Nov 1, 2011

We use multi-leader objects in our drawings. When the multi-leader and its value are to be replicated throughout the drawing, we create mleaders with fields that show the contents of the first mleader. That way we can update only the value in the first mleader and all of its children will update as well. It works nicely for us.

Here comes one snag. If one of us opens a drawing with which we are not intimately familiar, we don't know which mleader is the parent of which children. There might be fifty parents and four hundred children in a drawing so going through them by hand is a big productivity drain.

What I need to do is write a routine that will let the user select the mleader that includes the field and have the routine highlight and/or zoom to the parent object.

I thought I should be able to find that info in the dxf codes for the mleader, but I am either missing it or it's not there.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Object Using Entmake

Nov 12, 2013

I am creating a line using entmake, but I need the start and end point to be variable that was already defined  ex.

(entmake '((0 . "LINE")(8 . "FIELD") (10 . line_insert) (11 line_end)))

Command: !line_insert
(29.2813 20.5 0.0)

Command: !line_end
(29.2813 18.5 0.0)

The error I get is

; error: bad DXF group: (10 LINE_INSERT)

What do I do to make it recognize this variable?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Display Height Of 3D Object To 3 DPS

Jun 14, 2013

I have this lisp which will display the height of a 3D object to 2 dps. What I need is for 3dps to be displayed but I have no real understanding of LISP coidng so I can't work out where this is specified in the routine.

Why this LISP does not work when I try to use it in a drawing which has a Pointools POD file working (or previously had one) within it?

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Moving Object From Layout To Another Programmatically

Dec 14, 2011

how to do this programmatically and without modifying the handle of the object,i am trying to do it programmatically (entmod (cons 410 newname)(assoc 410 ... no luck.

(entmakex -ing will modify or create a new handle ctrl-X and then ctrl-V recreates a new handle too ...

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get A Block Count Without Opening DWG Object DBX

Jan 29, 2013

I need to write some code to count blocks inserted on the drawing....  I want to count also dynamic blocks... most of the time dynamic blocks are anonymous... so I'd need to check the Effective Name.

This line gets the blocks in the block table...

... but how do I get the blocks actually inserted in the dwg?

(setq blks (vla-get-blocks odoc))

Will a regular lisp expressions (like below) work with ObjectDBX... (drawing file not open)?

(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "`*U*"))))

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Merge Two Align Object Routines

Nov 23, 2011

I've gotten these two routines from different threads on here. One works with *text and blocks.  The second works with multileaders.

I'd like to merge the two so one command can work with a selection set of any of the above objects (assume selection set of mixed objects - some multileaders, some text, some blocks)
 
(defun c:at ( / ss ang *error*)(vl-load-com)(ErrorHandler '("cmdecho" "osmode"))(setvar "cmdecho" 0)(setvar "osmode" 576)(setqss (ssget '((0 . "*TEXT,INSERT")))ang (getangle "
Select two points along desired alignment:"))(mapcar'(lambda (x)(vla-put-rotation(vlax-ename->vla-object x)ang))(mapcar 'cadr (ssnamex ss)))(*error* nil))(defun c:test (/ ss ang i sset)(vl-load-com); Tharwat 17. 05. 2011 (if (and (setq ss (ssget ":L" '((0 . "MULTILEADER")))) (setq ang (getangle "
Specify Rotation Angle :"))) (repeat(setq i (sslength ss)) (setq sset (ssname ss (setq i (1- i)))) (vla-put-TextRotation (vlax-ename->vla-object sset) ang)) (princ)) (princ))
 
Or see C:AT and C:TEST in the attached file

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Load Particular Object Snaps?

Jun 20, 2011

A lot of the LISP routines we use turn off all snaps except the "nearest" snap when the routine is complete.

I draw with 6 out of the 10 snaps on (not the nearest).

LISP routine that loads specific object snaps?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Line From Origin To Object Centers

Jan 3, 2013

LISP routine which will draw lines from the center/insertion point of multiple objects to 0,0,0 ? 

View 9 Replies View Related







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