Jump to content

Search the Community

Showing results for tags 'autolisp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

  1. Hi, This is my first after so many days using this site. my block have multiple attributes for different types of lengths and one(DUCT_ID) attribute for sequence. i want to link objects length to block attribute(its a field)(MICRODUCT) by using TAG(DUCT_ID). HOW IT WORKS. command to select the objects then ask for DUCT_ID. then link the selected objects to MICRODUCT. i'm using lee mac length2 field for now. but in this lisp you have to select the block manually. but blocks our drawing usually in different location initially for easy to work. thanks in advance.
  2. Hi guys I'm not sure that this is possible but hey you guys know a hell of a lot and surprise me often. Is it possible in lisp to look inside a text file and remove some text from between 2 keywords? For example The text filename would be the same as the cad file, but it's on another network location. I can create a variable that concatenates the file name and location. This I know I can do lol. Then I want the lisp to open the file find Keyword1 and keyword2 (always the same and only ever 1 of each in the file, also there would always be text before and after the keywords which should be kept intact). Then remove any text that lies between them. And finally resave the file. I've done some searches but I keep getting results for editing text inside of cad, which isn't what I'm after, or recommending using other programming language, but I've no idea how to do that. Which is why I'm pinning my hopes on this.
  3. Hello everyone, can anyone help me, I have a case example that is almost similar to the actual case I am experiencing now. In the 1st picture I have a shapefile of the administrative boundaries of the United States that I have entered into autocad, the shp attribute has been entered into the data object of each feature with the data object name "GADM", in the data object there are State and County fields, for the layer of each feature I use the County field reference so that each feature is currently layered with its respective county name. what I want is that as in the 2nd picture I want each feature to be grouped or made per block per category of state, is there a quick way, because I think in each feature there is a State field? Noted: The Autocad that I use is AutocadMap 2021. Pic 1 Pic 2
  4. Hi, I tried to write an autolisp code and I got to a certain point, but it is not working as I wanted. I would like your suggestions and your support in revising the code. What I want to do is select a block. To find out which character (n) from the right is the "-" sign in the layer name of the line touching the block I selected. Then subtract 1 from this character(n) number and add n-1 from the right. Combining the part up to the character and the prefix text and writing to the block geometric point. The way this code works now is to combine the front text and the text to the right of the "-" sign of the last layer added to the layer list and write it to the center of the block. This wasn't something I wanted. (setq *textHeight* 8) (setq *layerName* "01 Equipment list 2") (setq *textColor* 1) ; (defun c:bs_ayar () (setq *textHeight* (getreal "\nEnter new text height: ")) (setq *layerName* (getstring "\nEnter new layer name: ")) (setq *textColor* (getint "\nEnter new color index (1 for Magenta): ")) (princ (strcat "\nText height is now " (rtos *textHeight*) ", layer name is " *layerName* ", color is " (itoa *textColor*) " was set to. ")) (princ) ) (defun c:bs4 () (setq prefix (getstring T "\nEnter prefix letter: ")) (setq blk (car (entsel "\nSelect Block: "))) (setq blkEnt (entget blk)) (setq insPt (cdr (assoc 10 blkEnt))) (setq ss (ssget "_X" (list (cons 0 "LINE,POLYLINE")))) (if (and ss (> (sslength ss) 0)) (progn (setq line (ssname ss 0)) (setq lineEnt (entget line)) (setq lineLayer (cdr (assoc 8 lineEnt))) (setq dashPos (vl-string-search "-" lineLayer)) (if dashPos (setq rightPart (substr lineLayer (+ dashPos 2))) (setq rightPart lineLayer) ) (command "._-LAYER" "_M" *layerName* "" "_C" *textColor* "" "") (command "._TEXT" insPt *textHeight* "" (strcat prefix rightPart)) (command "._-LAYER" "_S" *layerName* "") ) (princ "\nNo line or polyline was found touching the selected block.") ) (princ) )
  5. I have one AutoLISP to insert Dynamic Blocks containing Attributes. With this AutoLISP I can select the Value Attribute via the List DCL. I can insert Dynamic blocks wherever I want. The problem is, I want to use this AutoLISP by inserting dynamic blocks simultaneously at the midpoint of the line. what should I do? can anyone help me Thank You
  6. Hello, I have a lisp code that I have been working on and I have brought it to a certain stage. However, I am having a problem at one point. In this lisp code, I have a product list with my purpose defined. When the code runs, my product list is listed in the pop-up window. And I choose what I want and paste it to the places I specify on the screen. However, my product list can be up to 500 items, so I created a search button in the popup window. The button works, but it is based on the line number I choose, not the product name I choose, and it writes the product on this line number in the general list to the screen. I need support on how to overcome this problem. main command (defun C:prdef (/ dcl_id product_list product filter_list pt index) (create-layer "00-Equipment List" 3) ; Number 3 is used for green color (setq product_list '("Product-1" "Product-2" "Product-3" "Product-4" "Product-5" "Product-6" "Product-7" "Product-8" "Product-9" "Product-10" "Product-11" "Product-12" "Product-13" "Product-14")) (setq dcl_id (load_dialog "product_select.dcl")) (if (not (new_dialog "product_select" dcl_id)) (exit) ) (start_list "product_list") (mapcar 'add_list product_list) (end_list) (action_tile "search_box" "(progn (setq filter_text $value) (update_list filter_text))") (action_tile "product_list" "(setq product (nth (atoi $value) product_list))") ; (action_tile "ok" "(done_dialog)") (action_tile "search_button" "(update_list filter_text)") ; (start_dialog) (unload_dialog dcl_id) (initget 1) (while (setq pt (getpoint "\nChoose a location (exit with ESC): ")) (setq index (atoi product)) ; (command "_.-layer" "_S" "00-Equipment List" "") ; (command "_.text" pt default-text-height 0 product) ; (command "_.-layer" "_S" "0" "") ; ) ) ; List update function (defun update_list (filter_text / filtered_list) (setq filtered_list (if (= filter_text "") product_list (vl-remove-if-not '(lambda (x) (vl-string-search (strcase filter_text) (strcase x))) product_list ) ) ) (start_list "product_list") (mapcar 'add_list filtered_list) (end_list) (set_tile "product_list" "") ) In my dcl code as follows product_select : dialog { label = "Product Select"; : edit_box { key = "search_box"; label = "search"; width = 40; } : button { key = "search_button"; label = "search"; is_default = true; } : list_box { key = "product_list"; multiple_select = false; fixed_width = true; width = 40; } ok_cancel; }
  7. Is there any chance of matchline automation using lisp in layout? I have attached sample dwg and screenshot of block for matchline. Please help. And thanks in advance. SRS.dwg
  8. Dears, AUTOLIPS works on the english version but i want to use it on the frensh version, any kind of support Thanks
  9. Hi There, I'm trying to make various custom tools that deal with clicking on bearings, but sometimes these text entities might be enclosed by brackets, and so I need to filter those out in a lot of my routines. So I figured, let's make a separate routine that I can load when called instead of copy pasting this a bunch. (My initial thought was to use on_start.lsp (acad.lsp), but I think load is the correct thing to do here?) I guess the problem is that in some instances I'd like to set a flag if brackets were removed or not, so that I can put them back on (or not). I'm not too sure if there is such a thing as overloading in AutoLisp, but if someone could point me to what the preferred equivalent method would be that would be appreciated. I've vaguely read about parsing lists as args, but I thought I should ask here just to confirm before I make any fundamental mistakes. Cheers,
  10. Hi, there, im very new working with Autolisp, in the past i copy and paste code and use the lisp. Thanks to all the people who write this lisp. Now im learning how to code with lisp, i m reading books, developers guide and this forum. I need to understand how some commands works for use it in the lisp code. I cant find a description of how command works. For example (command "xref" "r"). But i know this command have more options, i need the description of the other options and how can i use it. (defun c:CircC () (command "._circle" "0,0" "3,3") (command "._thickness" 1) (command "._circle" PAUSE PAUSE) (princ) ) i want to know how circle command works "0,0" is the origin point "3,3" is for ??
  11. Hello everyone, I was just wondering how you guys organize your LISP routines. I currently have a file structure that looks like this. \AutoLisp ----\lib --------\libs --------\...All My Lee-Mac files, thanks LEE :D --------\lisp-loader.lsp (basically loads all the LEE-MAC routine so that I can use it in my LSP) ----\LM_functions --------\...basically other Lee-Mac functions that are way too big by themselves. ----\MA_functions --------\...my functions basically ----\NUMCOUNT.lsp (my own version of numeric counting for blocks, and multileaders) ----\...other projects basically ----\MA-load-lisp.lsp (loads my MA_functions) Basically, for every major project that I have, by themselves without external loading of scripts that I use, the lsp file reaches thousands of lines of code. Also, this way, the codes are easier to manage and can be verified individually. In each project, I start with: (vl-load-com) (load (findfile "lisp-loader.lsp")) (load (findfile "MA-load-lisp.lsp")) Looking at MA-load-lisp, here's what it looks like: (defun MA-load-lisp (/ lisp lisppath lisplist count) (setq lisppath "~~AutoLISP\\MA_functions\\") (setq lisplist (vl-directory-files lisppath "*.lsp" 1)) (setq count (length lisplist)) (foreach lisp lisplist (if (load (strcat lisppath lisp)) (princ (strcat lisp " has been loaded.\n")) (princ (strcat lisp " didn't load.\n")) ) ;end if ) ;end foreach (princ (strcat "There are " (itoa count) " pre-loaded scripts from " lisppath ".\n") ) (princ) ); end function (MA-load-lisp); and, run this function the ~~ at the 2nd line is just short for C:\\---- to wherever the folder is. However, here's the deal, whenever I load the scripts using APPLOAD, AutoCAD 2020 prompts a security check for each of the files. I already have this folder \AutoLISP in the Support File Search Path and Trusted Locations in the Options Menu of AutoCAD. I can't seem to find a way to get around this. Do I need to digitally sign each lsp file?
  12. Hi! Avid reader of the forums, first time poster. I have a code with which I'm trying to extract the x and y coordinate of the startpoint of a line to the clipboard for pasting into another program. The problem is that when I run the lisp in Civil 3D it spits out when running (caddr typelst) on line 6 in the code below. What could cause this. I'm having trouble understanding why it wouldn't be able to grab the type from the list. The code: (vl-load-com) (defun c:copyx1y1 () (setq choice (entsel "Choose the line whose start X and Y you want to copy \n")) (setq entname (car choice)) (setq typelst (assoc 0 (entget entname))) (if (= (caddr typelst) "LINE") (progn (setq startpnt (assoc 10 (entget entname))) (setq x1 (cadr startpnt)) (princ "\n") (princ x1) (princ "\n") (setq y1 (caddr startpnt)) (princ y1) (setq copiedtxt (strcat (rtos x1) "\t" (rtos y1))) (setq result (vlax-invoke (vlax-get (vlax-get (setq htmlfile (vlax-create-object "htmlfile")) 'ParentWindow) 'ClipBoardData) 'SetData "Text" copiedtxt) ) (vlax-release-object htmlfile) copiedtxt ) (progn (princ "The choice is not of type LINE") ) ) (princ) ) Regards, E
  13. LEGEND.LSP Hi anyone can modify the code so it can create legends for both and linetypes with their layer name in description. It's a lee mac's program which creating legend in model space. If by touching the viewport it can make legend at layout whatever showing in the viewport it will be a great help.
  14. Hello guys, I am working in AutoCAD. I am looking for a combined LISP code for creating points for the selected objects at its Endpoints, Midpoints, Center, Geometric center, Node, Quadrant, Intersection & Insertion as per users requirements (options with drop down list mentioning Endpoints, Midpoints, Center, Geometric center, Node, Quadrant, Intersection & Insertion Shall get prompted.) Once I select the required snap then the result shall be creation of points at the chosen object snap. An imaginary Example shall be Like like this, command: POBS(Points at Object Snap)-->prompting for what snap need to be found in the selected objects in the for of drop down list--> Creating points in the selected Object Snaps of the selection set. Actually i had found few LISP codes for the following cases 1.PLE-Points on Line Ends.lsp 2.PAI-Point At Intersection.lsp Thanks for the authors of these above LISP they have saved lot of time till date. Thanks in advance.
  15. to this...I have so many data and need to make this type of drawing can anyone suggest lisp or script to make the drawing possible easily...POP to POP will get connected by different GP. Thanks in advance
  16. I'm trying to make an annotative text style that matches orientation. I've got this so far: (entmakex '( (0 . "STYLE") (100 . "AcDbSymbolTableRecord") (100 . "AcDbTextStyleTableRecord") (2 . "My TEXT3") (70 . 0) (40 . 0.09375) (41 . 1.0) (50 . 0.0) (71 . 0) (42 . 0.0) (3 . "romans.shx") (4 . "") (-3 ("AcadAnnotative" (1000 . "AnnotativeData") (1002 . "{") (1070 . 1) (1070 . 1) (1002 . "}") ) ) )) The last bit obviously turns on annotative but I can't find where I might enable the orientation match. Is there more xdata I can add to enable this?
  17. Hii all...I found a multiline polyline lisp from online, its gonna ask how many line and their offset distance...but its assigning layer automatically, can anyone do the changes so it will ask which layer I want to choose for my each line and it should automatically take the linetype as by layer...if I am choosing even no. of line, then the path I am drawing its automatically think that as center line and offset the distance, can anyone makes changes so it will make one line in my drawn path and ask me in which side I want to allocate how many line... multi line.lsp
  18. Hey, Can Anyone help by providing a lisp which will clear all the objects outside of my layout print in all the pages automatically.... please find attachment...I want to keep only object of only the white pages and remove other objects outside of that white space... Thank you in advance
  19. Hi there, I'm AM and new to the forum I'm creating a set of easy lisp routines for my team. I've loaded the following lisp file into AutoCAD and it works fine when typing the function ColorOffsetV031 into the command line within AutoCAD. However, when I try create a new command that will run the lisp with a macro like ^C^CColorOffsetV031 or ^C^C_ColorOffsetV031 so I can then add it to a ribbon/tab/tool palette, I get the following error: "_ColorOffsetV031 Unknown command "COLOROFFSETV031". Press F1 for help." I'm honestly not sure what I'm doing wrong. I've tried different ways of loading the lisp file, from just dropping the file into AutoCAD, adding it to the Startup Suite, loading it as an application etc. I've created 'buttons' like this before, and I feel so silly asking such a simple question; It's probably something really simple that I just can't pick up on... Even if someone can point me in the direction of a related post from someone else I would be very grateful The lisp: ; Define the tool/function name and variables (defun C:ColorOffsetV31 ( / EName EInfo EColor Group ans ansColor) (setvar "CMDECHO" 1) ; Set the options for user choice (initget "Orange Red Yellow Green Cyan Blue Magenta White L-Grey") ; Ask for user input on color for offset (setq ans (cond ((getkword "\nChoose offset object color [Orange/Red/Yellow/Green/Cyan/Blue/Magenta/White/L-Grey] or ENTER for Orange")) ("Orange"))) ; Set ansColor as input color (cond ((= ans "Orange") (setq ansColor 30)) ((= ans "Red") (setq ansColor 1)) ((= ans "Yellow") (setq ansColor 2)) ((= ans "Green") (setq ansColor 3)) ((= ans "Cyan") (setq ansColor 4)) ((= ans "Blue") (setq ansColor 5)) ((= ans "Magenta") (setq ansColor 6)) ((= ans "White") (setq ansColor 7)) ((= ans "L-Grey") (setq ansColor 8)) ; Should not happen but just here incase no input is given, set ansColor to BLACK (t (setq ansColor 250)) ) ;----------------------------- ; Start OFFSET (command "OFFSET" pause) ; Do the following with OFFSET (while (= 1 (logand 1 (getvar "CMDACTIVE"))) (command pause) ; While OFFSET command is on (while (= 1 (logand 1 (getvar "CMDACTIVE"))) (command pause) ; Set the current entity to be used as the last clicked entity (setq EName (entlast)) ; Get entity info (setq EInfo (entget EName)) ; If the colour of the object isn't known (if (not EColor) ; Match ans to EColor (setq EColor ansColor) ) ; Change the colour (entmod (append EInfo (list (cons 62 EColor)))) ) ) (setvar "CMDECHO" 0) (princ) ) Here's a copy of the command itself too Thanks, AM
  20. Greetings, I´m trying to extract and sum specific data attributes from blocks in my drawing. While Lee Mac's Global Attribute Extractor & Editor is excellent, I need some help with two minor modifications: 1. How to select a certain group of blocks of my interest (by indicating a window selection) and not the entire drawing? 2. My blocks have two attributes: CODE and AMOUNT. When running MacAtt, I get the data for every instance of the block that is found, like this: Is there a way to sum the amount of instances with the same attribute in CODE in order to get a shorter table like this? Any direction provided will be very appreciated, thanks!
  21. hello i want help for creating lisp for me please ... the lisp will do these functions 1- as the attached image (1a) if i have block with yellow at right and some green blocks 2- i want when i launch the lisp to ask me to draw poly line that i want as in image 2a 3- after that when i draw this path with polyline and press enter the lisp ask me to choose blocks that i want to connect to this polyline and i will choose one by one or multiple blocks then after choosing the blocks and press enter ... the lisp will offset the main polyline that i draw and connect every polyline with the basepoint of the blocks that i choose sequentially as appear in this image 5a (attached DWG) can anyone help me please sample.dwg
  22. Hi there! I've watched this tutorial and have a few questions: 1. how can I load the full project in the current drawing from Visual Studio Code? Currently, I'm able to only attach the currently opened lsp file and have to load the other manually, one by one. In the visual lisp editor, there was a button to load all the files inside the project. I have a big project divided into a few files that also load an opendcl interface and I need to load them all to debug the whole program or it will not work. 2. how can I compile in fas from vscode? Probably is not possible so I have to use the original visual lisp editor. But how can I load it now? The vlisp command starts the vscode and I don't know how to start the old editor. Thanks! Dennis
  23. Hi all, I am attempting to get a viewport from blocks in modelspace to paperspace with a layout template. I would like this automated by selecting all the blocks in numerical order and placing them on the correct numbered layout. I have found plenty of lisp out there, but nothing that seems to work 100%. I know there are programs out there, but I want to try to learn autolisp with this project. I think I was able to get close with these two: Draw bounding box on object-from Blackbox Create multiple viewport from multiple rectangle in model space-from hmsilva The main difference I want to change below is to select all of my objects, instead of being prompted to select a single object, (defun c:BNDBX (/ eName mn mx) (vl-load-com) (if (setq eName (car (entsel "\n >> Select Object >> "))) (progn (vla-getboundingbox (vlax-ename->vla-object eName) 'mn 'mx) (vl-cmdf "._rectang" (vlax-safearray->list mn) (vlax-safearray->list mx)))) (princ) ) ) I have tried inserting (if (setq eName (ssget "_x" '((0 . "INSERT") (2 . "PageView")))) on the 3rd line with no success. Eventually I would like to have the second code produce layouts in order. But I figured I would get this chunk sorted first.
  24. Hi, I've written this code which draws triangles on the inside or outside of a polyline (with multiple vertexes), but it gives increasingly better/worse results depending on the zoom level (better results are obtained with higher zoom). The zoom levels I'm talking about are such that when the polyline occupies the whole screen it does work with some errors, if you reduce the zoom then it does not work, and when you increase the zoom it works perfectly. It probably depends on the relative size of the triangles (which are user inputs) to the zoom level. Is there a way to correct this behavior? (defun c:vert (/ obj1 oft wid spa ip obj2 len l1 l2 sp pt1 pt2 ptm slopeP slopeM ptt1 ptt2 pttR pttL ptt pss it) (vl-load-com) (setq obj1 (ssget C) oft (float (getreal "Triangle height: ")) wid (float (getreal "Triangle width: ")) spa (float (getreal "Distance between triangles: ")) ) (setq ip (strcase (getstring "R(ight) or L(eft): "))) (setq obj2 (vlax-ename->vla-object (ssname obj1 0)) len (vlax-get-property obj2 "length") l1 (float 0) l2 (float wid) ) (while (< l1 len) (setq sp (vlax-curve-getPointAtDist obj2 0) pt1 (vlax-curve-getPointAtDist obj2 l1) pt2 (vlax-curve-getPointAtDist obj2 l2) ptm (vlax-curve-getPointAtDist obj2 (/ (+ l1 l2) 2)) slopeP (+ (if (= (car pt2) (car pt1)) (/ pi 2) (atan (/ (- (nth 1 pt2) (nth 1 pt1)) (- (nth 0 pt2) (nth 0 pt1))))) (/ pi 2)) slopeM (- (if (= (car pt2) (car pt1)) (/ pi 2) (atan (/ (- (nth 1 pt2) (nth 1 pt1)) (- (nth 0 pt2) (nth 0 pt1))))) (/ pi 2)) ptt1 (list (+ (nth 0 ptm) (* oft (cos slopeP))) (+ (nth 1 ptm) (* oft (sin slopeP)))) ptt2 (list (+ (nth 0 ptm) (* oft (cos slopeM))) (+ (nth 1 ptm) (* oft (sin slopeM)))) pttR (if (< (- (* (- (nth 0 pt2) (nth 0 pt1)) (- (nth 1 ptt1) (nth 1 pt1))) (* (- (nth 0 ptt1) (nth 0 pt1)) (- (nth 1 pt2) (nth 1 pt1)))) 0) ptt1 ptt2) pttL (if (> (- (* (- (nth 0 pt2) (nth 0 pt1)) (- (nth 1 ptt1) (nth 1 pt1))) (* (- (nth 0 ptt1) (nth 0 pt1)) (- (nth 1 pt2) (nth 1 pt1)))) 0) ptt1 ptt2) ptt (if (= ip "R") pttR pttL) ) (command "_.pline" pt1 ptt pt2 "") (setq l1 (float (+ l1 wid spa)) l2 (float (+ l2 spa wid)) ) ) )
  25. hello everybody , hope u all are great ... i have this lisp to get sum of some texts in autocad by choosing them one by one , but instead i wanna select those texts in one time by one selection click for them all ... i really appreciate ur help thanks in advance ;; wrriten by dlanorh from cadtutor (defun rh:em_txt ( pt txt lyr sty tht xsf) (entmakex (list '(0 . "TEXT") '(100 . "AcDbEntity") '(100 . "AcDbText") (cons 10 pt) (cons 1 txt) (if lyr (cons 8 lyr)) (if sty (cons 7 sty)) (if tht (cons 40 tht)) (if xsf (cons 41 xsf)) );end_list );end_entmakex );end_defun (vl-load-com) (defun c:t+ ( / *error* sv_lst sv_vals ent elst el num xsf ans tot qflg nlst sel pt txt) (defun *error* ( msg ) (mapcar 'setvar sv_lst sv_vals) (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nAn Error : " msg " occurred."))) (princ) );end_defun (setq sv_lst (list 'cmdecho 'osmode 'dynmode 'dynprompt) sv_vals (mapcar 'getvar sv_lst) );end_setq (mapcar 'setvar sv_lst '(0 0 3 1)) (while (not tot) (setq el (entget (setq ent (car (entsel "\Select First Text Number Entity : "))))) (cond ( (wcmatch (cdr (assoc 0 el)) "*TEXT") (cond ( (= (cdr (assoc 0 el)) "TEXT") (setq num (atof (getpropertyvalue ent "TextString")) xsf (cdr (assoc 41 el)))) (t (setq num (atof (getpropertyvalue ent "Text")) xsf 1.0)) );end_cond (cond ( (zerop num) (setq num nil) (alert "Text Entity NOT a number")) (t (setq tot num))) ) (t (alert "Not a Text Entity")) );end_cond (cond (num (setq nlst (cons ent nlst)))) );end_while (while (not qflg) (setq sel (entsel "\nSelect Next Text Number Entity : ")) (cond ( (not sel) (initget "Yes No") (setq ans (cond ( (getkword "\nSelection Finished [Yes/No] <No>")) ("No"))) (if (= ans "Yes") (setq qflg T)) ) );end_cond (cond ( (and (not qflg) sel) (setq elst (entget (setq ent (car sel)))) (cond ( (and (wcmatch (cdr (assoc 0 elst)) "*TEXT") (not (vl-position ent nlst))) (cond ( (= (cdr (assoc 0 elst)) "TEXT") (setq num (atof (getpropertyvalue ent "TextString")))) (t (setq num (atof (getpropertyvalue ent "Text")))) );end_cond (cond ( (zerop num) (setq num nil) (alert "Text Entity NOT a number"))) ) ( (vl-position ent nlst) (alert "Already Selected") (setq num nil)) (t (alert "Not a Text Entity")) );end_cond (if num (setq tot (+ tot num) nlst (cons ent nlst) num nil)) ) );end_cond );end_while (cond ( (and tot qflg) (setq pt (getpoint "\nSelect Total Insertion Point : ") txt (if (zerop (rem tot 1.0)) (rtos tot 2 0) (rtos tot 2 3)) );end_setq (rh:em_txt pt txt (cdr (assoc 8 el)) (cdr (assoc 7 el)) (cdr (assoc 40 el)) xsf) (if nlst (foreach o (mapcar 'vlax-ename->vla-object nlst) (vla-delete o))) ) );end_cond (mapcar 'setvar sv_lst sv_vals) (princ) );end_defun
×
×
  • Create New...