AutoCAD Visual LISP / AutoLISP :: How To Override Existing Commands

Mar 19, 2012

Any way to override existing AutoCAD commands.

Lets try this.  When a user types "line" at the command prompt, or hits the "line" button on the toolbar, or chooses "line" from the draw pulldown menu, is there any way I can re-write what line means and draw a circle?  (Extreme example)

There are just some commands that I'd like to have a variable set in the background, depending on what the command is.  So I'm thinking if I could re-write the "line" command, instead of trying to convince everyone to use and remember a custom command, it would be much more efficient.  There are lisp files already loaded in their start-up suite.  Not sure if that works.

View 4 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Line Length To Dimension Override?

Sep 23, 2011

My goal is to be able to select a line and a dimension and then have the line's length appear as the text override for the dimension.  I have the code to substitute the variable "dist" for the dimension text:

(setq dimselected (entsel "
Select Dimension:"))
(setq newlength dist)
(command "dimedit" "n" newlength dimselected "")

but am having problems extracting the line's length to the variable and setting setting it equal to the variable.  To make things more interesting, the value needs to be in inches with fractional inches accurate to 1/16".

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Double Click Dimension For DIMRND Override

Feb 13, 2013

I want to doubleclick on a dimension and have the DIMRND override appear

I can't figure out what command I need to customize the doublclick CUI

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Stacked Fractions For Dimension Override

Sep 30, 2011

I wrote the code below (allow the user to pick points in different viewports and then override an existing dimension's text with the difference in X values.  The (hopefully) last issue is that the fractions should be vertically stacked and at 100% text size. 

(defun c2text ()
(command "mspace")  
(setq p1 (getpoint "Select left point "))

[Code]....

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Can't Pickfirst For Some Commands

Nov 7, 2012

I've been testing out a few lisps just now, trying to get to the one I want.Somewhere along the line something has changed a setting in the program and I don't know what or how to get it back.

Similar to the PICKFIRST sysvar, but not that.  (PICKFIRST is set to 1).

When I select objects and issue a command like move or copy, all is fine.

When I select objects and hit Ctrl+C, the selection set is ignored and I am prompted to select objects.

When I double click on text to edit, the ddedit or mtedit command is issued at commandline, and I am prompted to select an object.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Autosave After 20 Commands Except Zoom

Dec 18, 2012

I just started learning LISP yesterday, as our office needs an autosave LISP. People have requested it and I have to do it...

How I wanted to do it:

The LISP will be loaded on every PC of every person with AutoCAD.

On startup "command_count" will be on 0

When using a command like plinie this happens: (+ 1 command_count)

Commands like zoom, undo etc will be ignored

When command_count reaches 20 it executes the qsave command

If using the qsave command it resets the command_count to 0

Thats my not working LISP atm:

(defun c:losave ()(setq command_count 0)(+ 1 command_count)(if command_count 10 "_qsave"));(if command "_qsave" setq 0);(if command "_zoom" (- 2 command_count));(if command "_undo" (- 2 command_count));(if command "_qsave" (* 0 command_count));(setq command_count (+ 1 command_count))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Combined Commands In One Macro Button?

Jun 28, 2012

I am trying to create a short cut button with a macor code.

I want it to set up a new orgin and set a base point in xrefs i am creating

The commands i want to combined are the follwoing

UCS enter
3P enter
BASE enter

The macro i am using is the following

^c^c_ucs 3p \_base

but it wont run the base command after it finishes the 3P command

This is whats show up in my commands bar

Command: _ucs
Current ucs name:  *WORLD*
Specify origin of UCS or [Face/NAmed/OBject/Previous/View/World/X/Y/Z/ZAxis]
<World>: 3p

[Code]....

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Make Different Start Points For Different Commands

Jun 29, 2013

My first lisp, so bring it hard on me I want to be an expert in autolisp .

My lisp is meant to do the following:

draw a rectangle with ”0” fillet. It can be done either via rectangle command, or pline command. The attached lisp has the variant with the pline-case.

The, I need to draw inside a smaller rectangle, with a fillet value, that is promoted and indicated by the user. The smaller rectangle must be centered inside the bigger one. I thought it was a good idea, to take one insertion-point for the bigger rectangle.

and to calculate a 2-nd insertion-point for the smaller rectangle, via "polar" function.

What I get:

the 2-nd insertion point is put the same as the 1-st one.

I wish to draw the bigger rectangle with one layer "example: Layer 1", and the smaller rectangle with another layer "example: Layer 2".

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Customise Snap Commands To F Keys

Feb 10, 2009

Im using AutoCAD 09 for the first time and need to find out how to customise my snap commands to F keys. I've been using 2004 and it was really easy. 09 seems to not allow it?

for example i set F4 to end point and F5 to intersection point etc. it saves using O snap or a tab. just L, F4 and its done (for example)

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Use Ordinary Commands In Blocks Without Block Edits

Sep 12, 2013

i like to work with block system in my project , but i dont like to use block editor or refedit for every action inside my block  ...i found some lisps for  add or remove objects from blocks but not enough for dont use to block editors ,  i need to lisp for use ordinary command for blocks without get them inside if ther is possibility ...

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Commands Not Finishing After Calling Script Within Function

Nov 15, 2013

I have a simple lisp function to add a scale axis to a drawing by calling a script, renamed the drawing by appending "withScale" to the file name, and then closing the file. I placed a call to the function in the acad.lsp file in the startup suite. The idea was to batch process all files by simply opening them. Upon open the startup acad.lsp file runs, which calls my lisp function, which in turn calls the scale script. It should then execute the renaming, saving, and closing commands. The problem is that it is calling the script fine and renaming the file, but it does not save the changes before closing. Here is the lisp function
 
(defun saveScale(); (command "-purge" "all" "" "n")(if (findfile "C:/Users/Russell/Desktop/TreeFiles/Automation/Scale&Key.scr")(command "_script" "C:/Users/Russell/Desktop/TreeFiles/Automation/Scale&Key.scr")); end if (command "_.zoom" "e") (command "_saveas" "2013" (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "withScale.dwg")) (command "close") ) (saveScale)
 
Apparently you cannont run any lisp commands after calling a script, however the renaming still follows through.

I've attached the script file as well. (I couldn't attach .scr format so you may need to rename it).

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Multiple DWG Files With Basic Set Of Commands In Script File

Jul 19, 2013

I can run the ACC fine on multiple DWG files with a basic set of commands in the script file.  But, when I try to load an AutoLISP/Visual LISP file and run it from inside the script file, it doesn't work. How to run a LISP file using the ACC?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Partial Cuix - Adding Commands To Shortcut Menus

Oct 17, 2013

I'm able to add custom panels/buttons into the Ribbons, by cloning the existing ribbon (from acade.cuix) into my partial cuix. However.. I'm not able to add more commands to the shortcut menus, using the same technique.

Is it possible to add custom commands to existing shortcut menus using a partial cuix?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Use Existing Arc As Fillet Rad

Mar 21, 2007

I have this routine for using a selected arcs rad value as a new fillet rad. If you like, a "match fillet" routine:

;Fillet Copy
;Copies the Radius of an Existing Fillet or Arc;
(defun C:filletcopy ()
(setvar "cmdecho" 0)
(setq c1 (entsel "
Select Fillet to Copy:"))
(setq c1 (entget (car c1)))
(setq rad (cdr(assoc 40 c1)))
(setvar "filletrad" rad)
(princ "
Select Lines:")
(command ".fillet" pause pause)
)

I use the routine loads but could modify so it would pick up the value of a filleted polyline? As it stands it can only select an individual arc. I would like the routine to be able to pick individual arcs and/or filleted polylines, without exploding first, if possible....

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Redefine Existing Block

Jan 29, 2012

I am using the following function to create a block:

(defun crea-blocco (ip blockname gruppoogg / blkobj sArray c r vla-objects doc) (setq c -1) (repeat (sslength gruppoogg) (setq r (cons (ssname gruppoogg (setq c (1+ c))) r)) ) (setq r (reverse r)) (setq vla-objects (mapcar 'vlax-ename->vla-object r)) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq blkobj (vla-add (vla-get-blocks doc) (vlax-3d-point ip) blockname)) (setq sArray (vlax-safearray-fill (vlax-make-safearray vlax-vbObject (cons 0 (1- (length vla-objects)))) vla-objects)) (vla-copyobjects doc sArray blkobj) blkobj)
 
But if I start this function two times with the same block name, I get a block with the selected objects added to the existing block.

How can I redefine an existing block with vlisp?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Modify Existing Selection Set?

Sep 5, 2012

I need the same funcionality as in code below, but without using "command".

The main idea is alowed user to modify Existing Selection Set.

 (defun gt:ss->lst (a:ss / i lst ) ;_ / (setq i 0) (if a:ss (progn (repeat (sslength a:ss) (setq lst (cons (ssname a:ss i) lst) i (1+ i) ) ;_ setq ) ;_ repeat (reverse lst) ) ;_ progn ) ;_ if) ;_ defun gt:ss->lst(defun gt:ss_modify (a:en-lst / ) ;_ / ;;create Selection set (setq ss2 (ssadd)) (foreach f:en a:en-lst (ssadd f:en ss2) ) ;_ foreach ;;Run command and fill with initial content (command "_select" ss2) ;;Alow the user to modify the contents (while (/= (getvar "cmdnames") "") (command pause) ) ;_ while ;;get back the list of enames from modified selection set (setq ss3 (ssget "_P")) (setq ss3-lst (gt:ss->lst ss3))) ;_ defun gt:ss_modify(defun tst:gt:ss_modify ( / ) ;_ / (gt:ss_modify (gt:ss->lst (ssget)))) ;_ defum tst:gt:ss_modify

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Search For Existing MLeader With Attribute Value

May 21, 2013

I'm working out a LISP for searching my entire drawing for a MLeader with a given value and then do something if it is found.

Currently, my code dies with 

; error: Automation Error. Description was not provided.

I do not know what is going wrong & I don't know what must be done next.
 
(DEFUN ML-SRCHSTR (TXT LBL / SS n_txt_LBL ENT P1 P2) ;|(ML-SRCHSTR TXT)|; (IF (SSGET "x" '((0 . "MULTILEADER"))) (PROGN (SETQ ss (VLA-GET-ACTIVESELECTIONSET (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))) (VLAX-FORent ss(IF (VL-STRING-SEARCH txt (STRCASE (VLA-GET-TEXTSTRING ent))) (PROGN (VLA-CLEAR ss) (INITGET 1 "Yes No") (SETQ n_txt_LBL (STRCAT "
=>> " LBL " Label EXISTS! Add another " txt "? ") y_n (GETKWORD (strcat n_txt_LBL " [Yes/No]: ")) ) (IF(= y_n "Yes") (PROGN (ppa-L-

[Code]...

My MLeader has a _TagBox & it is the attribute of the _TagBox that I am trying to check/compare the "txt" value.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Attach Leader To Existing Block

Oct 24, 2013

Is there a way to attached an already exisiting placed block to a leader. If so, is there a way to do it to all the existing blocks, that are of the same block definintion, at once?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Serial Letters And Numbers From Existing Ones

Mar 2, 2013

Lisp file to get serial letters and numbers from existing ones,

I got a lisp file (attached) from experts in the form which does generate serial letters and numbers from existing ones.

The issue with this lisp file is that it doesn’t give the opportunity to choose the direction of numbering (top to bottom/bottom to top/left to right/right to left) as shown in the screenshot below

How this lisp can be developed to give the user the chance to choose the direction of numbering?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Modify The Existing Parametric Parameters?

May 2, 2013

Is there a way to modify the existing Parametric Parameters that are in the Parameters Manager using LISP?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Start Command On Existing Selection Set?

Jan 29, 2012

I'd like to pass and existing set of selection to a command like laylck, which asks for selections after beginning the command. 

It must be possible to do this. Some CUI setup, lisp routine?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Adding Variable To Existing File

Oct 4, 2012

I have attached 2 lisp files. datblkx5 makes a block of selection, inserts the block with a 5x distortion, explodes it, and corrects the text for width factor and text height. This one works fine.

I wanted to add the feature of scaling my selection with a user input value. This is the lisp datblkxxx. This one doesn't work. (that is it doesn't correct the text for width factor). I can't figure it out.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Mirror MTEXT Existing In Drawing

Aug 2, 2012

i have a situation that i need to mirror a lot of MTEXT exisiting in my drawing with following needs ( as attached CAD file) :

- MIRRTEXT = 1

- original text retain not deleted.

- mirrored texts become on another layer with another color.

- mirrored texts exactly become over the original text.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: CANNOSCALE Value Needs To Match Existing Named Scale

Jan 18, 2012

The crux of the matter is that the CANNOSCALE value needs to match an existing named scale.  This lisp is part of a bigger lisp and I need to pass a variable into it.  Here's what I have:

(setvar "CANNOSCALE" (strcat "1" = " (rtos variable 2 0) "'"))

But I get this error when I try to run it.

; error: bad argument type: numberp: nil

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Move Existing Objects To Snap Grid?

Dec 22, 2012

I have a slightly unusual query that I can't seem to find a solution for elsewhere. I have an existing OS plan that is 'off grid', and would like to adjust the vertices at the ends of all the existing lines and polylines so that they all sit on a grid point, ie round all vertices to the nearest whole number. Is there a quick command or script that does this?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Existing Text To Keyboard Entry Text

Jun 21, 2012

I have two attributes "REVN" and "REVD" in a block "ATT" that I would like to change (globally preferably) to the following.

(1) Existing text to keyboard entry text.

(2) Colour from existing to 10

I am a bit lost in the (command "-attdef" .......)

(defun c:atc ()
(setq rev (getstring "Please enter review"))
 (setq dat (getstring "please enter date"))
 (command "-attdef" .."ATT".."REVN"....."c" "10")..)
 (command "-attdef" .."ATT".."REVD"....."c" "10")..)

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Change All Objects On Layer 0 To Existing Layer PC Module

May 31, 2012

I'd like to have/write a lisp to change all objects on layer "0" to layer "PC - Module"

If possible also;

save the document close the document open next in directory run layer changer program again.

View 8 Replies View Related

AutoCAD .NET :: Override Default Commands

Apr 4, 2012

I'm trying to do something like this:

[Autodesk.AutoCAD.Runtime.CommandMethod("REFEDIT", Autodesk.AutoCAD.Runtime.CommandFlags.UsePickSet)]
public void RefEdit() {
Document doc = AcadApp.DocumentManager.MdiActiveDocument;

[Code] ......

I haven't undefined the default command, my definition of REFEDIT executes anyway. I wanna be able to run the default command from my definition.

doc.SendStringToExecute(".REFEDIT ", true, false, false); will loop forever.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Continuous Dimension Lisp That Alternate Its Position

Jul 12, 2012

Is there a lisp that will allow me to do a continuous dimension, but will alternate the dimension position from low, high, low and high?  If there is no lisp already created, how to create one? 

See Continuous dimension attachment for example.

I work at a glass and glazing company and this is how we dimension mullion width and DLO. See typical window dimensioning attachment for window elevation with dimensions.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add String To Each Item In List Using Lisp

Nov 14, 2013

I have a list ("temp.dwg" "temp2.dwg") and would like to add the string "insert text here" into each item in the list resulting in ("insert text heretemp.dwg" "insert textheretemp2.dwg").  how would i go about doing that using LISP?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Opening Drawings With Default Visual Style Set To 2D Wireframe

Oct 7, 2013

Is there a way to programatically set a visual style before a drawing actually opens?

We have some huge models and people seem to forget to change their visual styles back to 2D wireframe before saving and exiting drawings.  Some models will crash on some workstations when trying to open in a rendered mode.

I found a lisp with a function that looked to set viewport visual styles.  But it does not seem to be supported anymore. --> (vla-put-VisualStyle vport 1)

View 9 Replies View Related







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