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
ADVERTISEMENT
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
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
Aug 20, 2012
We have a need to select a tangent line/polyline etc and then select two other points we would then like to have the program draw an arc through the two points and yet still be tangent to the initial line/polyline that we picked. We don't care what the radius is as we believe there is only one solution anyway. It would be wonderful if we could just use the Arc command and select start>Second Point> then just use the Tangent Osnap but I guess that is out of the question :-)
The only code that I have come across that even resembles this only allows for one point not two (STILL VERY HANDY AND VERY SLICK)
(vl-load-com)
(defun near_vertex_arr (obj / dxf_obj e_next obj_vlax pt_sel par pt_first pt_snd i bulge)
;bruno.valsecchi
[Code]....
How does everyone else hande this? By they way... I dont care what language it is written in :-)
View 7 Replies
View Related
Mar 12, 2012
I am trying to shorten my code by using the variable as the command name. Is that possible to do?
;; instead of this(cond ((eq USER_INPUT_ANSWER "blk-cdtree-01-06")(C:blk-cdtree-01-06)) ((eq USER_INPUT_ANSWER "blk-cdtree-01-08")(C:blk-cdtree-01-08)) ((eq USER_INPUT_ANSWER "blk-cdtree-01-10")(C:blk-cdtree-01-10)) ((eq USER_INPUT_ANSWER "blk-cdtree-01-12")(C:blk-cdtree-01-12)));; do something like this(C:blk-cdtree-(substr USER_INPUT_ANSWER 11))
View 8 Replies
View Related
Aug 1, 2013
Main question: I need the user to be able to type a command. Then use it or cancel it. Then i need them to type another lisp command. In the second command i need to know (have the string of) the previous command they typed in. How do i get that string?
What I have tried.
I have looked at "LASTPROMPT" though not extensively, and i believe it would just return "ineedhelp" if i tried that.
I have looked at "CMDNAMES" but that gives the command you're currently in.
And I have found one page on this forum titled: Command Line History Macro, but there was no answer on that post.
I could create a global variable for that string, but then I would have to put the set code in every function I create. Nope, will not.
Backstory:
There's a person that is going to make how-to videos on how to use some of my lisp routines.
Anyhow, I need the user to be able to type in "ineedhelp" and the lisp that runs must get the last command's string go to the shared drive and pull up the video file for that command.
I have made a lisp that opened a word file before, and if i could get the string of the previous command, i'm fairly certain that I can get the videos to work.
There will be approximately 60 lisp routine video's.
View 9 Replies
View Related
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
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
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
View Related
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
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
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
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
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
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
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
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
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
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
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
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
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
Nov 15, 2013
I was just looking through one of Lee Mac's tutorials and I'm curious about something.
Here's a link to the tutorial I'm talking about.
[URL]
What is the purpose of the asterisks in the following code (marked in RED):
(if (not *ans*) (setq *ans* "Alpha"))
(initget "Alpha Beta Gamma")
(setq *ans*
(cond
(
(getkword
(strcat "
[code]....
View 4 Replies
View Related
Apr 23, 2013
I am trying to change the current TARGET variable to 0,0,0. If the variable is not changed is causes problems with plotting. I have the VBA that will change the TARGET variable. VBA works no problems. I am wanting to replicate in LISP because I do not want to have to convert to .NET and do not want to make sure the user has the VBA loded on thier system. Here is what have so far.
;;;Get active viewport
(setq avp (vla-get-ActiveViewport (vla-get-ActiveDocument (vlax-get-acad-object))))
;;;Get current TARGET variable
(setq CTarget(vla-get-Target avp))
Here is the problem. Is changing or putting the vaiable.I have tried
(vla-put-Target avp (vlax-3D-point '(0.0 0.0 0.0)))
and
(vla-put-Target avp (vlax-make-variant (vlax-3D-point '(0.0 0.0 0.0))(vlax-variant-type CTarget)))
They either error out or nil with no change. I have even tried to locate it in the Dictionaries.
View 5 Replies
View Related
Nov 11, 2011
There is a command in autocad that will get a Bounded Volume from a closed polyline and a volume surface (command "AeccReportSurfBoundedVolume"). It reports the results to the screen. How to get the "Net Volume" results in to a variable using Lisp?
Maybe a lisp routine that gets information from the text screen. That would not be ideal but I could work with that.
View 2 Replies
View Related
Sep 17, 2013
I've created a list and want to subtract all the values within it from another variable, and assign it to a new variable. How do I do it?
Basically, I ask for ground level (assigned to variable G1), and then any number of depths beneath that (assign to list LVLLIST), and I want to return the value of the bottom point. So it's all the values in LVLLIST added together and subtracted from G1. And assign it to a new variable BASE.
For example,
G1 = 650.00
LVLLIST = (1.23 23.26 0.13 50.23)
(setq BASE (- G1 LVLLLIST))
View 2 Replies
View Related
Nov 28, 2008
How to write some code which could create variable names like var1, var2, var3, etc. I need to do this because I have a large number to create and the actual number is variable and unknown.
Instead of manually writing a large number of line like
(setq var1 value1)
(setq var2 value2) etc
I used to be able to put 1 line in a loop to create and assign a large number of variables. I remember that it involved the use of the set (not setq) and read functions.
View 9 Replies
View Related
Feb 28, 2012
Is there anyway to program variable names?
What I was thinking of was in a loop some times I need multiple sets of similar variables but am not sure how many sets I am going to need. I would like to be able to increment the variable names each time the loop runs.
View 2 Replies
View Related
Oct 10, 2008
A2008. Is there a setvar, setenv, registry entry etc. that can be used to change the scale of Multileaders with annotative off to have the same effect that DIMSCALE has on Q leaders? I want to have a single scale-independent Multileader style and modify it on the fly along with DIMSCALE and LTSCALE. I'd use Qleader but UCS's do odd things to text position and orientation.
View 4 Replies
View Related
Jul 9, 2013
I would like to use a string as a variable if this is possible. I've got:
new-pl-lay (as a variable that holds layer name "UGL_PL_NEW")
first-cable (as a string that holds "new-pl-lay")
I'd like set the current layer to "UGL_PL_NEW" by using the first-cable string.
Something like:
(command "_.layer" "m" (read first-cable) "")
View 8 Replies
View Related
Oct 20, 2011
how to write a lisp command, or function, that will save my newly created drawing with a file name is that is called up from a variable.
For example:
(setq filename variable)
(command "saveas" "r14" "filename")
and i would want the outcome to be: variable.dwg, rather than filename.dwg. I have tried numerous different ways of doing this with command prompt and cant seem to get anything to stick. Everything that works just creates a file named "filename.dwg", which is not what i want to do.
View 9 Replies
View Related