AutoCAD Visual LISP / AutoLISP :: Use User-input As Block Name?

Sep 5, 2012

I just need the userinput to be incorporated in the insert command but don't know how to segregate the block name from the block path..

;;;PROMPT USER FOR BLOCK NAME HERE
(setq userinBLKNAME (getstring "
Please type in the block name shown in the allrevblocks - ex: IFCC4:"))

;;;INSERT BLOCK BASED ON BLOCK NAME PROVIDED HERE
(command "-insert" "B:\CAD\REVBLOCKS\IFC\"USERINBLKNAME PAUSE "1" "" "")

View 3 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Append To User Input

May 7, 2012

I've been trying to append a user input by adding this text "ABC" to the front of it.  How can I do that?

(setq NUMX (getstring "
Please specify NUMBER:")); INPUT NUMBER 123 HERE
(SETQ NUMXX (append '(ABC) NUMX))

So that NUMXX now equals ABC123.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Pausing To Allow User Input?

Dec 14, 2013

I want to write a very simple AutoLISP program to scale selected objects by a factor of (1/25.4).  How to I get the program to pause and allow the user to select the base point?  I know that "~" will bring up a selection window, but what is the character that will allow point selection (in this context)?  While we're at it, what is the operator that would trigger a pause and allow user command line input? 

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Alert Box That Takes User Input?

Jul 30, 2012

Is there a way to have an alert box pop up at a certain point in the code which gives the user a chance to cancel the LISP program and not proceed any further?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Locate WDP File With Minimal User Input

Sep 23, 2013

I am trying to locate a .wdp file with minimal user input.  this is what I have so far

;All file saved in this folder

(setq filedir "I://PROJECTS//")

;User will put the following in, but there might be a small description after 915-01.  That is why I have a wildcard

(setq filename (strcat "915-01*"))

; string together everything

(setq nextlevel (strcat filedir "JOB " filename "*" "//ACAD"))

;; the final path should look something like this:

I://Projects// JOB 915-01(something here... could be anything or nothing)//ACAD//915-01(something else could be here as well).wdp

;set file extension

(setq fileext ".wdp")

; search files

(setq wdp_file (vl-directory-files nextlevel (strcat filename "*" fileext)))

I am confused on where and when I can use wildcards for searching directories.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Passing A List Of Points To Function Instead Of User Input

Sep 16, 2013

I have a list function that asks for the user to pick points when it is run. It looks something like this (foo arg1 arg2) When invoked it asks the user to pick points and press enter when done It.

Instead of getting the points from the user i want to pass it a list of pre-defined points. The code cannot be changed so I must use it as is.Is this possible, if so how can it be done?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Error - Extra Right Paren On Input

Jun 18, 2013

In my acaddoc.lsp I have it load an autoload.lsp file that contains many lisp routines (attached). I am getting the "extra right paren on input" error. It appears to error after the third line in the autoload file "san18"....I removed everything after the third line and no error, I put them back and it errors and only loads first three?

I am using Civil 3D 2014 and I have added all neccesary paths to the trusted locations.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Automated Drawing Using Input Data?

Jul 4, 2013

I would like to automate drawing process for certain data. Using some LISP codes User will be asked to provide some data and using that data an automatic drawing needed to be developed at Drawing editor of AutoCAD. For example;

Enter the width of Sheet: 50 mm
enter the length of Sheet: 200 mm
Enter the sheet thickness: 5mm
Enter type of feed: Automatic
Are there holes in Strip: Yes/No
Specify nu of holes: 5
Position of holes Centre: 5,5
Distance between the holes:  At an interval of 20mm each

I just need a LISP code for such program.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Getstring Input Integer Or Distance?

Feb 21, 2013

I would like to eliminate a mouse click in my program. I use getstring to allow the user to either enter in an integer or a distance used for labeling in a drawing, but I could eliminate the need for the user to then click an option that completes the label if I only knew how to determine if the entry is an integer (such as 5 or 15) or a distance (such as 24" or 36").

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Program For Cross Section By Manual Input

Jun 26, 2013

Is it possible to write a program for cross section by manual input of data like below. Objective is to draw a cross section with grid lines and labels of section data and datum value.

Program will ask for :

Datum value ?
Grid line spacing ?

Datas are :

Section Left

Chainage  5     Section value : 12.5
                10                            13.5
                 20                            5
                 23.7                         3

                and so on.....

Section Right

Chainage  5     Section value : 8
                10                    13.5
                20.5                  15
                25                      3

                30                      14

               and so on.....

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Invalid Or Incomplete DXF Input - Drawing Discarded

Jan 4, 2013

While opening a dxf file, i find the message:

 Syntax error or premature end of file on line 943.Invalid or incomplete DXF input -- drawing discarded.

I have a approx. 10000 dxf files. Is it possible to know which files are invalid without opening them?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Locking User Into Using Ortho?

Dec 17, 2012

Any way to permanently disable polar. Like if autocad were to automatically switch to ortho every 10 mins or something?

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: While Loop And User Defaults

Apr 25, 2012

I have a little LISP I have been working on that creates a text object as a "label" for 2D ductwork our company does. It makes a field for the mlinescale as the duct width, combines with user input for duct depth, and prompts user for location to place the text. The routine is functional...however, I would like to tweak two things that I cannot figure out.

First, I would like the command to continue until the user escapes, similar to the "multiple" command in AutoCAD. I have tried adding a while loop to the majority of the routine..which works until the user escapes...then my error handler undoes everything.

Second, when asking for user input, is it possible to ask for user input without a default the first time, but thereafter remember the input as a default?

Below is the code in question...not including error handler, etc. :

(if (= ducttemp nil)(setq ducttemp 12))
(initget 6)
(setq ductdepth (getint (strcat "
Enter duct depth in inches <" (itoa ducttemp) ">, or Esc to end: ")))
(if (= ductdepth nil) (setq ductdepth ducttemp) (setq ducttemp ductdepth))

[Code] .........

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Combine Two User Inputs

May 16, 2012

I'm trying to combine two user inputs and a constant with setq without spaces so I can use it in an AutoCAD command.

I haven't seen a string command that does this. It always has spaces in between the fetched valvues.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Set User OSnap Settings Transparently

Jul 16, 2013

I have a routine that sets user defined osnaps based on a text file.Here is what is an example of user stored osnap settings -

(setq User_Osnaps (list (list "Alan" "endp,midp,int") (list "John" "cen,ins")))

Here is routine I use to set user osnaps -

(defun CU ()
  (vl-cmdf "-OSNAP" (cdr (assoc (getvar "LOGINNAME") User_Osnaps)))
  (princ)
)

This works great so long as the user is not in the middle of another lisp routine.How can I change this to a transparent command that will work to set osnaps while running another lisp routine?I would like to store it in a toolbar button.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Pause To Allow User To Select Layout Tab

Sep 13, 2011

I need a command that will allow the user to select a layout tab.  I thought the following would work, but it just ends the LISP program:

(command "layout" "s" pause)

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: User Is Prompted To Select A Row Of Blocks?

Oct 25, 2011

I am looking for a way where a user is prompted to select a row of blocks and then that row is completely mirrored about the middle of the selection set - such that if the blocks are originally inserted, from left to right "A" "B" C"  then after mirroring, we want them t occupy (roughly) the same space in the drawing area as "C" "B" "A".

Then, immediately after mirroring that selection set in place, each individual block that makes up the selection set is mirrored about its insertion point along the x axis..... basically i need to mirror a selection set of a row of blocks so I change their order of occurrence and then mirror each individual block back again to the way it is meant to look.

Is this possible?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Pause For User To Activate A Viewport Before Continuing

Dec 4, 2013

I have situation where a block is inserted in paperspace before a leader is to be added into modelspace. I need it to work like the "CHSPACE" command - it pauses and asks the user to activate a viewport before continuing.

How that pause until viewport is active is done?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Determine Type Of Object That User Selected?

Mar 1, 2012

Is there a way to determine the type of ACAD object that the user selected? I need to retrieve the value from either a dimension or text. The info could be in either format so the lisp routine needs to determine what was selected so the correct vla-get command is used.

Once I determine what the object is I can use an if statement to retrieve the value.

;user selects the object
(setq dimobj (vlax-ename->vla-object(car(entsel))))
;If ACAD object is a dimension do this.
(setq dimvalue (vla-get-textoverride dimobj))
;If ACAD object is text do this.
(setq dimvalue (vla-get-textstring dimobj))

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Detect User Hitting ESC Key During SAVEAS Command

Nov 8, 2011

I'm putting together a simple lisp routine to issue bound, purged drawings.

I have code that will do the binding & purging but need handling the saving.

This is my approach :

(1) ask the user to save the drawing using this line (command "_saveas" "" "~")

(2) run a subroutine that binds xrefs etc (this works ok)

(3) run the QSAVE command

Trouble is, if the user cancels or hits escape during the SAVEAS command the subroutine & QSAVE will still run, overwriting the current drawing. How do I handle this scenario? Or should my appoach be different?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Loading Cuix From Bundle When User Is Not Administrator

Jun 5, 2013

We are using .cuix file which gives access to tools in custom .arx file in AutoCAD 2012/2013. We load the menu using the .bundle mechanism and the plug-in - using button from the menu. If the user is Administrator (or executes AutoCAD as Administrator)  the menu, toolbars and ribbons are loaded correctly and the user can load and unload the application (lisp function in .mnl file is used for that), but if the user is not an administrator either the menu, toolbars and ribbons are not correctly loaded or they are loaded, but the user can not load the application.

We have found that a probable cause for this behaviour is that AutoCAD tries to create/renew the .mnr file when first loading a .cuix file and since the user has no administrator rights this can't be done in the "C:Program FilesAutodeskApplicationPlugins" folder where the bundle is and AutoCAD creates the .mnr file in its own support folder ("C:Users<User>AppDataRoamingAutodeskAutoCAD 2012R18.2...Support") together with a copy of the .cuix file and changes the path for loading the .cuix file to this location. Since the .mnl file containing the function for loading/unloading is not copied with the .cuix file the application can not be loaded.

The user has to delete the created files under the support path of AutoCAD, unload the .cuix file and then reload it from the correct location to resolve the problem. Restarting AutoCAD leads to the same problem.

Is there a way to prevent this behavior other then running AutoCAD as administrator (that is not always an option)?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Removing Nested Block From Main Block?

Oct 3, 2013

I get an AutoCAD drawing from my conveyor manufacturer who have buried a block (tagname) in all of their conveyor blocks.

The only way to remove them is to manually use BEDIT and erase the tagname block.

Is there a way through Autolisp to search all blocks in a drawings and if the tagname block is part of the definition of the conveyor block, erase the tagname block or redefine the conveyor block without the tagname block.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Retrieving Block Name Of Anonymous Block

Mar 8, 2013

When dynamic blocks are inserted they're assigned an anonymous block name.  I'd like to be able to retrieve the name of the parent block after selecting the block on screen using AutoLisp.

Need a bit of code that handles this?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Block Insertion Routine Based On Block File Name

Apr 5, 2013

Create a routine that looks for a block based on a portion of that block name, using a specified path or search path. 

For example, block to search for is BLOCKABC123, so if someone inputs ABC or 123 as a block name, it will locate that block within that folder and inserts it into the drawing at a user specified location.

Ideally, if there is a check in that if it finds more than one match, then perhaps it flags or prompts you to choose 1, 2, or 3 option which block to use.  But I can live without this special function if it requires too much time to code.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Match Multiple Attribute Values From One Block To Another Block

Feb 12, 2012

I need to match few attribute values from one block to different block. I download a lisp file called; ca.lsp which can match the single attribute value. I modified it for more than one attribute value matching. It is ok but still wish to overcome two issues for batch prcess

1. picking up the blocks by selection

2. click the alternative block numbers of times to match the numbers of attribute values I needed.

How to modify this lisp I can run it by block name selections instead of picking selection which enable me to run batch process for numbers of drawing? That will be good...

Lisp & Demo file attached (Match attribute value, A, B & C to Attribute 1, 2 & 3).

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Point At List Block And Dynamic Block

Apr 18, 2013

I am learning autolips and i found  a problem that i can´t solved.
 
(vl-load-com)(defun c:pmb ( / ss ent pt )(prompt "
selec block : ")(setq ss (ssget '((0 . "INSERT")))) (setq ent (ssname ss 0)), (setq pt (cdr (assoc 10 (entget ent)))) (command "point" pt))
 wich this code you select one block and insert one point at insert point´s block.

which this other code yo select all block and insert all  point.... but in one block
 
(vl-load-com) (defun c:pmb11 ( / sele cod bloque nbloque lista pt ) (prompt "
block: ") (setq sele (ssget ( List'(0 . "INSERT"))) Cod 0 )cod (1+ cod) (repeat (sslength sele) (setq bloque (ssname sele cod)) (setq pt (cdr (assoc 10 ( entget bloque)))) (command "punto" pt) );repeat ) 

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert A Block / Explode And Rename Nested Block With Suffix

Nov 30, 2012

I have a block that i want to insert several times and revised each one to be different to do this i would have to insert it and rename the blocks that come in and then reinsert i would like to insert and have a lisp explode the main block and rename the other 2 blocks with a suffix at the end depending on how many times its in the drawing... can this even be done? My original block name that will be first inserted is "BENT PULLEY NOTES" it needs to explode after i drop it in and then there are 2 blocks within that called "Bent Pulley" and "Bent Pulley DYN" that i was hoping to keep the names but add a number at the end depending on how many are in the drawing already...

here is a lisp that i have found... it would work if i didn't have nested blocks and only wanted the one block to be insert and not explode...

(defun c:Test (/ e i name Bname )
(setq e nil)
(command "_.-insert" "Drawing1.dwg" pause "" "" "")
(if (setq e (entlast))

[Code] .......

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Block To Annotative Block?

Dec 23, 2013

I have a dwg with 40 blocks that have a non-annotative property. I can go through 1 by 1 and change the property to annotative and redefine the block. Is it possible to automate this? I have done some google searches but have not found anything I am able to cut and paste or put together to get it to work.

Civil 3D 2012 SP4.0 Windows 7 Enterprise 64-bit
C3D 2014 SP1
Dell M6600, Core i7 @ 2.3GHz, 16 GB ram
Dell T3500 workstation, too much ram to post

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Last User Entered Command Needed As String Variable

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

AutoCAD Visual LISP / AutoLISP :: User Select In Button Marco Not Working In 2014?

Jul 29, 2013

I have various Button macros with the user input select in them, but in 2014 they dont seem to be working anymore.

they worked in 2013.

It just says invalid selection.

example

^C^CSelect;change;p;lt;phantom;;

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Set Z Axis Orientation To Two User Points To Draw And Extrude Circle

Feb 10, 2012

I'm trying to change a routine i just wrote that draws 3d pipes. I wanted to make it so that when a user selects the beginning point and ending point of the pipe, the LISP changes the ucs to that vector, draws the circle at the beginning point and extrudes it to the second point.

It actually works great except when the ucs changes, so do my user points because of teh origin change. Is there a better way I might get this to do what I wnat it to?
 
(setq ip (getpoint "
Pick First Point:"))(setq ep (getpoint "
Pick Second Point:"))(command ".ucs" "za" ip ep)(setvar "osmode" 0)(command ".circle" ip "d" od)(command ".extrude" (entlast) "" (distance ip ep))(command ".ucs" "w")(setvar "osmode" oldsnap))

View 2 Replies View Related







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