Jump to content

Search the Community

Showing results for tags 'autolisp'.

  • 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...

  1. My name is Neil and I am new at autolisp. I am trying to write a lisp file that will explode all blocks but the ones selected by the user. The purpose for this is when I receive a file from architect that I will be using as a base file for my work I want to be able to explode all the blocks. Some times the architect use blocks with attributes for room tags. Which I do not want to explode. Below is the code I have written so far. I may be going about it all wrong so if there is a better way please let me know. Also if you could explain any code you post so that I may be able to learn. Below is my code: (defun C:eselected () (Prompt "Select all blocks you do not want to explode. ") (setq a (ssget "_X" '((0 . "INSERT")))) (setq b (ssget())) (setq c (?)) (command "_.explode" c "") (princ) )
  2. Hello! I was wondering how I would go about writing a function that would calculate the length of a diagonal of a rectangle using SQRT function? I've been trying but so far nothing! Thanks!
  3. Hi, I'm very new to lisp and I'm currently writing some to create steel sections with the main dimensions and the name of the section below. I'm having trouble adding dimensions (in a new dimension layer) to my lisp file and the text file below my section (also in a new text layer). Ive attached my lisp file and a picture of what I'm trying to achieve. Any help would be appreciated! PFC.pdf pfc.lsp
  4. Hi everybody, First thing I want to apologize if something that I wrote sounds strange. Im spanish and my english is not as good as it should be=P. Im learling little by little autolisp things, mostly strugling through examples, codes, etc... many of them from this forum so I thank you a lot ^_^. At this moment I'm developing a routine that breaks/trims walls in order to insert doors or windows, and, after looking for it a few days, I would like to know if there's a way to use a number that users input on the command line (in a getpoint) without getting an error.,... wich is that happends everytime =/. ;; HOLE-O-MaTIC 2000 ;; by Arturo Blanco Ureña. 2013 ;; Breaks "walls" in order to insert windows or doors ;; Based initialy on code from Pavel Chour http://klobouk.fsv.cvut.cz/~chour/Lisp/Chapter%206.htm (defun error1 (errmsg) (command "_undo" "_end") (setvar "CMDECHO" 1) (setvar "OSMODE" osmodevar) (setq *error* temperr) (prompt "\nAchtung!!! Verboten!!! Error!!!\n") (princ) ) (defun c:holes(/ );P1a P2a P1 P2 P3 P4 A1 A2) (setq osmodevar (getvar 'OSMODE) temperr *error* *error* error1 ) (if (not ancho) (setq ancho 1.50)) (setq Tancho (rtos ancho) P1 "Width" ) (setvar "CMDECHO" 0) (command "_undo" "_begin") (setvar "osmode" 512) ;I'm using this structure in order to go back to the menu so I can change my mind several times. ;Don't know if there's a better way =P. ;--- (while (= P1 "Width") (initget 128) (setq P1 (getpoint (strcat "\nSelect Point or [Center/Width]<" Tancho ">:"))) (cond ((numberp P1) (setq ancho P1) ;trying to recognice P1 as a number but always goes on error =/ (setq Tancho (rtos ancho)) );cond1 ((= P1 "Width")(setvar "osmode" 35) (setq ancho (getdist "\nWidth of the Door/window?:")) (setq Tancho (rtos ancho)) );cond2 );end cond );end while ;--- (cond ((= P1 "Center") (setvar "OSMODE" 518) ;If the user want to break from the center of the window. (setq P1a (getpoint (strcat "\nSelect center <" Tancho ">:"))) (setvar "OSMODE" 128) (setq P2a (getpoint P1a "\nSelect the other side of the wall:") A1 (angle P1a P2a) A2 (+ (* pi 1.5) A1) P1 (polar P1a A2 (* ancho 0.5)) P3 (polar P1a A2 (* ancho -0.5)) P2 (polar P2a A2 (* ancho 0.5)) P4 (polar P2a A2 (* ancho -0.5)) ) );end cond1 (T (setvar "osmode" 128) ;if he/she wants to start from one side (setq P2 (getpoint P1 "\nSelect the other side of the wall:")) (setvar "osmode" 512) (setq A1 (angle P1 P2) A2 (+ (* pi 1.5) A1) P3 (polar P1 A2 ancho) P4 (polar P2 A2 ancho) P1a (polar P1 A2 (* ancho 0.5)) P2a (polar P2 A2 (* ancho 0.5)) ) );end else );end cond (setvar "osmode" 512) (command "_break" P1 P3 "_break" P2 P4 "_line" P1 P2 "") (setq L1 (entlast)) (command "_line" P3 P4 "") (setq L2 (entlast)) ;I add this in order to trim extra lines in the middle of the wall. (command "_trim" L1 L2 "" "B" P1a P2a "" "") (command "_undo" "_end") (setvar "CMDECHO" 1) (setvar "OSMODE" osmodevar) (setq *error* temperr) (princ) );end As you see You can enter the "Width" to give it, but I would like to simply write down a number when asking for a point, recognize that is a number and use it as the value of the variant. If a point is entered, then continue normally. Im a bit shy and its the first time i post a code. I have used several pieces of code from others to arrange the error handling/undo and its originally based on one tutorial from Pavel Chour, so I dont know if its right that I give permission or not to use it, or even its worth it (the trim still fails and i dont really get why ) but If anyone want to use it feel free. Any tips critics and opinions are welcome also
  5. Dear Cadtutor members I am Nelly, new member of this forum and a very beginner autoCAD Civil 3D (2012 version) user. I am Indonesian who's now living in South Korea to pursue my degree. I got scholarship from a Korean's professor, so i'm doing this because of it I need help about autolisp. I am new in this area, so i just googling it and found some reference on autolisp programming, but yet still don't understand about how to program with it and anything at all I hope there's someone who can teach me in this area, because it's very important for my research study. Thank you in advance Yours truly, Nelly
  6. So, to give some background information, I have 0 experience with LISP programming, and am an intern at an engineering company. I really would love to score "brownie points" by automating an extremely boring and time consuming task. I have experience with other languages, and can work off of a good base. So here's what I would like the routine to accomplish: 1.) Figure out the name of the title block (the title block will be in the same location on each and every file) 2.) Use that name to modify 5 attribute values of that block (each title block has the same attribute tags: NAME, DRAWING_NUM, SN, DATE, DESIGNER) 3.) Save in a new location. So, for example, lets say the drawing I want to modify is at the location C:/USER/ME/, and is called drawing1.dwg. Lets say that it's title block is called "blanksheet", the routine then needs to modify the 5 attributes (NAME: DrawingName, DRAWING_NUM: 123456, SN: 000, DATE: 10 10 12, DESIGNER: Me) of the block "blanksheet". Then, after it modifies everything, saves it in the location C:/USER/YOU, and is called drawing2.dwg. I'm not even sure if this is doable within the bounds of AutoLISP, so any feedback is appreciated. Thanks in advance!
  7. josvandoorn


    Dear People, CADTutor has got a name in the AutoCAD community. I was at your web site. I saw your forum. I'm a mem ber of your forum.. You also have a forum that is dealing witgh AutoLISP, Visual LISP & DCL. I did not see AutoLISP programs there. But. I'm wondering. Are you interested in AutoLISP programs? Do you want to publish them? I have written many AutoLISP programs. I'm still writing AutoLISP programs. What is more. I'm writing articles about my AutoLISP programs. I publish them on my blog. If you want to see what I have got. Here is the website of my blog. http://www.speedupautocad.blogspot.com/ If you are interested, let me know. I could send you my articles. Let me know where I can send them to. And what format you want: DOC or text. Jos van Doorn SpeedUpAutoCAD
  8. I am trying to update menses, tools, and LISP routines from autoCAD 2000 to 2011. I was able to load and update most of them except 4 LISP routines. When I open the routine in VisualLISP all I get is a bunch of characters. It does not matter if I use autoCAD 2000 or 2011 to open the routines, it would not show its content. Does anyone know what might be the issue? How to fix it? Thanks
  9. Hello, I am a newbie to AutoLISP and need to write a program to delete all layers in a file except these: Fixture-Shapes, CHECKLANE, Arch-Wall-Interior (Construction), Arch-Wall-Interior, Arch-Wall-Exterior. Here's what I have so far - I'm getting the error message: "error: malformed list on input" (defun c:deletelayer2 (/ ss) ; get layers to keep ; if object not on these layers, delete ; purge - delete empty layers ; select all things NOT on these layers. "_x" is a filter that selects all. (if (setq ss (ssget "_x" ' ((-4 . "<NOT") (8 . "Fixture-Shapes, CHECKLANE, Arch-Wall-Interior (Construction), Arch-Wall-Interior, Arch-Wall-Exterior") (-4. "NOT>")))) (command "._erase" ss "") ; (prompt "\n** Nothing selected ** ") (princ) ) ) Thank you!
  10. I need to create a routine that will allow a user to pick two points (via intersections) and then it will automatically place text (user types in) at the midpoint between these first two points. So far I have: (defun c:textplacer () (command "_textstyle" "standard") (command "_textsize" "6.0") (command "_osnap" "Intersection") (setq pt1 (getpoint "\nSelect First Point:"));gets the first user point (setq pt2 (getpoint "\nSelect Second Point in POG Direction:"));gets the second user point (setq pt3 (abs (- (car pt1)(car pt2))));gets the middle point btw pt1 and pt2 ;need the rest here );end function Not even sure if pt3 is really getting the midpoint...I'm out of my depths here.
  11. theonlynelly

    lisp cannot save

    Dear cadtutor forum, I am new autolisp user (i use autocad civil 3D 2012), i try to coding there but it doesn't have the "Save All" option in the console. How to save the file i've made? Thank you in advance
  12. I want to write my own hatch command. (AutoCAD 2011) In that, I want user to create the hatch manually and then process the hatch object created by the user in my command. Manually, when you type hatch command at the command prompt: "When the ribbon is active, the Hatch Creation contextual tab is displayed. When the ribbon is off, the Hatch and Gradient dialog box is displayed." (from Acad help). However the (command "hatch") statement does not activate the contextual tab even when the ribbon is active. I have tested all combinations with -hatch, -bhatch, cmddia and PAUSE, but without success. Is this 'incomplete' work by AutoCAD Development team? Is there a way to activate the contextual tab using Lisp after (command "xxx") statement? I have searched the forum but could not find anything related. Please help.
  13. Is there anybody who can tell me where can I find information about ALL VLA-... COMMANDS. It's a disaster not to be able to find any information on the help of AutoCAD 2006 and some others about it. Normally it would be possible to run a routine, script, lisp or whatever within AutoCAD and get a result, but it is really an act of faith not to find a-n-y information about it on the help from the program. I would like to know what it's possible and not to do through a lisp routine. Thanks in advance
  14. I have made a program that will draw objects from user input. I offer a simple sample below that will place a dimension on an object. After the DIMLINEAR line I would like to be able to edit the text of the last dimension with the next (4) possibilities (that I will independently use as needed, no need for optional prompt for condition): 1. \XABC ~ for text under dimension 2. ABC ~ for text on same line after dimension 3. ABC ~ for text on same line before dimension 4. ABC 4'-0" ~ for adding text and HARD coded dimension (actual dim replaced) (defun c:bdt () (SETVAR "CMDECHO" 0) (SETQ STP (GETPoint "\nPick Starting Point: ")) (SETQ P2 (POLAR STP (* 2 PI) 5.0)) (SETQ P3 (POLAR P2 (* 3 (/ PI 2)) 5.0)) (SETQ P4 (POLAR P3 PI 5)) (COMMAND "LINE" STP P2 P3 P4 STP "") (COMMAND "DIMLINEAR" STP P4 "@36.0 ? (PRINC) ) I DO NOT know any VLisp and have been searching books and online content with only similar luck. I have found samples that prompt the user to pick a dimension, but, I have many dimensions I want the PROGRAM to create and EDIT each dim at run time. No user interaction. Please help me with the (4) different scenarios I have using the code I have provided. Please, no bells & whistles, will be above my level of experience at this moment. Thanks for any help.
  15. Hi.. as I told before, I am a beginner in LISP, trying to write something, but getting error.. "error: malformed list on input" . what it means? I have list :- ((((1 . x ) (2 . y)) ((3 . z) (4 . a))) (((1 . m ) (2 . n)) ((3 . o) (4 . p))))) I want this as :- (((x y) (z a)) ((m n) (o p))) (defun test1 () (setq gb '((((1 . x ) (2 . y)) ((3 . z) (4 . a))) (((1 . m ) (2 . n)) ((3 . o) (4 . p))))) (setq blanka '()) (setq blankb '()) (setq len1 (length gb)) (setq count1 0) (while ( (setq data1 (nth count1 gb)) (setq len2 (length data1) (setq count2 0) (while ( (setq data2 (nth count2 data1)) (setq blankb (append blankb (list data2))) (setq count2 (1+ count2)) ) ; while (setq blanka (append blanka (list data1))) (setq count1 (1+ count2)) ) ;while )
  16. Hello everyone, does anyone knows a way to define a function in AutoLISP with arbitrary arguments, same as ARX?
  17. Hi all New to this forum and am in search of help. I have been lumbered with a project to take ACAD drawings of a control system into ACAD Electrical. The old version has no use of layers and has text for the wire numbers. What I would like to do is change the text lines to a wire layer thus giving me use of the auto numbering. Additionally I note that the export to spreadsheet does not take all of the attributes of the components i.e. a relay contact shows, when editing the properties, the wire number at each connection but is not in the spread sheet. This woudl be great if it could report this to produce the wiring schedule automatically. So to sum it up is tere anyway to get a lisp progran to change the text object and can it also extract the data I need for the wiring schedule into any form of text file. Cheers Phil
  18. Hi I am making a lisp routine that inserts a block and breaks the line the block is inserted in. The block inserted is a pump schematic which includes the valves, strainer and control points (tags). I use the BREAKDIM attribute (invisible) to set the width of the linebreak that the block is inserted into. (some of you old lispers would remember the code BBlock.lsp ) I am would like to burst the block after inserting it from within the lisp routine. If I use the code (C:burst) It invokes the burst command but prompts me to: select objects. I would like to have it burst the block that was just inserted (entlast) or let me input the block name. Another option would be to use the (command "._explode" "L" "") function and then erase the attribute Def -`BREAKDIM. To do this I would need some code to find an Attribute def (not in a block anymore as it was just exploded) with the TAG "BREAKDIM" and then use the `command "erase" function to delete it. If anyone can help it would be much appreciated. Mbuk
  19. Hey all, I have a quick question. I apologize if this has already been asked, but I can not find it myself. I have searched other spots, but its hard if the thread does not specifically deal with your question. My problem is, we have a LISP routine at my company. After you get all of the information from the user, it will insert a block in a specific arrangement in a specific amount. Like, insert blah blah blah 3 times downward 1 inch apart. Everything works fine, but the problem is is that the block HAS to be in the drawing, otherwise the routine fails. If you run it while the block is IN the drawing, it runs fine, no problems. Help?! I have scoured different ways to have it insert the blocks, but no combination seems to work. Here is the line for inserting the block, any ideas? (command "insert" "terminal" (polar #pt1 1.570796327 0.125) "" "" "")
  • Create New...