AutoCAD Visual LISP / AutoLISP :: Undo Option Like In The Line Command

Dec 11, 2012

in this command how would you put the Undo option on there erase the last line and if you want to keep eraseing the lines

(defun c:gls ();keeps drawing guide lines at any angle
(setq an (getangle "
Pick an Angle:"))
(foreach pt '(a)
(while (set pt (getpoint "

[Code] .....

View 9 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Pick A Command Line Option In LSP

Nov 18, 2013

I like that Autodesk now allows us to just pick a command's option from the command line instead of typing a letter in the option. For example, when drawing a rectangle we're prompted to "Specify first corner point or [Chamfer Elecation Fillet Thickness Width]" and if we wanted to draw fillets on the rectangle we can simply PICK that option from the prompt in the command line OR enter an "F" and return.

Is there a way we can use this functionality in our custom programs?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: C Copy Command Has No Mode Option

Dec 19, 2013

I'm trying to set my default for the 'c' copy command to be multiple in AutoCAD 2014. I set 'c' under aliasedit to COPY, but when I use the command 'c' it brings up [Displacement Multiple] as options but no mOde. If I use the command 'co' it brings up [Displacement mOde]. How do I set my 'c' copy command to default to multiple?

View 7 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 :: 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 :: Command Line Variable

Feb 7, 2013

Somehow, I manage to turn of one variable that display errors on command line.

For example:

(seq a 6)

suppose to return, on command line, something like:

error no function definition: SEQ

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Passing Variables To Command Line?

Aug 14, 2012

Writing a routine that stores a file name as a string in variable FILE.I check the variable and it returns a nice quoted string: "filename-123.dwg"

I would like AutoCAD to open the file w/out user input.With FILEDIA set to 0, I've tried passing the variable to the command line:

(command "open" FILE)

or in a script as:

open

(FILE)
...

or,

open

!FILE
...

I get the same error. The string dumps to the command line and I get 'Unknown command "DWG" .'

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Pass Command Line Variable

Mar 21, 2012

I have this small lisp routine:

(defun c:1p nil
(command "_.-plot" "yes" "" "controls 11x17" "Ledger (11 x 17)" "inches" "LANDSCAPE" "NO" "view" "01" "FIT" "CENTER" "YES" "newpap2.ctb" "YES" "As" "NO" "NO" "yes" )
(princ)
)

I want to use it to plot different views which I will append to the command when it is called from within AutoCAD.This code will, of course, print view one.Currently my worst case is 25 views and, for that situation, I have simply repeated this code 25 times with a different function name an view number for each view. Eventually I would like to make a dialog box that would allow me to select with checkboxes (toggles) the views to print and with a button to print all.

For example, if I wanted to plot view 25, after I had loaded this lisp routine I would enter, on the command line in AutoCAD, the function name ("pp" perhaps?) followed by some variable (in this case 25, but could be any view name. ie. 01, elev, detail) and the view name would be inserted at the appropriate place.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: 2013 Command Line Output?

Apr 15, 2013

I have an issue with 2013 that I loose command line output; as in no muttering or cmdecho but I do not have anything set to that way. My cmdecho is set to 1, and nomutt is set to 0.

If I opent textscr then I can see the out put, but nothing on the command line.

I have never seen this before but it just started withing the last week or so and it makes debugging a real difficult.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Select All Layers Using Command Line

Nov 23, 2011

How I can select all layers using the command line?

I am going to write a piece of lisp which will reset all the lineweights for all layers to default and have started by doing it manually on the command line to see what I need to automate.

To start with I choose -layer then LW  then type default and it is here I have a problem.  It asks enter name list of layers for lineweight default  which is where I need to choose all.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Values Not Appearing In Command Line

Jul 23, 2013

I cannot determine what triggers this but the command line has stopped returning values from lisp expressions.

eg.  If I type (setq fred "Hello") I would expect to see "Hello" returned. I am getting nothing.  Similarly if I type !fred I get nothing.  If I restart AutoCAD the problem goes away.  The after some time it happens again. Is there a toggle or switch or system variable that I'm not aware of?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Cube Unknown But Works From Command Line

Sep 13, 2013

I'm running AutoCAD 2012 (base version, but part of Mechanical install). Part of my .mnl file is set to run (command "cube" "off"). On one machine (Windows 7), it works fine. I'm temporarily on my laptop (Windows 8), & that portion no longer works.

If I type cube in the command line, it works fine. However, if I type (command "cube"), it says unknown command "CUBE".

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Make Ctrl-V Always Paste To Command Line

Dec 17, 2012

I rarely paste entities using ctrl-v, I use the WTIT.lsp commands instead, or edit pulldown to paste entities.

I want a CTRL-V to paste to command line, always, no matter what.

I tried killing the keyboard shortcuts through the CUI, but that just stopped ctrl-v from doing anything when I was not on command line.

[URL] ....

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Printing Dotted Pairs To Command Line?

Oct 2, 2013

I have a list of dotted pairs and some of the entries are paired with a deeper list others contain mostly string data. the issue is that I need to print the data to the command line with a newline to seperate them. So I want the output to look like:

;from(customer (city . "Mesa")(zip . "85213")(project (scope (demo . "some description")(construction . "some description")) (cost (subtotal . "some subtotal") (total . "some total"))));tocity Mesazip 85213demo some descriptionconstruction some descriptionsubtotal some subtotaltotal some total

 I can print the entire list easily with:

(FOREACH IDX (CDR (VLAX-LDATA-GET "JobData" "LIST")) (PRINC "
") (PRINC IDX) (PRINC "
"))

 But, the issue is that when the data is a list it print it out to a single line making it very difficult to read. I tried adding another FOREACH into the loop that I had hoped would iterate through the deeper list and print those lines out in a simular fashion but I only get an "error: bad argument type: consp " and it displays the first element of my list.

I tried to evaluate the IDX and check the type, so that if it is a list then it triggers the deeper FOREACH but it seems I did it wrongly.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Print Last Line Of Command History To A File

Mar 26, 2012

I've been killing myself with trying to get the following (acet-getvar '("BNS_EDITTIME_TOTAL")) in standard time format

rather than julian and then printing it to a file.  I never found a way.  So I'm figuring the next best thing is to just run the edittime command and then set a custom variable to report the last line of the command history.  Then I can open a file and print it to the file.  But alas my skills are lacking. 

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Up-to-date Offset Command - Line Prompts

Jun 7, 2012

I posted a version of the Offset command that lets you Undo individual Offsets and change the offset distance/Through option, without getting out of the command, at Cadalyst CAD Tips: URL....

It's an upgraded version of an earlier concept by Gopal Ramesh.  It's been downloaded almost three times every day since it went up, so I guess people expect it will be useful.

But the website's description includes: "this routine does not provide access to the Layer or Erase options of the built-in Offset command."  The reason for that is that I'm working back in 2004, so those options are not present for me to emulate.  [The Undo option in the routine is one that was added in some later version, but is a very useful enhancement for people using older versions, like me.]

I do also have an Offset-to-any-Layer [not just the source's or the current Layer] routine posted there: URL....

And I have a simple little routine to Offset something and Erase the source object.  So I think I have all the "pieces" to include those options that newer versions have, but that I don't.  I would like to combine the functionalities into the Offset-with-running-options routine.  That way, if people want to use it to redefine the Offset command as I have done, in order to get the while-running distance change option, those working in newer versions won't be losing the Erase and Layer options in the process, and those in older versions will be gaining yet more options.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Put Default Text On Command Line For Getstring

Jun 6, 2012

I am trying to get a default value (from global variable) put as the default for getstring command. Problem is I want it as if I had typed it into the getstring command so I can modify it if required. It is for entering filenames which only change slightly ie 1129E09LS1 ...LS2 ...XS1 etc.

Current
(setq BlkName (getstring "
Enter Civil Cad File to Import: "))
For defaults that I don't want to change I usually use this format:
(or BlkName (setq BlkName (getstring "
Enter Civil Cad File to Import: ")))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Flip Variable / Command Line Won't Recognize After It Loads

Nov 14, 2012

I'm trying to make an autolisp that "flips" a third party variable. No luck, command line won't recognize after it loads. I've made similar variable flips that work ??

(defun c:wp (/ wp)
  (setq wp (getvar "kti_archt_wallpoche"))
  (if (= kti_archt_wallpoche 0)(setvar "kti_archt_wallpoche" 1)
  (if (= kti_archt_wallpoche 1)(setvar "kti_archt_wallpoche" 0)

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Accessing Structural Member Via Command Line And Material Addition

Dec 19, 2011

I'm writing some code to create various structural members, but I also need to add the texture map. Since it is doing the creation via VL, I need a way to add a material without that darn dialog box. Can material be add to a member programaticlly?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Using Macro Parameter Contains Space (changing Layer Color From Command Line)

Sep 19, 2013

I'd like to change a layer's color from command line because of a user icon. I figured out from previous topics that I should use macro similar to this: ^C^C_filedia;0;-la;s;Verdeckt (ISO);c;1;l;dashed;;_filedia;1;re;

(I want to use this macro to change layer's linetype, too, but that's not the point)

The only problem with this macro: layer's name contains a space therefore Autocad tries to recognize Verdeckt as a command (and macro interrupts there) instead of setting Verdeckt (ISO) as the current layer. I've tried using different quote marks, none of them worked (' and " and <>). I hope there's a method for entering a parameter that contains space.

Software: Inventor Series 2011 SP1 x64
OS: Vista Business x64
CPU: E6400
RAM: 2*2Gb GeIL
VGA: Quadro FX 550

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Proper Structure For Using Cmdecho And Undo G Together?

Dec 5, 2011

I like to suppress command echos in my routines, and I also like to bracket them with (command "undo" "g") at the start and (command "undo" "e") at the end.But if they have this structure:

(defun C:XXX ()
  (command "undo" "g")
  (setvar "cmdecho" 0)
  (setvar "cmdecho" 1)
  (command "undo" "e")
  (princ))

The first command "undo" regurgitates junk on the command line that I don't like to see.On the other hand, if I do this:

(defun C:XXX ()
  (setvar "cmdecho" 0)
  (command "undo" "g")
  (command "undo" "e")
  (setvar "cmdecho" 1)
  (princ))

The command line stays clean, but if I Undo after the command, "cmdecho" stays set at 0.

View 7 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 :: No Save Option

Apr 26, 2012

I am new autolisp user (i use autocad civil 3D 2012), i try to coding there but it doesn't have "save" option. How to save the file i've made?

View 1 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 :: Create Two Line MLEADER - Only Get One Line Of Text

Jul 18, 2012

I'm trying to write a lisp routine to create a two line MLEADER but i can only get one line of text. Creating the MLEADER manually from the command line i just have to hit enter after the first line of text to add a second line. How would i do this in a lisp routine?

View 2 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







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