Search the Community
Showing results for tags 'autolisp'.
-
CAD Lisp code poly line vertex coords to txt file
vaidua posted a topic in AutoLISP, Visual LISP & DCL
Hello, I'm using Lee Mac cad lisp program "PolyInfo V 1.3." for exporting polylines vertex coordinates. But for full work joy I need some modifications. URL for program: http://www.lee-mac.com/polyinfo.html URL for code: http://www.lee-mac.com/lisp/html/PolyInfoV1-3.html As you saw the program exports a lot of information about the polyline. So i want to modify the code that will export just polyline start vertex points x and y coords in two columns ( my cad version information exports to txt file ). The result should look like this: ________________________________ Polyline starts points x 649542.45 649542.35 649542.28 Polyline starts points y 495232.54 495232.23 495232.41 ________________________________ Can someone help to figure out which part of code I must to modify to get the result i want? Please. -
I have been experimenting with generating variables through code rather than defining them manually. The problem is that when the program creates them, they are defined as global variables. Is there a way to generate them as local variables instead? Below is the sample code that I wrote for testing it. ;ListToVariables creates variables named testvar0, testvar1, testvar2, etc. ;Each newly created variable contains the contents of the correlated slot from testlist. (defun c:test ( / testlist ) (setq testlist (list "aaa" "bbb" "ccc" "ddd" "eee")) (ListToVariables testlist) ) (defun ListToVariables ( listname / i ) (setq i 0) (repeat (length listname) (set (read (strcat "testvar" (rtos i 2 0))) (nth i listname)) (setq i (1+ i)) ) (princ) )
-
What is the way to add already highlighted objects to a selection set?
aawilds posted a topic in AutoLISP, Visual LISP & DCL
What is the way to add already highlighted objects to a selection set? I feel like I have seen the answer before but I cant remember what I searched to find it. Like how you can select object before you use the move command and autocad will move the objects that were already selected. I am looking to use the TSPACEINVADERS command and have the selected text then have a red circle put around them. Thank you for any help in advance. -
Is there a quick and practical way to get X & Y values on a polyline other than by way of "LIST". because I need the X & Y value just like the 2nd image. Thank you Master. img 1 : https://drive.google.com/open?id=0B1KbDu2x_byvU2F6NlpvNWJrU0k img 2 : https://drive.google.com/open?id=0B1KbDu2x_byvVE9qdmpBLWcxWHM
- 11 replies
-
- lisp files
- lisp
-
(and 3 more)
Tagged with:
-
I have a bit a head scratcher. I want a lisp that when run I will be able to select the whole drawing and all the mleaders will automatically justify to the side that the leader and arrow is on. Occasionally our leaders get move and it is time consuming to change them individually. Any help would be greatly appreciated.
-
I have the code below to place a block on a point. Then array that block based on information given by the user. Then move all of the blocks so that the insertion point is the top and center of all the blocks. It works fine sometimes but about half the time it it skips the first move command. Could someone tell me what I am missing? (DEFUN C:COMEDARRAY ( / OLDL NOR NOC CEB CEP ) (SETQ OLDL (GETVAR "CLAYER")) (COMMAND "_LAYER" "SET" "ELEC-CE" "") (SETQ NOR (GETINT "\nENTER NUMBER OF COMED ROWS: ")) (SETQ NOC (GETINT "\nENTER NUMBER OF COMED COLUMNS: ")) (setq CEP1 (getpoint "\nPICK INSERT POINT FOR BLOCK: ")) (COMMAND "_INSERT" "S:\\LightSett\\LISP FILES\\LISP USED BLOCKS\\COMED PROFILE.DWG" CEP1 "" "" "") (SETQ CEB (ENTLAST)) (COMMAND "_ARRAY" CEB "" "R" NOR NOC 0.6667 0.3333) (SETQ CEP (SSGET '((0 . "INSERT")))) (COMMAND "_MOVE" CEP "" CEP1 (cons (- (CAR CEP1) (/ (* NOC 0.3333) 2)) (CDR CEP1))) (COMMAND "_MOVE" CEP "" CEP1 (LIST (CAR CEP1) (- (CADR CEP1) (* NOR 0.6667)) (CADDR CEP1))) (command "layer" "set" OLDL "") (PRINC) )
-
Hi Lisp Legends, Actually i am new to autolisp, just now reviewed cadtutor.net, excellent works done by members here. Thanks in advance to those peoples:) I need a urgent help from you friends.... actually I need to align text(as shown in attachment) to three different positions of a block(red coloured). Is there any lisp to get the text aligned to those positions. further explained in attached image Please revert for clarification if any required. Awaiting for your response. Thanks amb sample.dwg
-
I want to create a auto lisp programme for following As input i want to select one line from model space in auto cad and as output i want table that display length of line and whenever i change length of line, table should automatic update new length I am using auto cad 2014
-
Hello, I have a question for all those lisp masters out there. The company that I work for has had me learning and creating lisp for them for a couple months now and we are starting to get a library of lisp built up. Currently I have all of the lisp being loaded at startup through the appload command. I have decided to use Lee Mac's Autoloader when necessary, but I was wondering at how many lisp would it be wise to do that for instead of at startup? Right now the PCs in the office are not filling slow (They are what I would consider to be in the middle of the road in power.).
-
Hello, I am looking for a lisp the can place a block along a polyline every 500 feet. I know about using the measure command, and have made a lisp to use it, but one of the blocks that I have to use has an attribute. Measure does not work with attributed blocks. Is there already a lisp out there that will work like measure with attributes blocks or does anyone have any ideas that could do this?
- 4 replies
-
- block attribute
- autolisp
-
(and 1 more)
Tagged with:
-
Sorting mixed order points on a polyline object
nkeseci posted a topic in AutoLISP, Visual LISP & DCL
Hi, Can anyone help me to write a lisp function to sort the points (assume the intersection points) on a polyline? With my code, I have a polyline object and a set of intersection points on it. I need to calculate the cumulative distance between those points and vertex points consecutively. Thanks,- 6 replies
-
- polyline
- intersection
-
(and 3 more)
Tagged with:
-
Hello, guys! I have a little question... Is there some way to open / edit a drawing with autolisp without display that drawing? For example... When we are working with VBA, we can use the code ActiveWindow.Visible = False to not show the active window. Can we do something like it in autolisp?
- 1 reply
-
- open drawings
- not to show drawings
-
(and 2 more)
Tagged with:
-
Hello, guys! I'm new here. So, please, be gentle. I had a problem with a routine. I have to open all the drawings in the same folder, compare a specific area of the drawing with a reference and change that area, if necessary. But I have a lot of references to compare, so I need to do that many times. I've already got a batch to open all the drawings in the same folder. So I just modified it to compare the area with the reference and it worked greatly. The only problem is: When i put that batch inside a loop instruction (to change the reference that will be compared), the batch didn't worked. The following error appears: ; error: bad argument type: streamp nil Here goes the code. Could someone help me? (defun c:testloop (/) (setq c 1) (while ( (c:opendrawings) (setq c (1+ c)) ); end while ); end function to test the loop (defun c:opendrawings (/ dwglist dwgname dwgpre file openfile uhoh len) (vl-load-com) (if (and (setq dwgpre (getvar 'dwgprefix)) (setq dwglist (vl-sort (vl-remove (strcat dwgpre (getvar 'dwgname)) (mapcar '(lambda (dwgname) (strcat dwgpre dwgname)) (vl-directory-files dwgpre "*.dwg") ) ) ' ) ) (setq uhoh "Readonly drawings will not be processed!" ) (setq len (strlen uhoh)) ) (progn (setq openfile (open (setq file (strcat dwgpre "myscript.scr")) "w")) (progn (foreach f dwglist (if (and (not (Is_ReadOnly f)) (/= (checkAttFile f) 1) ) (progn (write-line (strcat "_.open \"" f "\"") openfile) (write-line "_.audit _y" openfile) ; (write-line "_.qsave _.close" openfile) ) (setq uhoh (strcat uhoh "\n" f)) ) ) (close openfile) (command "_.script" file) (if (= (strlen uhoh) len) (princ "All drawings successfully processed...") (alert uhoh) ) ) ) ) (princ) ); end function to open all the drawings
- 4 replies
-
- open all drawings
- loop instruction
-
(and 2 more)
Tagged with:
-
Hello, I am trying to draw a solid object by AutoLISP. But I got stuck while drawing an arc. Please see below picture where I got stuck. I need this arc parallel to the lines below it. I tried some UCS command but at that time arc shown up somewhere irrelevant. Couldn't figure it out. I'm doing something wrong. (I can post my .lsp here however it might be confusing for you as it contains many variables defined by me) Can anybody help please?
- 9 replies
-
- autolisp
- arc direction
-
(and 2 more)
Tagged with:
-
I am looking for a lisp that will allow me to convert survey figures to flat polylines. Currently I have to select them explode which makes 3dpolylines then convert to 2dpolylines. I then use the flatten command. I have tried making a lisp that uses (command "_explode") and (command "_flatten") and am having trouble getting them to work. Does anyone have any suggestions?
-
Hello, I have a drawing with approximately 4400 points in it. and a file folder with the same number of files. What i am looking for is a lisp routine that will use the point description and then create a hyperlink to the file in the folder with the name that is the same as the description. So if i have a point thats description is 43804152000, the lisp routine would go to the folder where all the hyperlink files are saved and hyperlink to the file named 43804152000. I have zero knowledge in lisp routines and would appreciate any help! Thanks,
-
Is it possible using AutoLISP to define a variable name from the command line when running a function? I want to input the name when running it from the command line. Can I do this and still have the variable be global? If so, how would I go about that? Thanks in advance.
-
Lisp for selectsimilar according to area of the object
vinayv4v posted a topic in AutoLISP, Visual LISP & DCL
Hi, I need a LISP for selecting similarobjects according to area of the object. As I am not familiar in creating LISPS any help would be appreciable. Thanks & Best Regards Vinay -
This is the part of code. I am getting the ; error: bad list of points How we will make list of points pt1 and pt2 to pass in ssget "_F". please help (setq txt (entsel "Select text: ")) (setq oText (vlax-ename->vla-object (car txt))) (setq pt1 (vlax-safearray->list (vlax-variant-value (vlax-get-property oText 'InsertionPoint)))) (setq x1 (car pt) y1 (cadr pt)) (setq angle_obj (vlax-get-property oText 'Rotation)) (setq pt2 (polar pt (+ angle_obj PI 90) 0.3)) (setq x2 (car pt) y2 (cadr pt)) (setq ss (ssget "_F" '((x1 y1) (x2 y2)) ))
-
Hello.. Not familiar with autolisp or scripts I work for a earthworks company, and we are looking for a way to have an excel worksheet to update progress completion by coloring a property another colour in autocad. Example - lot 1 10% complete, and lot 10 is 30% complete as per excel data. I would like lot 1 (10%) to be light green and lot 10(30%) to be a darker green and darker shades for higher % completion and for the autocad drawing to update as the excel data sheet is updated. I have aproximatly 400 lots to program in this way if possible. Each lot will have 10 conditions (ie 10%, 20%, 30%... to 100%) Thank you
-
How to transfer my custom icons, menus, toolbar in my computer to other computer
muhammad_rp posted a topic in AutoLISP, Visual LISP & DCL
How to transfer my custom icons, menus, toolbar in my computer to other computer. -
How to create a Amnote in AutoCAD Mechanical
muhammad_rp posted a topic in AutoLISP, Visual LISP & DCL
hi guys, my name is ramdan i live in Indonesia, I want to Ask, how to make amnote in AutoCAD Mechanical with Autolisp ? thanks,- 1 reply
-
- autolisp programs
- autolisp code problems
- (and 3 more)
-
Undoing LISP with Visual Basic doesn't REGEN changes
plackowski posted a topic in AutoLISP, Visual LISP & DCL
I think I'm encountering the same problem that was not resolved here. I'm trying to set all the layers of an xref to layer 251. I found two codes online, posted below. CVX: (defun c:cvx (/ ent_data);;changes all layers in selected xref to color 251 (setq ent_data (entget (car (entsel)))) (command "-layer" "Color" 251 (strcat (cdr (assoc 2 ent_data)) "*")"") ) X251: (defun C:X251 (/ EN L X ad layers) (command "UNDO" "BEGIN") (setq EN (nentsel "\nSelect Xref: ") L (cdr (assoc 8 (entget (car EN)))) X (substr L 1 (vl-string-position (ascii "|") L)) ) (setq AD (vla-get-ActiveDocument (vlax-get-Acad-Object)) layers (vla-get-Layers ad)) (if (/= (vl-string-search "|" L) nil) (progn (vlax-for layer layers (if (/= (vl-string-search (strcat X "|") (vla-get-name layer)) nil)(vla-put-Color layer 251)) ) (command ".REGEN") ) (princ "Not an Xref!") ) (prin1) (command "UNDO" "END") ) I used the CVX routine for a while, until I discovered that it doesn't work if I select xrefs that are attached to overlaid xrefs. So I tried switching to the X251 routine, but if I use UNDO, the changes aren't reflected until I REGEN the drawing. I tried using an undo group as suggested in the linked post, but that didn't change the result. Any advice?- 2 replies
-
- regen
- layer color
-
(and 2 more)
Tagged with:
-
I have a plot setup to plot all the layout tabs in a drawing. I have provided the users the options to select the paper size, plot style, and orientation. These are stored as user variables (PDFPS, PST, and PLO). I have the setup working great, but I am trying to set it up where if the user hasn't selected one of the variables, the command will be cancelled. I have tried an if statement, but I wanted to evaluate all three variables at once. I'm thinking it should be doable, just have been able to figure it out. Any help is appreciated. The code below is the code that plots all the layouts and places them in the PDF folder for each project. ^C^C^C(foreach LL (layoutlist)(setvar "ctab" LL)(command (setq DL (substr (getvar "dwgprefix") 1 (- (strlen (getvar "dwgprefix")) 13))) (setq DN (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))) (strcat DL DN);(setq FS (strcat DL "52 PDFs" (chr 92) DN "-" (getvar "CTAB") ".pdf")) "plot" "yes" "" "AutoCAD PDF (General Documentation)" PDFPS "Inches" PLO "No" "Extents" "1:1" "Center" "Yes" PST "Yes" "No" "No" "No" FS "Yes" "Yes" "Yes"));(alert "If all settings were selected, PDFs have been made of all layout sheets and saved in the PDFs folder for this project. They were saved as Project Name-Layout Name"); For reference, I have a code that evaluates each variable and displays a message. (if (= nil PDFPS) (alert "No paper size was selected. Please cancel command and select paper size.") (strcat PDFPS))
- 8 replies
-
- conditional
- autolisp
-
(and 1 more)
Tagged with:
-
I've incorporated and created many LISP functions for surveying purposes in AutoCAD. I've been wanting to share them, so here goes. A lot of the functions reference other functions. I've used the naming scheme: mfcb* for My Functions CBass (me) mfcbLM for My Functions Lee Mac (because he is awesome) Many of these functions have been the work of others and I have revised them to my needs. Use them as you see fit. Enjoy! AutoCAD Blocks Edit: Minor text fixes. Sorry about that. Edit2: Optimizations. Edit3: Optimizations and error fixing. Edit4: More optimizations and a few new functions. Edit5: Optimized SPL function. Edit6: Fixed c:CLOSEST (iNdx was causing infinite loop). Edit7: Fixed multiple selections with c:MASK command (forgot to nil the XData and it would error). Edit8: Formatted Benchmark.lsp for readability. Edit9: Revised XData functions to preserve other application XData. Created menus for the functions. Edit10: Added dropbox link to AutoCAD blocks. Benchmark.lsp PointCodeList.txt acaddoc.lsp Global Functions.LSP Menu.zip