Jump to content

Search the Community

Showing results for tags 'lisp'.

  • 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 guys, I've been trying to figure out a way to insert a new block in a project that already has one with the same name. I would like to have something asking me if I want to keep the old one or replace/overwrite with the new one. Keeping the placement of the old block in the project. I know that AutoCAD keeps the old version on a block if it has the same name as the new one, having to remove all instance of the block and purge all. Why wouldn't AutoCAD asked me ; [There is a block with the same name in your project, Would you like to; Overwrite, Rename, Cancel] Just like in file explorer on desktop. Anyway, maybe I'm asking to much let me know guys if you have a suggestion, either a LISP or a command that I'm not aware of yet in AutoCAD.. Thanks
  2. Hi guys, Im new here and i've been searching and even asking chatgpt to help me out but it doesnt seem to work properly. Im working on a SLD (Single Line Diagram) for an electrical project and when wires cross on the diagram, it needs to have a gap on one of the 2 lines. I've tried this lisp command that ChatGPT gave me but with little to no success; (defun c:BreakAndShorten ( / pt line break_length startpt1 endpt1 startpt2 endpt2) (setq break_length 2.5) ; Set your desired shorten length here (2.5 mm in this case) (setq line (car (entsel "\nSelect the line to break: "))) (setq pt (getpoint "\nSelect the break point: ")) (if (and line pt) (progn (setq startpt1 (polar pt (angle pt (vlax-curve-getStartPoint line)) (- break_length))) (setq endpt1 pt) (setq startpt2 pt) (setq endpt2 (polar pt (angle pt (vlax-curve-getEndPoint line)) break_length)) (command "BREAK" line startpt1 endpt2) (setq line1 (car (entsel "\nSelect the first segment to shorten: "))) (setq line2 (car (entsel "\nSelect the second segment to shorten: "))) (if line1 (command "LENGTHEN" "DE" (- break_length) line1)) (if line2 (command "LENGTHEN" "DE" (- break_length) line2)) ) (alert "You must select a line and a break point.") ) (princ) ) In sum, I want to break one line at a point and then shorten the 2 segments by 2.5mm so it has a 5mm gap without using multiple command everytime
  3. Hello, I am searching for a lisp that can export the lengths of all selected polylines and export them to either Excel or an AutoCad table. I have found and tested around 20 lisps but so far cannot find the right one. There were only 2 that look promising, maybe they could be modified? One was by Lee Mac and the other Jimmy Bergmark. I can post the 2 Lisp if needed. The lisp would need to have you select multiple polylines and give the total lengths of each polyline in the order that they were selected in. Then the data would either appear on an AutoCad table or Excel. Thanks for any help that can be provided.
  4. Hi, i have multiple polylines in a series and block are placed on them. i want to select the polylines between two selected blocks. sample file is attached. Thanks, Srikanth select_between _two_blocks_sample.dwg
  5. I am looking for a routine to sort contour lines. I am using 3d polylines that I import from Global Mapper. My problem is all of the lines are on one layer. Ideally, I would like to pick a starting elevation (polyline) and have the routine select every 5th contour up and down. Once then are all selected, I can move them to a new layer (like TOPO-INDEX). Some of these sites are hundreds of acres and have significant elevation changes. To do this by hand is VERY time-consuming (and easy to miss some contours). I am not a programmer, but this seems like the type of task that is ideal for a lisp routine. Any help is appreciated.
  6. 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.
  7. Hello everyone, I'm wondering if it is possible to create a lisp that could attach several images to AutoCAD 2010 at the same time and create a new layer that has the same name like an image for each image. I downloaded georefimg app that put an image in certain place in AutoCAD based on world file but it is necessary to do this for each image separately. In case of this app first thing to do is attach one image to CAD and afterwards I can use georefimg to choose an image (that was inserted before) in order to put this in proper section. But it could be faster and more efficient if I would attach many images equally in random place and after that use this georefimg for all images. If someone has some idea how to prepare sth like this I'll be grateful for any suggestions in this case. Best wishes, Jakub
  8. Shib Sankar

    Batch blocking

    Can anyone help me to write a code ?? Which Identifies each closed polyline (rectangle) on the "ss-bor" layer. Finds the text entity (content) of text on the "ss-pre" layer which is within (rectangle) on the "ss-bor" layer . Selects all entities on the "ss-part" layer within the (rectangle) on the "ss-bor" layer. Creates a block using the text value from the "ss-pre" layer as the block name, including all selected entities from the "ss-part" layer within the (rectangle) on the "ss-bor" layer. and loop though each (rectangle) on the "ss-bor" layer and make block of each as above mentioned.. For information i have attached my dwg file G27.dwg
  9. Can someone help me out with changing the attributes of a block using a list. The block is used in a leader. The block has 7 attributes, but my list doesn't always contain 7 variables. I have tried to implement Lee Mac's code dynamicblockfunctions, but I keep getting the error "too few arguments". I would like to import the leader when the calculation is done, and for the block to then automatically change the attributes to the variables in the list. Here's my current code: (defun c:testKRIS ( / *error* dch dcl des mv d1 d2 d3 d4 d5 d6) (defun *error* ( msg ) (if (and (= 'int (type dch)) (< 0 dch)) (unload_dialog dch) ) (if (= 'file (type des)) (close des) ) (if (and (= 'str (type dcl)) (findfile dcl)) (vl-file-delete dcl) ) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg)) ) (princ) ) (cond ( (not (setq dcl (vl-filename-mktemp nil nil ".dcl") des (open dcl "w") ) ) (princ "\nUnable to open DCL for writing.") ) ( (progn (foreach str '( "ed : edit_box" "{" " alignment = left;" " width = 20;" " edit_width = 10;" " fixed_width = true;" "}" "" "test : dialog" "{" " spacer;" " key = \"dcl\";" " : ed" " {" " key = \"mv\";" " label = \"MV:\";" " }" " :boxed_column { " " label = \"Diepte vd buizen\";" " :row {" " : ed" " {" " key = \"d1\";" " label = \"A:\";" " }" " : ed" " {" " key = \"d4\";" " label = \"X:\";" " }}" " :row {" " : ed" " {" " key = \"d2\";" " label = \"B:\";" " }" " : ed" " {" " key = \"d5\";" " label = \"Y:\";" " }}" " :row {" " : ed" " {" " key = \"d3\";" " label = \"C:\";" " }" " : ed" " {" " key = \"d6\";" " label = \"Z:\";" " }}" " }" " : boxed_row" " { " " label = \"BOK berekeningen\";" " :column {" " : ed { key = \"res\"; label = \"BOK:\"; is_enabled = false; }" " : ed { key = \"res2\"; label = \"BOK2:\"; is_enabled = false; }" " : ed { key = \"res3\"; label = \"BOK3:\"; is_enabled = false; }" " }" " :column{" " : ed { key = \"res4\"; label = \"BOK4:\"; is_enabled = false; }" " : ed { key = \"res5\"; label = \"BOK5:\"; is_enabled = false; }" " : ed { key = \"res6\"; label = \"BOK6:\"; is_enabled = false; }" " }" " }" " : button" " {" " key = \"cal\";" " label = \"Calculate\";" " }" " spacer;" " ok_only;" "}" ) (write-line str des) ) (setq des (close des) dch (load_dialog dcl) ) (<= dch 0) ) (princ "\nUnable to load DCL file.") ) ( (not (new_dialog "test" dch)) (princ "\nUnable to display 'test' dialog.") ) ( t (set_tile "dcl" "Calculate Area") (action_tile "mv" "(setq mv $value)") (action_tile "d1" "(setq d1 $value)") (action_tile "d2" "(setq d2 $value)") (action_tile "d3" "(setq d3 $value)") (action_tile "d4" "(setq d4 $value)") (action_tile "d5" "(setq d5 $value)") (action_tile "d6" "(setq d6 $value)") (action_tile "cal" (vl-prin1-to-string '( (lambda ( / m x y z a b c lijst_results ) (setq lijst_results '()) (set_tile "res" "") (set_tile "res2" "") (set_tile "res3" "") (set_tile "res4" "") (set_tile "res5" "") (set_tile "res6" "") (setq m (distof mv)) (if m (progn (setq lijst_results (append lijst_results (list (strcat "mv: " (rtos m 2 2))))) (if (and d1 (setq a (distof d1))) (progn (setq lijst_results (append lijst_results (list (strcat "A: " (rtos (- m a) 2 2))))) (set_tile "res" (rtos (- m a) 2 2)))) (if (and d2 (setq b (distof d2))) (progn (setq lijst_results (append lijst_results (list (strcat "B: " (rtos (- m b) 2 2))))) (set_tile "res2" (rtos (- m b) 2 2)))) (if (and d3 (setq c (distof d3))) (progn (setq lijst_results (append lijst_results (list (strcat "C: " (rtos (- m c) 2 2))))) (set_tile "res3" (rtos (- m c) 2 2)))) (if (and d4 (setq x (distof d4))) (progn (setq lijst_results (append lijst_results (list (strcat "X: " (rtos (- m x) 2 2))))) (set_tile "res4" (rtos (- m x) 2 2)))) (if (and d5 (setq y (distof d5))) (progn (setq lijst_results (append lijst_results (list (strcat "Y: " (rtos (- m y) 2 2))))) (set_tile "res5" (rtos (- m y) 2 2)))) (if (and d6 (setq z (distof d6))) (progn (setq lijst_results (append lijst_results (list (strcat "Z: " (rtos (- m z) 2 2))))) (set_tile "res6" (rtos (- m z) 2 2)))) (print lijst_results) ) (alert "Vul maaiveld waarden in.") ) ) ) ) ) (start_dialog) ) ) (*error* nil) (princ) )
  10. I want to change the values of a dynamic block within a lisp. This lisp contains a calculation. I used .dcl for this. My dynamic block has 7 attributes: maaiveld, HOOGTE1, HOOGTE2, HOOGTE3, HOOGTE4, HOOGTE5 and HOOGTE6. My lisp code has 7 values: m, a, b, c, x, y and z The order of these outputs are important. a, b, and c are sewer pipes that arrive in the cewer, and x, y, and z are pipes that depart from the sewer pit. So if there are only 2 pipes, we only have to use a and x. This makes it difficult. I can't just set HOOGTE1 to a, HOOGTE2 to b, HOOGTE3 to c, etc. If I do it this way, it will leave a gap in my leader. I hope this is even possible. I provided some screenshots of my calculator and of the leader, and the problem of the gap. Maybe I just need to create a more complex dynamic block, so that I can just connect the hoogte1,2,3,... to a,b,c,... I really don't know. code: (defun c:testKRIS ( / *error* dch dcl des mv d1 d2 d3 d4 d5 d6) (defun *error* ( msg ) (if (and (= 'int (type dch)) (< 0 dch)) (unload_dialog dch) ) (if (= 'file (type des)) (close des) ) (if (and (= 'str (type dcl)) (findfile dcl)) (vl-file-delete dcl) ) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg)) ) (princ) ) (cond ( (not (setq dcl (vl-filename-mktemp nil nil ".dcl") des (open dcl "w") ) ) (princ "\nUnable to open DCL for writing.") ) ( (progn (foreach str '( "ed : edit_box" "{" " alignment = left;" " width = 20;" " edit_width = 10;" " fixed_width = true;" "}" "" "test : dialog" "{" " spacer;" " key = \"dcl\";" " : ed" " {" " key = \"mv\";" " label = \"MV:\";" " }" " :boxed_column { " " label = \"Diepte vd buizen\";" " :row {" " : ed" " {" " key = \"d1\";" " label = \"A:\";" " }" " : ed" " {" " key = \"d4\";" " label = \"X:\";" " }}" " :row {" " : ed" " {" " key = \"d2\";" " label = \"B:\";" " }" " : ed" " {" " key = \"d5\";" " label = \"Y:\";" " }}" " :row {" " : ed" " {" " key = \"d3\";" " label = \"C:\";" " }" " : ed" " {" " key = \"d6\";" " label = \"Z:\";" " }}" " }" " : boxed_row" " { " " label = \"BOK berekeningen\";" " :column {" " : ed { key = \"res\"; label = \"BOK:\"; is_enabled = false; }" " : ed { key = \"res2\"; label = \"BOK2:\"; is_enabled = false; }" " : ed { key = \"res3\"; label = \"BOK3:\"; is_enabled = false; }" " }" " :column{" " : ed { key = \"res4\"; label = \"BOK4:\"; is_enabled = false; }" " : ed { key = \"res5\"; label = \"BOK5:\"; is_enabled = false; }" " : ed { key = \"res6\"; label = \"BOK6:\"; is_enabled = false; }" " }" " }" " : button" " {" " key = \"cal\";" " label = \"Calculate\";" " }" " spacer;" " ok_only;" "}" ) (write-line str des) ) (setq des (close des) dch (load_dialog dcl) ) (<= dch 0) ) (princ "\nUnable to load DCL file.") ) ( (not (new_dialog "test" dch)) (princ "\nUnable to display 'test' dialog.") ) ( t (set_tile "dcl" "Calculate Area") (action_tile "mv" "(setq mv $value)") (action_tile "d1" "(setq d1 $value)") (action_tile "d2" "(setq d2 $value)") (action_tile "d3" "(setq d3 $value)") (action_tile "d4" "(setq d4 $value)") (action_tile "d5" "(setq d5 $value)") (action_tile "d6" "(setq d6 $value)") (action_tile "cal" (vl-prin1-to-string '( (lambda ( / m x y z a b c ) (set_tile "res" "") (set_tile "res2" "") (set_tile "res3" "") (set_tile "res4" "") (set_tile "res5" "") (set_tile "res6" "") (cond ( (or (not mv) (= "" mv)) (alert "Please enter a maaiveld value.") (mode_tile "mv" 2) ) ( (or (not d1) (= "" d1)) (alert "Please enter a A value.") (mode_tile "d1" 2) ) ( (or (not d2) (= "" d2)) (alert "Please enter a B value.") (mode_tile "d2" 2) ) ( (or (not d3) (= "" d3)) (alert "Please enter a C value.") (mode_tile "d3" 2) ) ( (or (not d4) (= "" d4)) (alert "Please enter a X value.") (mode_tile "d4" 2) ) ( (or (not d5) (= "" d5)) (alert "Please enter a Y value.") (mode_tile "d5" 2) ) ( (or (not d6) (= "" d6)) (alert "Please enter a Z value.") (mode_tile "d6" 2) ) ( (not (setq m (distof mv))) (alert "Het Maaiveld moet een getal zijn.") (mode_tile "mv" 2) ) ( (not (setq a (distof d1))) (alert "The A must be numerical.") (mode_tile "d1" 2) ) ( (not (setq b (distof d2))) (alert "The B must be numerical.") (mode_tile "d2" 2) ) ( (not (setq c (distof d3))) (alert "Het C moet een getal zijn.") (mode_tile "d3" 2) ) ( (not (setq x (distof d4))) (alert "The X must be numerical.") (mode_tile "d4" 2) ) ( (not (setq y (distof d5))) (alert "The Y must be numerical.") (mode_tile "d5" 2) ) ( (not (setq z (distof d6))) (alert "The Z must be numerical.") (mode_tile "d6" 2) ) ( (<= m 0.0) (alert "Het maaiveld moet groter dan nul zijn.") (mode_tile "mv" 2) ) ( (<= a 0.0) (alert "The A must be greater than zero.") (mode_tile "d1" 2) ) ( (<= b 0.0) (alert "The B must be greater than zero.") (mode_tile "d2" 2) ) ( (<= c 0.0) (alert "Het C moet groter dan nul zijn.") (mode_tile "d3" 2) ) ( (<= x 0.0) (alert "The X must be greater than zero.") (mode_tile "d4" 2) ) ( (<= y 0.0) (alert "The Y must be greater than zero.") (mode_tile "d5" 2) ) ( (<= z 0.0) (alert "The Z must be greater than zero.") (mode_tile "d6" 2) ) (t (set_tile "res" (rtos (- m a) 2)) (set_tile "res2" (rtos (- m b) 2)) (set_tile "res3" (rtos (- m c) 2)) (set_tile "res4" (rtos (- m x) 2)) (set_tile "res5" (rtos (- m y) 2)) (set_tile "res6" (rtos (- m z) 2)) ) ) ) ) ) ) (start_dialog) ) ) (*error* nil) (princ) ) The code needs work to be visually better, but I want it to work before I do that.
  11. Guys, I need one help, someone knows one Lisp that I can get Texts (words) on AutoCad and export it in order of selection to a cell on Excel... Eg.: If I have 10 words, as I'll selecting it and when finished these then words will be exported to a cell (could be cels) to Excel. Thanks in advance...
  12. I'm almost there with my workflow, but I need a little help to get it just right. Here's what I'm trying to do: Type command Select block Pick Mleader arrow location Pick Mleader landing location Mleader content should automatically populate with the "SW_LENGTH" parameter from the block Everything works great up until step 5. After I pick both Mleader points, the Mleader text box opens for me to fill out (it's blank). But if I click in the drawing area, it exits the text box and fills in the correct info. So, how do I skip that last step and have the Mleader content fill in automatically without Autocad opening the text edit box? ;; Get Dynamic Block Property Value - Lee Mac ;; Returns the value of a Dynamic Block property (if present) ;; blk - [vla] VLA Dynamic Block Reference object ;; prp - [str] Dynamic Block property name (case-insensitive) (defun LM:getdynpropvalue (blk prp) (setq prp (strcase prp)) (vl-some '(lambda (x) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'Value))) (vlax-invoke blk 'GetDynamicBlockProperties))) (defun c:swtest () (setq blockName (car (entsel "\nSelect Block: "))) (if (and blockName (eq (cdr (assoc 0 (entget blockName))) "INSERT")) (progn (setq vlaBlock (vlax-ename->vla-object blockName)) (setq SW_LENGTH (LM:getdynpropvalue vlaBlock "SW_LENGTH")) (if SW_LENGTH (progn (setq textString (strcat "SW_LENGTH: " (rtos SW_LENGTH 2 2))) (princ (strcat "\n" textString)) (if (setq ins (getpoint "\nSpecify start point for MLeader: ")) (progn (setq endPoint (getpoint "\nSpecify end point for MLeader: " ins)) (setq curlay (getvar "CLAYER")) (setvar 'CMDECHO 0) (command "_.undo" "_group") (setvar 'CLAYER "S - TEXT") (command "CMLEADERSTYLE" "NORMAL - SW") (setvar 'CMDECHO 1) (initcommandversion) (command ".MLeader" ins endPoint "") (while (> (getvar "CMDACTIVE") 0) (command PAUSE)) (setq mleaderObj (vlax-ename->vla-object (entlast))) (vla-put-TextString mleaderObj textString) (setvar 'CMDECHO 0) (command "CMLEADERSTYLE" "Normal") (command "_.LAYER" "_SET" curlay "") (command "_.undo" "_end") (setvar 'CMDECHO 1) (princ "MLeader with SW_LENGTH created.")) (alert "Insertion point not specified!"))) (alert "SW_LENGTH attribute not found!"))) (alert "Selected entity is not a block!")) (princ))
  13. Our surveyors have asked me to create a calculation interface. I wanted to create a lisp program with an interface where the surveyors could input their measurements. They typically measure the ground level of a sewer pit and then the depth of the sewer pipes. To get the level of the sewer pipes, they subtract the ground level from their measurements. However, I have some difficulties getting the interface to function. I came across code by Lee Mac and attempted to build upon it. My code is half in Dutch, 'MV' stands for Ground Level. I've attached a screenshot of my current progress. The issue is that the second calculation isn't being displayed. I would also want my outputs to have 2 decimals. lisp code: (defun c:test ( / *error* dch dcl des mv wid diepte) (defun *error* ( msg ) (if (and (= 'int (type dch)) (< 0 dch)) (unload_dialog dch) ) (if (= 'file (type des)) (close des) ) (if (and (= 'str (type dcl)) (findfile dcl)) (vl-file-delete dcl) ) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg)) ) (princ) ) (cond ( (not (setq dcl (vl-filename-mktemp nil nil ".dcl") des (open dcl "w") ) ) (princ "\nUnable to open DCL for writing.") ) ( (progn (foreach str '( "ed : edit_box" "{" " alignment = left;" " width = 20;" " edit_width = 10;" " fixed_width = true;" "}" "" "test : dialog" "{" " spacer;" " key = \"dcl\";" " : ed" " {" " key = \"mv\";" " label = \"MV:\";" " }" " : ed" " {" " key = \"wid\";" " label = \"Width:\";" " }" " : ed" " {" " key = \"diepte\";" " label = \"A:\";" " }" " : row" " {" " : ed { key = \"res\"; label = \"BOK:\"; is_enabled = false; }" " : ed { key = \"res2\"; label = \"BOK2:\"; is_enabled = false; }" " : button" " {" " key = \"cal\";" " label = \"Calculate\";" " }" " }" " spacer;" " ok_only;" "}" ) (write-line str des) ) (setq des (close des) dch (load_dialog dcl) ) (<= dch 0) ) (princ "\nUnable to load DCL file.") ) ( (not (new_dialog "test" dch)) (princ "\nUnable to display 'test' dialog.") ) ( t (set_tile "dcl" "Calculate Area") (action_tile "mv" "(setq mv $value)") (action_tile "wid" "(setq wid $value)") (action_tile "diepte" "(setq diepte $value)") (action_tile "cal" (vl-prin1-to-string '( (lambda ( / x y z) (set_tile "res" "") (set_tile "res2" "") (cond ( (or (not mv) (= "" mv)) (alert "Please enter a maaiveld value.") (mode_tile "mv" 2) ) ( (or (not wid) (= "" wid)) (alert "Please enter a width value.") (mode_tile "wid" 2) ) ( (or (not diepte) (= "" diepte)) (alert "Please enter a a value.") (mode_tile "diepte" 2) ) ( (not (setq x (distof mv))) (alert "Het Maaiveld moet een getal zijn.") (mode_tile "mv" 2) ) ( (not (setq y (distof wid))) (alert "The width must be numerical.") (mode_tile "wid" 2) ) ( (not (setq z (distof diepte))) (alert "The diepte must be numerical.") (mode_tile "diepte" 2) ) ( (<= x 0.0) (alert "Het maaiveld moet groter dan nul zijn.") (mode_tile "mv" 2) ) ( (<= y 0.0) (alert "The width must be greater than zero.") (mode_tile "wid" 2) ) ( (<= z 0.0) (alert "The width must be greater than zero.") (mode_tile "diepte" 2) ) ( (set_tile "res" (rtos (- x y) 2))) ( (set_tile "res2" (rtos (- x z) 2))) ) ) ) ) ) (start_dialog) ) ) (*error* nil) (princ) ) If I manage to fix this then I will try to make a leader with the outputs.
  14. Hello all, I should get the following code changed so that you can select the blocks you want to 'undynamic" first. Can somebody help me? (defun c:UnDynamic ( / _get_item _right _make_key _dynamic->static_block _get_locked _get_dynamic_inserts _main ) (defun _get_item ( collection key / item ) (vl-catch-all-apply '(lambda ( ) (setq item (vla-item collection key))) ) item ) (defun _right ( str n / len ) (if (< n (setq len (strlen str))) (substr str (1+ (- len n))) str ) ) (defun _make_key ( collection prefix len / key ) ( (lambda ( i pad ) (while (_get_item collection (setq key (strcat prefix (_right (strcat pad (itoa (setq i (1+ i)))) len ) ) ) ) ) key ) 0 ( (lambda ( pad ) (while (< (strlen pad) len) (setq pad (strcat "0" pad)) ) pad ) "" ) ) ) (defun _dynamic->static_block ( blocks insert len ) (vla-ConvertToStaticBlock insert (_make_key blocks (strcat (vla-get-EffectiveName insert) "_00") len) ) ) (defun _get_locked ( layers / locked ) (vlax-for layer layers (if (eq :vlax-true (vla-get-lock layer)) (setq locked (cons layer locked)) ) ) locked ) (defun _get_dynamic_inserts ( blocks / inserts ) (vlax-for block blocks (vlax-for object block (if (eq "AcDbBlockReference" (vla-get-objectname object)) (if (eq :vlax-true (vla-get-isdynamicblock object)) (setq inserts (cons object inserts)) ) ) ) ) inserts ) (defun _main ( document / blocks inserts locked len ) (if (setq inserts (_get_dynamic_inserts (setq blocks (vla-get-blocks document)) ) ) (progn (foreach layer (setq locked (_get_locked (vla-get-layers document))) (vla-put-lock layer :vlax-false) ) (setq len (strlen (itoa (length inserts)))) (foreach insert inserts (_dynamic->static_block blocks insert len) ) (foreach layer locked (vla-put-lock layer :vlax-true) ) ) ) (princ) ) (_main (vla-get-activedocument (vlax-get-acad-object))) ) Credits to TP from theswamp.org. Thanks, Martin.
  15. Hi everyone, I need to modify some options in the "Automatic Publish" submenu through a lisp or if not possible through a script, in detail I should modify the "Type" section from the "Multi-sheet" file to "Single-sheet file" and vice versa does anyone know if it's possible? Many thanks in advance
  16. Hi experts , good morning and happy good fryday. Hope you're doing well, I'm looking for a lisp routine which can generate blocks considering some logic.. i have attached a AutoCAD.dwg file pls help.. LISP MAKING.dwg
  17. Hey guys! How's going? Can anyone help me? Look: i need to place a lot of blocks in an extensive polyline but the blocks need to have a specific distance from the polyline beginning - and this distance will not be equal to each block. So, i thought in create a list (excel or csv file) and specify each block name and distance to the lisp read the archive and place the block at correct point. Did you get it? PS: remember that the blocks will not have the same interval distance. This is an example for the list layout. And the result is something like this: I hope you guys could understand and help me! - sorry for my english - Thanks! Much love from Brazil Wellington Moura
  18. I am a CAD Drafter and Land Surveyor and one of my main job is to plot my surveyed poles. However the standard is to have all the poles perpendicular to the road or to a polyline. Is there a lisp to do that? Here is a sample of what I am doing. The top most pole is what It should look like. I have around 1000 poles to rotate perpendicular and is time consuming. Can anyone help me.
  19. I am quite busy, of course, like everyone, I have loads of work needing to get done so I thought I would make this quick post. Hopefully someone with the available time can help out! I basically need a simple routine to change colors from our old standards to our new standards. I am sure it is most likely the simplest routine but if someone could post one and save me a little bit of time I would appreciate it. An example would be layer: TEXT, which with our old standards for 30+ years has been the 'GREEN', we have now changed that and are using color '104' which is more of a turtle green, anyways thats what the boss wants so that's what the boss gets. Currently when we open a drawing that was drawn, say, 10 years ago, it has all of our old layers and their respective old colors. I just need a lisp that would run every time we open a drawing for editing or revisions that would automatically search for the layers and change their properties (colors)..
  20. Do anyone have similar program?? I have attached the vlx file also its showing trail expired.. CPP-Ver2 - Type Region (Gap input)-2023 (1).VLX
  21. hi , this lisp is modified to calculate the quantity of steel bars as it placed on the plan of reinforcement in the form shown on the attached cad file named : steel.dwg lisp name and command : steel hope you joy it . and step by step together we improve it to fit what we want to do. steel.dwg steel.LSP
  22. This lisp can only run with CAD 2007, please edit it to run with higher generation AutoCAD (2021..). thanks chialo.lsp
  23. (defun c:deleteCirclesByDiameter () (setq f 0.5000) (setq ss (ssget "_X" '((0 . "CIRCLE")))) (if ss (progn (setq index 0) (repeat (sslength ss) (setq ent (ssname ss index)) (if ent (progn (setq diameter (cdr (assoc 40 (entget ent)))) (setq dia (* diameter 2)) (prompt (strcat "\nCircle: " (itoa (1+ index)) ", Diameter: " (rtos dia 2 4))) (if (and (> x f) (< dia x) (not (= dia 0.6875 x 0.75)) (not (= dia 0.6880 x 0.75))) (progn (entdel ent) (prompt (strcat "\nDeleted Circle: " (itoa (1+ index)) ", Diameter: " (rtos dia 2 4) ", Thickness: " (rtos x 2 4))) ) (progn (entdel ent) (prompt (strcat "\nDeleted Circle: " (itoa (1+ index)) ", Diameter: " (rtos dia 2 4) ", Thickness: " (rtos x 2 4))) ) ) (progn (entdel ent) (prompt (strcat "\nDeleted Circle: " (itoa (1+ index)) ", Diameter: " (rtos dia 2 4))) ) ) ) (setq index (1+ index)) ) ) ) (prompt "\nCircles with diameter less than x have been deleted.") ) (prompt "\nNo circles found in the drawing.") ) (princ) ) In this code, help me to fix my mistakes in if conditions..
  24. Hello Everyone, We are looking for a lisp that will delete objects on every layout in a drawing. I have seen a lisp that will delete objects of the same type and layer on every layout, but unfortunately that doesn't give us enough descriptiveness to only delete the objects we need to delete. The location of the objects we want to delete will be the same on every layout, so ideally the lisp will be able to take a selection window on one layout, and delete all the objects within that window location on every layout. If it is easier for coding purposes, we could even draw a box with lines/polylines on one layout and use that to define the selection window for all the other layouts, and then just delete the box at the end from the one layout. If anyone has any ideas, or if any more information would be helpful, please let me know! Thank you all, - Noah
  25. Explanation: To clean up consultant drawings I explode everything multiple times, move all objects to 0 layer, change all properties to By Layer (or equivalent), and purge the file. Then I Ctrl+Shift+C to select base point and in my file Ctrl-Shift+V to create a clean block that serves as the base for our drawings. Goal: LISP that does all the cleaning! Including: 1. Explode everything multiple times 2. Select everything in file and layer --> 0 color -->By Layer linetype --> By Layer lineweight --> By Layer 3. Purge everything (to be left with only 0 layer) I've found bits and pieces in different posts, but I am hoping to get some more comprehensive help. Thank you for your time, in advance!
×
×
  • Create New...