Search the Community
Showing results for tags 'autolisp'.
-
Hello, I am looking for a lisp that will allow me to increment an attribute in a block from one block to the next by doing a window selection. The lisp that I have now that I got from Chaitanya Chikkala (see below) works great, but I have to select each block individually. With 2000+ blocks it is easy to make a mistake. When I window select with it, it numbers them as they were added to the drawing. This does not work for me because multiple people work on drawings and then are combined into a master drawing so the order is wrong. Is there a way for a direction to be added, even if it is just along the x or y axis? Or is there a lisp that already does this? Any help is very much appreciated. (defun c:incr (/ ent obj x i ST_STR) (command "._undo" "_be") (SETQ ST_STR1 (GETSTRING "\nENTER STARTING NUMBER OF THE SEQUENCE(ANY ALPHABET/WORD)")) (SETQ ST_STR (GETSTRING "\nENTER STARTING NUMBER OF THE SEQUENCE(ANY INTEGER)")) (vl-load-com) (setq i 0) (prompt "\nSelect blocks one at a time and in order") (SETQ BLOCK_LIST (SSGET)) (SETQ BLOCK_LIST (FORM_SSSET BLOCK_LIST)) (while (< I (LENGTH BLOCK_LIST)) (SETQ ST_STR (STRCAT "" ST_STR)) (SETQ TEMP_ELE (NTH 0 (ATTRIBUTE_EXTRACT (NTH I BLOCK_LIST)))) (SETQ TEMP_ATTRIBUTE (STRCAT ST_STR1 ST_STR)) (SETQ TEMP_TAG (NTH 0 TEMP_ELE)) (MODIFY_ATTRIBUTES (NTH I BLOCK_LIST) (LIST TEMP_TAG) (LIST TEMP_ATTRIBUTE)) (SETQ ST_STR (ITOA (+ (ATOI ST_STR) 1))) (setq i (+ i 1)) ) (command "._undo" "_e") (princ)) (DEFUN FORM_SSSET (SSSET / I TEMP_ELE LIST1) (SETQ I 0) (SETQ TEMP_ELE NIL) (SETQ LIST1 NIL_) (WHILE (< I (SSLENGTH SSSET)) (SETQ TEMP_ELE (SSNAME SSSET I)) (SETQ LIST1 (CONS TEMP_ELE LIST1)) (SETQ I (+ I 1)) ) (REVERSE LIST1) ) (DEFUN ATTRIBUTE_EXTRACT (ENTNAME / ENT_OBJECT SAFEARRAY_SET I LIST1) (SETQ SAFEARRAY_SET NIL) (SETQ ENT_OBJECT ENTNAME) (SETQ ENT_OBJECT (VLAX-ENAME->VLA-OBJECT ENT_OBJECT)) (IF (= (VLAX-GET-PROPERTY ENT_OBJECT "HASATTRIBUTES") :VLAX-TRUE) (PROGN (SETQ SAFEARRAY_SET (VLAX-SAFEARRAY->LIST (VLAX-VARIANT-VALUE (VLAX-INVOKE-METHOD ENT_OBJECT "GETATTRIBUTES") ) ) ) (SETQ I 0) (SETQ LIST1 NIL) (WHILE (< I (LENGTH SAFEARRAY_SET)) (SETQ LIST1 (CONS (LIST (VLAX-GET-PROPERTY (NTH I SAFEARRAY_SET) "TAGSTRING") (VLAX-GET-PROPERTY (NTH I SAFEARRAY_SET) "TEXTSTRING") ) LIST1 ) ) (SETQ I (+ I 1)) ) (SETQ LIST1 (REVERSE LIST1)) (SETQ LIST1 (SORT_FUN LIST1 0 0))) (SETQ LIST1 NIL) )LIST1 ) (DEFUN MODIFY_ATTRIBUTES (ENTNAME IDENTIFIER VALUE / TEMP_ELE ENT_OBJECT SAFEARRAY_SET I J) (SETQ SAFEARRAY_SET NIL) (SETQ ENT_OBJECT ENTNAME) (SETQ ENT_OBJECT (VLAX-ENAME->VLA-OBJECT ENT_OBJECT)) (IF (= (VLAX-GET-PROPERTY ENT_OBJECT "HASATTRIBUTES") :VLAX-TRUE) (PROGN (SETQ SAFEARRAY_SET (VLAX-SAFEARRAY->LIST (VLAX-VARIANT-VALUE (VLAX-INVOKE-METHOD ENT_OBJECT "GETATTRIBUTES") ) ) ) (SETQ I 0) (SETQ J 0) (SETQ LIST1 NIL) (WHILE (< I (LENGTH SAFEARRAY_SET)) (SETQ TEMP_ELE (VLAX-GET-PROPERTY (NTH I SAFEARRAY_SET) "TAGSTRING")) (IF (/= (VL-POSITION TEMP_ELE IDENTIFIER) NIL) (PROGN (VLAX-PUT-PROPERTY (NTH I SAFEARRAY_SET) "TEXTSTRING" (NTH (VL-POSITION TEMP_ELE IDENTIFIER) VALUE)) )) (SETQ I (+ I 1)) ) ))) (DEFUN SORT_FUN (LIST1 FLAG1 FLAG2 /) (IF (= NIL (VL-CONSP (CAR LIST1))) (PROGN (SETQ LIST1 (INDEX_ADD LIST1)) (SETQ LIST1 (VL-SORT LIST1 '(LAMBDA (X Y) (< (CADR X) (CADR Y))) ) ) (SETQ LIST1 (MAPCAR '(LAMBDA (X) (CADR X)) LIST1)) ) (PROGN (IF (NOT (ATOM (NTH FLAG1 (NTH 0 LIST1)))) (SETQ LIST1 (VL-SORT LIST1 '(LAMBDA (X Y) (< (NTH FLAG2 (NTH FLAG1 X)) (NTH FLAG2 (NTH FLAG1 Y))) ) ) ) (PROGN (SETQ LIST1 (VL-SORT LIST1 '(LAMBDA (X Y) (< (NTH FLAG2 X) (NTH FLAG2 Y))) ) ) ) ) ) ) LIST1 )
-
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:
-
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:
-
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 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)) ))
-
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:
-
Autolisp nesting polylines in various rectangle
LULU1965 posted a topic in AutoLISP, Visual LISP & DCL
I introduce myself my name is Luciano and 30 years working on 2d and 3d. I have a problem that now haunts for years and only you "GURU" of the Lisp language you can perhaps bring myself giving me a great mano.Vi thank you in advance. special nesting.dwg -
Why does ssdel remove entities from other selection sets, and how to get around it?
benhubel posted a topic in AutoLISP, Visual LISP & DCL
I am writing a routine that requires that I remove objects from a selection set while still keeping the original set around. After running into issues, I created a test routine to see how ssdel is operating. I want it to remove selB from selC, while keeping selA and selD untouched to hold the original selection. It is removing selB from all related selection sets though. Why is it doing this, and how can I fix it? (defun c:TD () ;Test Delete (setq selA(ssget)) ;get base selection A (setq selB(ssget)) ;get selection B to remove from selection C (setq selC selA) ;copies selection A and removes selection B to return the difference (setq selD selA) ;extra variable to test how ssdel works (setq i 0) ;index (repeat (sslength selB) ;repeat for each entity in selB (ssdel (ssname selB i) selC) ;intended to remove selB from selC. It is also removeing selB from selA, which I don't want. (setq i (1+ i))) ;increment ) ;Functions below are used to test which geometry is contained in which selection set (defun c:dela () ;delete geometry in selection A (If(/= nil selA)(command ".erase" selA "")(princ "\n selA is empty. Run TD to initialize"))(princ)) ;if selA contains entities, delete them. If not, display error. (defun c:delb () ;delete geometry in selection B (If(/= nil selB)(command ".erase" selB "")(princ "\n selB is empty. Run TD to initialize"))(princ)) ;if selB contains entities, delete them. If not, display error. (defun c:delc () ;delete geometry in selection C (If(/= nil selC)(command ".erase" selC "")(princ "\n selC is empty. Run TD to initialize"))(princ)) ;if selC contains entities, delete them. If not, display error. (defun c:deld () ;delete geometry in selection d (If(/= nil selD)(command ".erase" selD "")(princ "\n selD is empty. Run TD to initialize"))(princ)) ;if selD contains entities, delete them. If not, display error.- 5 replies
-
- selection sets
- autolisp
-
(and 1 more)
Tagged with:
-
Hello, guys! I need a lisp to rename the current open file. I already have a routine that takes the current file name and creates a string with the new file name (Just six numbers in the old name needs to change)... But I coudn't change the old name for the new name. I've tried to use the (Vl-File-Rename), but I think that i didn't use it right.... Here's go the code: (defun C:changename (n1 n2 n3 n4 n5 n6) (setq new_number (strcat (itoa n1) (itoa n2) (itoa n3) (itoa n4) (itoa n5) (itoa n6))) (setq old_name (strcat (getvar "DWGPREFIX") (getvar "DWGNAME"))) (setq size (strlen old_name)) (setq final (- size 18 )) ; (setq start_name (substr old_name 1 final )) (setq end_name (substr old_name (+ final 7) (- size final))) (setq new_name (strcat start_name new_number end_name)) (alert old_name) (alert new_name) (vl-file-rename old_name new_name) ); end defun The old name is: D:\Profiles\s-Andre.Almeida\Desktop\Autocad\3-157941-012-005.dwg The new name, for example, could be: D:\Profiles\s-Andre.Almeida\Desktop\Autocad\3-666666-012-005.dwg I just need to change the names with the (vl-file-rename) could someone help me?
-
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
-
Lisp to open multiple DWG's and write in each one
andr3flaviano posted a topic in AutoLISP, Visual LISP & DCL
Hello, guys! I'm creating a lisp to open multiple DWG's in a directory and alterate a number at a especific position. I have a function (called txt) to write the number at a position and I have another function (called change_all) to open every DWG in the directory and execute the function "txt". I want that the "Change_all" asks me the number and then execute the "txt" to write that number in all DWG's. The functions are already working, but i couldn't call the "txt" with the parameter number previously defined Here are the code: (defun c:txt (tval) ; (setq num0 (ssget "_C" '(347.06 18.12) '(350.90 18.12))) ; (command ".erase" num0 "" ); (setq pt1 '(346.5 15.84)) ; (if (not (tblsearch "Layer" "TEXT")) (command "-layer" "m" "TEXT" "") ) ;_ end if (entmake (list '(0 . "TEXT") '(8 . "TEXT5") (cons 10 pt1) (cons 40 4.5) (cons 1 tval) '(50 . 0.0) '(7 . "ROMANS") '(71 . 0) '(62 . 4) '(72 . 0) '(73 . 0) ) ;_ end list ) ;_ end entmake (*error* "") (princ) ) ;_ end defun (defun c: change_all (/ 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")) (setq num (getstring t "\nType the numer: ")) ; (progn (foreach f dwglist (if (and (not (Is_ReadOnly f)) (/= (checkAttFile f) 1) ) (progn (write-line (strcat "_.open \"" f "\"") openfile) (write-line "(C: (txt num))" 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 Defun Could someone help me, please?- 1 reply
-
- open dwg
- function calling
-
(and 3 more)
Tagged with:
-
Lisp Routine to Bring in Z Value (Lee Mac Lisps)
RigourSurvey posted a topic in AutoCAD 2D Drafting, Object Properties & Interface
Hi Everyone, We have browsed the forum looking for a Lisp Routine for creating Z values from point clouds. Lee Mac has came up with something which works well (great work Lee). Though we are looking to modify this to suit our workflow: Basically we want to pick a point and bring through the z value as text. (which the lisp below works fine) though not having the option to choose between x,y,z and only picking the z value every time would be beneficial. Having a fixed offset and text size too rather than having the option to choose Next we need the lisp to bring in some text for the selected level i.e creating text with the remark DL. Once we have one code for this lisp we can then alter this to bring in other remarks such as CL WHL CHL USB etc etc. Then we can customise each lisp with a button in CAD. One Last thing is the lisp below creates a Cross from two drawn lines. Does anyone know how to make this a separate entity like a Symbol/Block and change it so its square to the model space unlike the current cross If anyone can help with this it would be fantastic and heavily aid our workflow. The code below is as Lee Mac has posted (defun c:ptlab (/ Text _PromptWithDefault _Cross Pt pos) ;; Lee Mac ~ 30.03.10 (defun Text (pt hgt str) (entmakex (list (cons 0 "TEXT") (cons 10 pt) (cons 40 hgt) (cons 7 (getvar 'TEXTSTYLE)) (cons 1 str)))) (defun _PromptWithDefault (f arg d) (cond ((apply f arg)) (d))) (defun _Cross (p h / l) (setq l (sqrt (* 0.5 h h))) (mapcar (function (lambda (p1 p2) (entmakex (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2))))) (list (polar p (/ pi 4.) l) (polar p (/ (* 3 pi) 4.) l)) (list (polar p (/ (* 5 pi) 4.) l) (polar p (/ (* 7 pi) 4.) l)))) (setq *Coord* (cond (*Coord*) ("Y")) *tHgt* (cond (*tHgt* ) ((getvar 'TEXTSIZE))) *thOff* (cond (*thOff*) (0.15)) *tvOff* (cond (*tvOff*) (0.15)) *cSze* (cond (*cSze* ) ((getvar 'TEXTSIZE)))) (setq pos '(("X" . 0) ("Y" . 0) ("Z" . 2))) (initget "X Y Z") (mapcar (function set) '(*Coord* *tHgt* *thOff* *tvOff* *cSze*) (mapcar (function _PromptWithDefault) '(getkword getdist getdist getdist getdist ) (list (list (strcat "\nSpecify Coord to Label [X/Y/Z] <" *Coord* "> : ")) (list (strcat "\nSpecify Text Height <" (rtos *tHgt*) "> : ")) (list (strcat "\nSpecify Horizontal Text Offset <" (rtos *thOff*) "> : ")) (list (strcat "\nSpecify Vertical Text Offset <" (rtos *tvOff*) "> : ")) (list (strcat "\nSpecify Cross Height <" (rtos *cSze*) "> : "))) (list *Coord* *tHgt* *thOff* *tvOff* *cSze*))) (while (setq pt (getpoint "\nPick Point to Label <Exit> : ")) (_Cross (setq pt (trans pt 1 0)) *cSze*) (Text (polar (polar pt 0. *thOff*) (/ pi 2.) *tvOff*) *tHgt* (rtos (nth (cdr (assoc *Coord* pos)) pt)))) (princ)) Thanks in Advance Mark- 1 reply
-
- point cloud
- lisp
-
(and 2 more)
Tagged with:
-
Autoselect nearest closed polyline that surrounds text entity
alm865 posted a topic in AutoLISP, Visual LISP & DCL
Hi All, I'm after an Autolisp function that basically does the following: User selects a text Script finds nearest closed polyline that the text's insertion point lies inside I.e. Given a point (the insertion point for the text entity), I want to automatically find the nearest closed polyline that the point lies in. The polyline is always closed. Picture is below (hopefully clears up some confusion). -
Extract Text data at a XYZ coordinate from Autocad
kArThIcK hAcKeR posted a topic in AutoLISP, Visual LISP & DCL
Hi guys, Attachment: Test Drawing.dwg I want to retrive the text's content, the text is placed at a certain XYZ co-ordinate in Autocad, (same coordinates, always for all the drawings). [Refering to the attachment]: The text below the "Surface Area" and the "Weight", are mostly the texts i'm trying to get. These texts sometimes come as a single line text or as a mtext or within blocks.. but always they appear at the same coodinates. Can somebody help me with this?- 7 replies
-
- coordinate
- autolisp
-
(and 1 more)
Tagged with:
-
Error for ObjectID of polyline using vlax-curve-*
HelplessIntern posted a topic in AutoLISP, Visual LISP & DCL
I have just started learning AutoLISP from different posts on the forums and through the reference material from Autodesk but, I am hitting an error in my lisp routine that I don't know how to fix. I am trying to right a while loop that will go through a nested list and use information in the selected list segment to find points in reference to a Polyline using the vlax-curve-* functions. Currently I am using the vlax-curve-getPointAtDist with a variable distance and using a user defined polyline from the document. My code runs up until the point I try to use the getPointAtDist line which will return the error of "unable to find ObjectID for . The way I get the polyline from the user is a (setq Var (ssget "_+.:s" '((0 . "*POLYLINE")))). I have earlier in the routine the vla-load-com to load in all of the functions of visual lisp. Can anyone help me out on what I need to do to be able to run the vlax-curve-* functions?- 10 replies
-
- objectidcollection
- autolisp code problems
-
(and 2 more)
Tagged with:
-
Boundary Creation Lisp- by Text selections
zefreestijl posted a topic in AutoLISP, Visual LISP & DCL
Thread: Boundary Creation Lisp- a request HI, I just learned how to create boundary smoothly from the above post. is there a way to create boundary by the coordinates of selected Texts? Thanks!- 5 replies
-
- coordinate
- boundaries
-
(and 2 more)
Tagged with: