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 to all, So, this is my lisp. It does the following: 1) Adds revision clouds to multiple entities 2) Adds Layer (or create if required and add properties) 3) Adds hatch 4) Inserts a block for leader and text (already formated) I have very limited knowledge of the lisp. As you can see I have copied few different codes and combined it to make it work for my application. It works but I know this is not systematic at all. I dont know if my error handeling is correct. One thing that I wish to add is if the revision cloud is too big or too small, it should allow to do that without closing and undoing everything. In other sense, I need undo and reset arc length option in this. Can someone help me on this please? (defun c:RVC6 (/ *error* oce mflag ans) ;************************************Error handling********************************************* (defun *error* (msg) (setvar "cmdecho" OCE) (setq *error* nil) (princ "\nRevision cloud program is done.") (princ) ) ;************************************Program begins********************************************* (setq OCE (getvar "cmdecho") OOS (getvar "osmode") ) (setvar "cmdecho" 0) (setq mflag nil) (while (not mflag) (prompt "\n*** Enter option C, H, L, or E ***") (initget 0 "Cloud Hatch Leader Exit") (setq Ans (getkword "\nconvert to revision Cloud/Hatch/Leader/<Exit>: ")) (if (= Ans nil) (setq Ans "Exit") ) ;end if (cond ( (= Ans "Cloud") (convcloud) ) ( (= Ans "Hatch") (Addhatch) ) ( (= Ans "Leader") (Addleader) ) ( (= Ans "Exit") (setvar "cmdecho" OCE) (setvar "osmode" OOS) (quit) ) ) ;end cond );end while );end defun ;************************************Program ends********************************************** ;*******************************Start of "convcloud" program*********************************** (defun convcloud (/ al ss) (initget (+ 2 4)) (setq al (getreal "Specify Arc length <0.5>:")) (if (= al nil) ;If user do not input a value here (setq al 0.5) ;Consider "Enter" as 0.5 ) ; end if (if (setq ss (ssget '((0 . "LINE,*POLYLINE,CIRCLE,ELLIPSE,SPLINE,ARC")))) (progn (repeat (setq i (sslength ss)) (command "_.revcloud" "a" al al "" (ssname ss (setq i (1- i))) "") (if (not (tblsearch "LAYER" "CONSTRUCTION")) (command "-layer" "N" "CONSTRUCTION" "C" "1" "CONSTRUCTION" "LT" "continuous" "CONSTRUCTION" "") ) ; end if (command ".-layer" "S" "CONSTRUCTION" "C" "red" "" "") (Command "Chprop" "l" "" "la" "CONSTRUCTION" "C" "BYLAYER" "Lt" "BYLAYER" "LW" "BYLAYER" "") );end repeat (princ "\nRevision cloud(s) created on CONSTRUCTION layer.") );end progn (princ "\nNo objects selected.") ) );end defun ;*******************************End of "convcloud" program************************************* ;*****************************Start of "Addhatch" Program ************************************* (defun Addhatch (/ htype selset thisobj setlen entname) (initget 1 "D R") (setq htype (getkword "\nSpecify hatch type? Demo(D)/Rebuild(R):")) (if (= htype "D") (setq htype "ANSI31") ) ;end if (if (= htype "R") (setq htype "DOTS") ) ;end if (princ "\nSelect object(s) to hatch:") (setq selset (ssget)) (if selset (progn (setq thisobj 0) (setq setlen (sslength selset)) (while (< thisobj setlen ) (setq entname(ssname selset thisobj)) (Command "-bhatch" "Advanced" "Style" "Outer" "" "") (command "-bhatch" "p" htype "3" "" "s" entname "" "") (if (not (tblsearch "LAYER" "CONSTRUCTION")) (command "-layer" "N" "CONSTRUCTION" "C" "1" "CONSTRUCTION" "LT" "continuous" "CONSTRUCTION" "") ) ; end if (command ".-layer" "S" "CONSTRUCTION" "C" "red" "" "") (Command "Chprop" "l" "" "la" "CONSTRUCTION" "C" "BYLAYER" "Lt" "BYLAYER" "LW" "BYLAYER" "") (setq thisobj(+ thisobj 1)) ) ; end while (alert "\n ***WARNING*** Hatching could not skip the inner objects. To solve this, Double click hatch and `Add: select objects' and select inner object & click OK") ) ; end progn ) ;end if selset (princ "\nNo objects selected.") );end defun ;*******************************End of "Addhatch" program************************************* ;*****************************Start of "Addleader" Program *********************************** (defun Addleader (/ pt1) (while (setq pt1 (getpoint "\nInserting task description note, Specify Arrow End Point or hit Enter to close:")) (Command "_INSERT" "CP TEXT" pt1 "" "" "") (command "explode" "l") );end while );end defun
  2. Hi, all: I have a trouble with dealing Insert entity. I got a "Block" named "AA", which have one "lwpolyline" entities inside. And then I insert it with "scaling & rotating". The problem is, if I want to get the current outline of "Insert". My process is as below. 1. get "Block entity" from "Insert entity" 2. get "lwpolyline" from "Block entity" 3. transform the "lwpolyline" by vla-transformby(...) function with "Insert entity" rotation, scale ... parameters 4. draw the renewed "lwpolyline" on drawing as outline It works, but I think it cost a lot of times. Is there any convenient way to do this? thanks!
  3. dalivore

    Autolisp Help

    Does anyone know how to create a lisp that will export a csv file with object data and coordinates? Example; od field 1, od field 2,etc... x1,y1,z1,x2,y2,z2,etc.... Ideally it should be able to report all object data fields irregardless of the number. And it should report all xyz coordinates of polylines. I would also need a lisp to import csv files from the above format. If your curious this is all in an attempt to solve the 4 coordinate limits that map3d puts on exporting shape files... If someone has an alternate solution to that, I'm all ears! Dalivore
  4. Hey All, Okay so I have s dynamic block (green in my example) that is built in the x-y plane. I can change its length, width, extend it and rotate it about the base point. Yada yada yada. Bunch of feature that the company I work for needs. When we insert it into a 3D model we position it such that the Y axis becomes the Z axis and the the X axis can be anywhere within the the X-Y plane. I am trying to create a lisp that will move it relative to a second block (red in my example). Does any know a way to get the rotational information for the dynamic blocks. I can't use the "Rotation" from the misc section since it operate in the blocks x-y plane instead of the models x-y plane. I created an image below with Axis. To hopefully clarify. These aren't the actual blocks just example shapes. Hopefully someone can help. I have tried a few things without success.
  5. I have two different blocks overlapped on each other which have similar or same geometries. I want to verify the visual difference on both the blocks. I want to verify if the vendor block contains the same geometry as mine. Here is what I'm thinking and Need lisp for: I want to select the first block, deselect it, select the other one, deselect it and then this process should be looped till I can visaully find difference between blocks by select/highlight method without grips. If possible to add timer between selection & deselection process would make things easier and allow zoom and pan while still looping. Can anybody help me please?
  6. Hi everyone, I'm making quantity tables from entities in a drawing and I need to add "flagging system" which will alert the user when any kind of modification has been made in a specific layer (I'm talking about the content of the layer = entities, not layer definitions like color and so). I've already looked for many solutions, but it seems that the way to go is to add a reactor to a layer (or to each layer ???) I just started AutoLisp and I'm not feeling ready to dive into reactors w/o being crushed Theoretically I need something like ("myreactor" "catchanychangetocontent" "LayerName") -> return T if there's been a change (like a new entity etc etc) I really need help on this one, Tks !
  7. Hello everyone I have wanted to create some type of LISP for a long time now. Iv done 1000's of handrail drawing in the past few years, and expect to do many many more. These rails are 1.50 x 1.50 square tubing, 16ga wall, 304 stainless or Mild Steel. The standard height is 42" which should never change. There are only a few variables when drawing these. When you have a handrail that has more than just the end uprights, the center distance of uprights can be no larger than 42". When a handrail is short enough to not need intermediate uprights, the center distance can be no larger than 50". I have included a sample drawing of how I layout my rail drawing for the shop to fabricate. I have shown, a rail with multiple uprights and one short one that doesn't require intermediate uprights. I would love to have a LISP designed to have a dialog box pop up that ask for: Handrail Length: 4" - 240" Material: Stainless or Mild Steel Once criteria is entered, the LISP draws the handrail and then creates a cut list, like I have shown in my sample. Is it possible to dimension and place text with the same LISP program? Thanks for all the help everyone! AJ Here is the sample file I have put together as an example of how I draw my shop drawings. SAMPLE.dwg
  8. I am trying to execute Undo back with some predictability from a LISP routine. Is there any way to suppress (or force the "yes" prompt) even if Undo Back is executed more than once in a row?
  9. (getstring T "\nType any string and a Space: ") If I type "Sample Only " the result is "Sample Only" in which there is no space on the last string. Is there any way to recognize the Space on the last string? BTW i'm trying to prefix a string with a spacebar between those two strings.
  10. working with some old code that I'm not to familiar with, the original writter used a different defun methood that I don't understand. Example (defun f:SC_GETINSPTS ( I can't run the lisp unless I change the "f" to a "c". Why is this? how can I run it without changing the code?
  11. 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) )
  12. 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!
  13. 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
  14. 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
  15. 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
  16. 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!
  17. josvandoorn

    Interested?

    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
  18. 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
  19. 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!
  20. 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.
  21. 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
  22. 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.
  23. 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
  24. 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.
  25. 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 )
×
×
  • Create New...