Jump to content

Search the Community

Showing results for tags 'leemac'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...

Found 13 results

  1. 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.
  2. Hi Everyone, I am trying to create an AutoLISP that will replace and/or automatically update an MText field (which in my case are the amendments for a drawing) in the Layouts tab for a series of drawings. The Lisp uses Lee Mac's Object DBX Wrapper and his get files routines (Thank you btw :)) to obtain the drawings and supply the function to each drawing. I am pretty new to Visual Lisps and only understand the basic functions like the vla-get-<item>. I am able to update the first drawing/opened drawing, however cannot seem to get the lisp to loop for each drawing selected. I suspect that it has something to do with vlax-for function but i do not completely understand it, especially when multiple drawings are being evaluated. Autolisp Code: ;--------------------------------EDIT BOX SAVE VARIABLES-----------------------------------; (Defun saveVars () (setq Date (get_tile "Date")) (setq Initials (get_tile "Initials")) (setq Subject (get_tile "Subject")) (setq Rev1 (atoi (get_tile "Rev1"))) (setq Prelim (atoi (get_tile "Prelim"))) (setq Tender (atoi (get_tile "Tender"))) ) ;-------------------------------------LOAD FILES------------------------------------------; (defun LoadFiles (a) (cond ((= a 1) (setq flst (LM:getfiles "select Drawings" nil "dwg"))) ) ) ;-----------------------------EDIT BOX LOAD AND FUNCTIONS----------------------------------; (defun C:Editbox ( ) (vl-load-com) (if (not (setq dcl_id (load_dialog "DCL_DCL_Editbox.dcl"))) (progn (alert "The DCL file could not be loaded.") (exit) ) (progn (if (not (new_dialog "DCL_Editbox" dcl_id)) (progn (alert "The DCL_DCL_Editbox could not be found inside the DCL file") (exit) ) (progn (action_tile "but1" "(LoadFiles 1)") (action_tile "accept" "(saveVars) (done_dialog 2)") (action_tile "cancel" "(done_dialog 1)") (setq ddiag (start_dialog)) (unload_dialog dcl_id) (if (= ddiag 1) (progn (print "Editbox cancelled!") (exit) ) ) (if (and (= ddiag 2) (and (= prelim 1) (= tender 1))) (exit) (LM:ODBX 'SC:T2 flst t) ) ) ) ) ) (princ) ) ;--------------------------------REWRITE AMENDMENTS FUNCTION-----------------------------------; (defun SC:T2 ( doc / ss1 lst2 lst RstrP StrPP RevNP RstrT StrPT RevNT) (vl-load-com) (vlax-for layout (vla-get-layouts doc) (vlax-for object (vlax-get (vla-get-activedocument (vlax-get-acad-object)) 'PaperSpace ) (if (= "AcDbMText" (vla-get-objectname object)) (setq lst (cons object lst)) ) (setq lst2 (car lst)) ) lst (setq ss1 (vlax-get-property lst2 'Textstring)) (progn (cond ((and (= rev1 1) (= Prelim 1)) (progn (vla-put-textstring lst2 (strcat "\\pxi-15,l15,tc2,c7,c12,15;\tP1\t" Date "\t" Initials "\t" Subject)) ) ) ((and (= rev1 1) (= tender 1)) (progn (vla-put-textstring lst2 (strcat "\\pxi-15,l15,tc2,c7,c12,15;\t00\t" Date "\t" Initials "\t" Subject)) ) ) ((= Prelim 1) (progn (setq RstrP (vl-list->string (reverse (vl-string->list ss1)))) (if (setq StrPP (vl-string-position (ascii "{") RstrP)) (setq RevNP (substr (vl-list->string (reverse (vl-string->list (substr RstrP (- StrPP 2) 2)))) 2 1)) (setq RevNP "1")) (vla-put-textstring lst2 (strcat ss1 "\\P{\t" (strcat "P" (rtos (+ (distof RevNP 2) 1) 2 3)) "\t" Date "\t" Initials "\t" Subject "}")) ) ) ((= Tender 1) (progn (setq RstrT (vl-list->string (reverse (vl-string->list ss1)))) (if (equal (vl-string-search "00" ss1) nil) (progn (vla-put-textstring lst2 (strcat ss1 "\\P{\t00\t" Date "\t" Initials "\t" Subject "}")) (exit) ) (if (setq StrPT (vl-string-position (ascii "{") RstrT)) (setq RevNT (substr (vl-list->string (reverse (vl-string->list (substr RstrT (- StrPT 2) 2)))) 2 1)) (setq RevNT "1")) ) (vla-put-textstring lst2 (strcat ss1 "\\P{\t" (strcat "0" (rtos (+ (distof RevNT 2) 1) 2 3)) "\t" Date "\t" Initials "\t" Subject "}")) ) ) ) ) (princ) ) ) ;--------------------------------GET TAB SPACING-----------------------------------; (defun _splitwords (str del / pos lst4 lst3 ss) (if (setq pos (vl-string-search del str)) (cons (substr str 1 pos) (_splitwords (substr str (+ pos 2))del)) (list str) ) ) (vlax-for obj2 (vlax-get (vla-get-activedocument (vlax-get-acad-object)) 'PaperSpace ) (if (= "AcDbMText" (vla-get-objectname obj2)) (setq lst4 (cons obj2 lst4)) ) (setq lst3 (car lst4)) ) lst4 (setq str (vlax-get-property lst3 'Textstring)) (_splitwords str "\t") DCL Code: DCL_Editbox : dialog { label = "Amendments Update"; : column { : boxed_column { : edit_box { key = "Date"; label = "Enter Date :"; edit_width = 5; value = "01.01.24"; initial_focus = true; } : edit_box { key = "Initials"; label = "Enter Initials :"; edit_width = 5; value = "XXX"; } : edit_box { key = "Subject"; label = "Enter Subject :"; edit_width = 25; value = "PRELIMINARY"; } } : boxed_column { : toggle { key = "Rev1"; label = "Check Box if this is First Revision."; value = "0"; } : toggle { key = "Prelim"; label = "Check Box if this is Preliminary."; value = "0"; } : toggle { key = "Tender"; label = "Check Box if this is Tender or Construction Issue."; value = "0"; } } : boxed_column { : button { key = "but1"; label = "Select Files"; is_default = false; } } : boxed_row { :button { key = "accept"; label = " Okay "; is_default = true; } : button { key = "cancel"; label = " Cancel "; is_default = false; is_cancel = true; } } } } I have found very little information on obtain MText on its own, not in a block, through ODBX and visual lisps; and even tried to wrap my head around Lee Mac's batch find and replace but could not quite work it out. Any help would be appreciated and if you need any additional info let me know. Thanks, Sol. P.S. This is my first post so apologies for any formatting errors and also thank you to everyone that has already helped with this lisp by providing functions on other topics/forums that have also been used here. Amendment Updates.lsp DCL_DCL_Editbox.dcl ODBX Wrapper.lsp Get Files.lsp
  3. When I am using UCS by object and for that selecting the text it shows Z axis on text. but in the text properties it is not there if I change the value of Z also nothing changing same problem exist. Not only the UCS, when i am using Lee Mac Align Text to Curve it is not coming properly. for that I am fixing the problem am using Lee Mac Text2MText Upgraded with single selection or explode the text and making again Text2MText. while flattening the text is self-exploding. for this how can i remove all text z axis value at single time.....???? Test.dwg
  4. Hi, I would like to know some help. 01 - Is there a possibility in this Lee Mac lisp, Automatically Label Attributes, that it can be changed so that every time I open a different file it asks me about the increment, prefix and suffix settings? Because in the current way it always loads the pre-configuration that is already in lisp. I don't want to have to edit the lisp to configure the numbers for each file. Note: I use attributed blocks and multileader blocks. 02 - I also use the Lisp Incremental Numbering Suite, I would like to know if the option for multileaders can be added. As the current options are only for text, mtext and blocks. For my use multileaders are more interesting. Because the use of block with attributes will have to be manually making the leader lines to indicate their positions and references after their insertion and when you have many blocks end up wasting valuable time. I would like to know if it is possible to make any of these changes, since lisps have many lines. Note: Sorry for the google translation. #NumIncV3-9.lsp AutoLabelAttributesV1-4.lsp
  5. Hi! I am having troubles using lee-mac setattributevalue. I would like to load unicode based text file with attributes, and set attribute using its functions. i think the problem is while reading data from the file, any possible help ? need to be Vanilla Lisp. Thanks
  6. Hello, I have a titleblock with attributes, where I would like to change attributes using lisp. I tried Lee-Mac routiens, tried JTB with no luck, i guess it have something to do with the fact my block is dynamic, or something (entget (car (entsel))) Select object: ((-1 . <Entity name: 1746772d820>) (0 . "INSERT") (5 . "DA2") (102 . "{ACAD_XDICTIONARY") (360 . <Entity name: 1746772d830>) (102 . "}") (330 . <Entity name: 1746772eed0>) (100 . "AcDbEntity") (67 . 1) (410 . "01 А2") (8 . "0") (100 . "AcDbBlockReference") (66 . 1) (2 . "*U8") (10 589.0 5.0 0.0) (41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0)) i am trying to change the PAGES attribute... btw so there is some trick, and i just cant figure it out. I'd be happe to provide the block, but I am unable to make attachment to post. Thanks for help Sample.dwg
  7. Hello is it possible to make lisp to extract coordinates from several polyline lines and their titles in the form of a .txt file? I have an example of the attachment below, I hope someone can help me, thank you. OUTPUT.txt MASTER CROSS SECTION.dwg
  8. when the block reference contain xref inside the block, it will fail and throw error. i think it try to get the external reference boundingbox is culprit. lee, I wanted to leave a measage in your site, but i never make the message sent success.
  9. I have two Lisp Programmes with me, One of those LISP is downloaded from LEEMAC 1st Lisp gives the hatch area as text in AutoCAD drawing 1 - Areas2FieldV1-3.lsp 2nd Lisp gives an output as .txt file when you click two text objects in the drawing 2 - 2str.lsp I want to combine those 2 lisp programmes into one. Expecting output : Every hatch has individual survey numbers, by selecting the survey number & respective hatch, Result should be survey Number, Hatch Area. Is it Possible ?? Very Very Urgent for me.:(
  10. I used to have this really handy lisp but have switched companies and forgot to bring it with me. The command was LPO and it would turn every off layer on, even xref, and I would be able to individually click the layers that I wanted to remain on. After clicking enter, the other layers would return to the off state. One of the most useful routines I have ever seen. I have very basic knowledge of lisp around would really appreciate some help. I also did a search and couldn't find anything similar. Thanks in advanced.
  11. i have a 3D object in autocad and i want to create selection set of line, circle, arc, polyline of that object using visual lisp. please help.. thanks in advance... Drawing1.dwg
  12. Okay guys so here is what I am looking for, I want to write a lisp or modify an existing lisp, that will select blocks within a given selection frame and summarize the attribute data in table either in the drawing or an excel file. I found LeeMac's awesome program "Count Attribute Values" but my issues is that for right now its still way over my head so I am having difficulties following much of it. Also I would like to limit it to blocks with a certain name(s) and then within that block only summarize one specific attribute because the blocks have a count attributes which isn't necessary. If anyone can give me some guidance or something I can build off of it would be greatly appreciated. Also I know EATTEXT can do this but I am looking for something substantially quicker.
  13. Hey guys! I have always come here for answers to my Lisping needs, but now I need to request some help with a Lisp I have been working on for a few days. I created this program that allows you to draw electrical circuits with choices of exposed/concealed conduit, homerun/full run, number/type of wires in circuit, etc. I have the input, wiring and block creation down, but now I just need to figure out how to insert and align the symbols for the different wires along anything curved. The closest program I can find to what I need is LeeMac's Object Align routine, however, it only allows you to select objects as a whole and align the whole to the line, not the individual objects aligned to the curve like you see on electrical wiring plans. I love the preview stuff of LeeMac's program, just need a version where the individual objects are aligned separately as shown in the below images. Lee's: What I need it to look like: LeeMac, is there perhaps a way you could incorporate this into your code as an option to align objects individually at their insertion points? Right now, my code prompts for a point to draw all of the symbols used and the number of them in a straight line. I could then use this updated program to select those symbols and align them to whatever curve I needed too The absolute best way would be to adjust my original code so that after you draw your circuit lines, it shows a live dynamic preview of all the symbols used aligned at their basepoints along the line you want to put them on. But maybe that would be for another day... Unless LeeMac, you would like to check out my code and tweak as needed... ****EDIT**** I figure I might as well go ahead and post up what I have so far. It is working pretty good, except that the first time I choose how many of each to use, it doesn't space the blocks correctly, but then it will afterward. Perhaps people can see what direction I am taking this and offer ideas or improvements to the code to make it work better? MEP Design.zip
  • Create New...