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. Hello, Is there some Lisp function to move the cursor for a coordinate that I want ? For an example, I want to move the cursor for the coordinate 0,0. Thanks.
  2. Hi all! I'm new to LISP--just started teaching myself yesterday--so I might have missed something obvious, but... I'm trying to write a routine that prints a PDF of a drawing to the same directory as the drawing itself, and that only prints the current layout sheet. The first half of that I have, thanks to the code examples posted by BIGAL and woodman78 here: http://www.cadtutor.net/forum/showthread.php?69132-Printing-LISP-Help... The second half--getting it to only print the current layout--is where I'm having trouble. Plotting every layout from the drawing is useful in some cases, but generally I just want the one I have selected at the time. This is what I'm using: (defun c:pdf () (setvar "cmddia" 0) (setvar "filedia" 0) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (vlax-for lay (vla-get-Layouts doc) (setq plottabs (cons (vla-get-name lay) plottabs)) ) (setq dwgname (getvar "dwgname")) (setq len (strlen dwgname)) (setq dwgname (substr dwgname 1 (- len 4))) (setq plottablist (acad_strlsort plotabs)) (setq len (length plottablist)) (setq x 0) (repeat len (setq name (nth x plottablist)) (princ name) (setq pdfname (strcat (getvar "dwgprefix") dwgname "-" name)) (if (/= name "Model") (progn (setvar "ctab" name) (command "-plot" "yes" "" "dwg to PDF" "ANSI full bleed B (11.00 x 17.00 Inches)" "inches" "landscape" "no" "extents" "fit" "center" "yes" "monochrome.ctb" "yes" "no" "no" "no" pdfName "n" "y" ) ) ) (setq x (+ x 1)) ) (setvar "cmddia" 1) (setvar "filedia" 1) (setq DWGNAME nil LEN nil NAME nil PLOTTABLIST nil) (princ) ) I've narrowed the issue down to the section here: (vlax-for lay (vla-get-Layouts doc) (setq plottabs (cons (vla-get-name lay) plottabs)) ) What would I use instead of vlax-for to get the name of just the current layout? Thanks
  3. Dear Experts, I currently obtained a building plan map with rooms, doors, stairs,etc. My task is to extract the doors and tranform it as point. The doors have been represented as a connected arc and two lines. The size of map is fairly large and there is quite a lot of arcs, and so I have to use LISP to automatically extract the arcs based on specific algorithm. My current problems is quite simple: how to loop all drawing entities and extract the type of entities that I want? I want to know the AutoCAD commands, and if your can provide the algorithm, would be very appreciated! Many thanks for your help!
  4. Hello friends. I'am using ProgeCad 2011 and I'am working on Lisp which will save my nerves, but I would not save a lot of time with it becouse I know how to use qselect function. I am new in programing cad lisp so I need your help. The lisp should: flatten all objects and point's (Z=0); change text height (Layer1) to 0.3; change text height (Layer2) to 0.1; change text height (Layer3) to 0.3; move text(Layer1) from its original position for some distance(eg. 20) in some direction (eg. 285°); move text(Layer2) from its original position for some distance(eg. 30) in some direction (eg. 265°); move text(Layer3) from its original position for some distance(eg. 40) in some direction (eg. 275°); round text(=numbers) (Layer3) from three to two decimal places and than turn off that layer (Layer3). And if it possible to take one layer(Layer4) and explode it and then delete layer(Layer4). I hope you understand what I write Any suggestion or code I would appreciate it. Thanks in advanced.
  5. I am pretty new to lisps, but I think that I have made this a little more complex than it needs to be. I am trying to create a offset box around a set polyline and then hatch the box. I have succeeded in making it work for four user designated points, but I am looking for more. I would like to be able to run the lisp, draw a polyline with infinite bends and angles, and then have it hatch the resulting offset box. If anyone has any optimization ideas I would love to hear them trench.lsp
  6. I have been getting back into lisp, after I had a class that scratched the surface of lisp, I never looked back on it until now. This is my first lisp command written without copying it from a book! (defun c:ibeamp() (setq pw (getdist "\nEnter Beam Width: ")) (setq ih (getdist "\nEnter Inner Height: ")) (setq pt (getdist "\nEnter Plate Thickness: ")) (setq po (getdist "\nEnter Overhang Distance: ")) (setq ip (getpoint "\nInsertion point: ")) (setq p2 (polar ip (dtr 180.0) (/ pw 2))) (setq p3 (polar p2 (dtr 270.0) pt)) (setq p4 (polar p3 (dtr 0.0) po)) (setq p5 (polar p4 (dtr 270.0) ih)) (setq p6 (polar p5 (dtr 180.0) po)) (setq p7 (polar p6 (dtr 270.0) pt)) (setq p8 (polar p7 (dtr 0.0) pw)) (setq p9 (polar p8 (dtr 90.0) pt)) (setq p10 (polar p9 (dtr 180.0) po)) (setq p11 (polar p10 (dtr 90.0) ih)) (setq p12 (polar p11 (dtr 0.0) po)) (setq p13 (polar p12 (dtr 90.0) pt)) (command "line" ip p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 "c" ) (princ) ) (defun dtr (x) (* pi (/ x 180.0)) ) (princ) this draws a very general I-beam. Any feedback is appreciated, constructive more so
  7. Hi guys, after my first lisp was a success, or what I consider a success, I was challenged with another lisp. This one would place a tag (shown below)under the following criteria: 1.the lisp would need to enable the tag's arrow to point in one of the 9 directions shown. 2.It would also be useful to have it scaled during the process. 3. It would need to come in on a layer called "dimension" (however in some cases people use DIM as the name) 4. The x shown in the middle of the tag is meant to be changed to a number, it would be useful if it could come out as a number specified by the user, and if not given a number in the process come out as a #. I know this can most likely be achieved thru Lisp, but I have no clue where to start. I know this will be hard to walk some one through without example codes, but I really enjoy learning this stuff, so will ask that any codes given come with an explanation on what it is doing either at the end or inside the code using a ';'. Thanks guys!
  8. HI CadTutorers First post, hopefully many more to come. I have a control line 14 km long and dont see the need to manual edit each mtext. The (departmental) Chainage macro im using spits out mtext like 1000.00 1100.000, however my proj manager wants it in km on the plan. It is to be labbled as follows 1.1km 1.2km and so on any quick way to get this done. Thanks in Advance Greenuser.
  9. I was able to find this Lisp Routine "ATTOUT" forexctracting attributes into an Excel document. I currently have blocks createdthat contain 4 different attribute values. These attributes are exctracted in creating B.O.M's to automate Mfg. processes in conveyor equipment construction.In devloping the B.O.M a specific format is required by the company I work for.Currenntly the Lisp routine does not extract the data in the format I wouldlike. I need this Lisp to "count"the number of blocks and output them into an excel table that follows the format "Qty" "Part #" "Descripition" (See BOM Tab of attached DWG). Model space contains a sampleof some of the blocks that are being used. I have very little experience writing Lisp, and in order to modify the codewould be beyond my abilities. Any helpthat can be provided would be greatly appreciated. Thank You LayoutExample.dwg ATTOUT.LSP
  10. I am absolutely new here, so I apologize if I am in the wrong place I'm building a tool palette in ACAD2012. I want to put in a matchline that enters a line on a particular layer with a specific linetype; easy enough with a command ^C^C_pline and then I've set my options for the appropriate linetype, color... whatnot. Now I want to adjust it, I want the line to go in and then the word "MATCHLINE" to automatically go above the end of the line. following that, I would like a prompt for the user to enter text at the end of "matchline". Any suggestions? I admit, I am terrible at lisp, but that may be the way to go. I can of course also add a macro into the palette, so that is an option as well.
  11. I'm posting this thread in the General Forum because I'm not sure where else to put it and being new to Cadtutor I'm still learning protocol. If I'm in the wrong area please let me know! Thank you! On to my question then. I've been reading through a large number of threads, not looking for anything in particular, just reading to learn new things (and learn I have!). I've noticed there almost always answers involving lisp routines. I understand what the lisp does but I know nothing about writing or launching them. Can anyone give me a recommendation of where to go to begin reading up on them? Please and thank you and much appreciation for any help.
  12. Hey guys, I have an interesting predicament. I have a ton of sub-sets within a sheet set and I would like to print each sub-set as a multi-page pdf. My LISP is decent, but I have no idea how to interface in this manner with the SS. Does anyone have any tricks? Or, can someone point me in the right direction? Thanks for taking the time to read my issue! Take care, Seth
  13. Hi All, I am new to this forum and lisp. Trying to create cross sections of drain using lisp.The details of are fed from excel for each cross section.I am stuck as I was not able to figure out the way to offset line/polyline by selecting the lines and offset distance from the program itself. Any help would be appreciated. Thanks in advance. Cross SectionOf EWE H-100ch 0 to 575m.dwg read_excel_data_to_array.lsp drain.xls I have grabbed the code given by Fixo to read data from excel (http://www.cadtutor.net/forum/showthread.php?41910-Read-Excel-Data-Cells-and-Draw-in-AutoCAD-thru-LISP/page2). Thanks Fixo.
  14. Hello PPL I need to optimize my work and i have a lot of blocks to count so i decided to give lisp a try (i am a nneewwwbbiieee). How can i select "blocks made of attribute entities" or "plain attributes entities"? Real life example: 1) prompt the user to give a name and a number ( name of entity/block and a number ) 2) by using what the user prompt I wanna it to select a set of blocks or entities ( the best solution you consider ) that match: a) Tag ( name) b) value ( number) sorry for my english, am i making any sense at all??? regards
  15. Hi Guys, I'm fairly new to this 'lisp' program. I'm a trainee setting out engineer and have a question. How do I display both eastings and northings coordinates on one line? My senior engineer has it on his Auto CAD but got it done from somebody else and he doesn't know how to do it. See Image - Shows coordinates X and Y This is how it should be - Please note I typed them coordinates in myself Any help would be greatly appreciated Taj.
  16. Dear autocad users / lisp writers, Could somebody please help me. I wrote this .lisp file (defun c: x x () ; Put Xref to right layer ; edited the line, otherwise it shows a angry smiley (command "-layer" "Make" "Xref" "color" "8" "Xref" "") (command "-Xref" "Attach" "" "0,0" "1" "1" "0" "") ) In the second (command) line, i want it to attach a xref file and i want it to ask me what file i want to put in. Otherwise i'll have to write a whole lot of lisps... Is there perhaps a way to make it display the file explorer? I hope somebody can help me with this lisp. Thanks in advance. Greets, Michel
  17. Hi all ... Not new to v/lisp, but new to this great forum. I'm looking to automate title block revision, pdf generation and transmittals via lisp (which will probably be later converted to VB). My question is: Is it possible to create pdf's via script that will assign filenames [which I will extract from the drawings] ? from what I have managed to ascertain this is achievable. 1) by a 3rd party pdf application (which I'm not against, but I would just prefer an all-in-one custom solution to save on portability/deployment issues) 2) by editing a registry entry (not keen on this, hopefully avoidable) to be passed to the pdf driver. If someone suggests using publisher, I have limitations using it - particularly in regard to assigning the file name exactly as I want it, and without a dialog. Have had no luck using the DWG to PDF.pc3 supplied by AutoDesk either.
  18. Hello i would like to have a script that can be batch-applied to multiple drawings to do the following: -vports,2,v visretain,0 reload all xrefs save and close Can somebody please help me with this Thanks
  19. Hello, I'm new to the world of LISP and have found lots of code that almost does what I am looking for. I have several drawings that contain text in the same location. ie each drawing has a title placed using the same instertion point. Additionally the text objects are layed out to look like a table. One column will have the heading and the other column will have the result. I would like to have a program the allows me to enter in the instertion points for each text element I want in the order I would like it to appear in the text document or ideally in a csv format. Thanks for your help!
  20. Learnt all numbers in a list, all alphabets in a list. but how if both in the same? such as (count-alpha '(8 0 b 7 h u 6 d ) ) -> 4 (count-no '(8 0 b 7 h u 6 d ) ) -> 4
  21. Hello, I'm an AutoLISP newbie and I need to iterate through a folder of .DWG files, running a lisp on each file one at a time with no prompts to the user. Can this be done in AutoLISP? Here is the lisp that will be run on each file: ;delete_layers_except (vl-load-com) ;(defun c:demo (/ aDoc name) (setvar 'Clayer "0") (repeat 4 (vla-purgeall (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object))))) (vlax-for itm (vla-get-layers aDoc) (if (and (not (wcmatch (setq name (vla-get-name itm)) "*|*")) (not (eq name "0")) (not (member name '("Fixture-Shapes" "CHECKLANE" ;"Arch-Wall-Interior (Construction)" ;"Arch-Wall-Interior" ;"Arch-Wall-Exterior" )))) (progn (vla-put-lock itm :vlax-false) (vl-cmdf "_.-laydel" "_N" name "" "_Y")) ) ) (repeat 4 (vla-purgeall aDoc)) (princ) ; ) ;explode_all ;(defun c:explodeall () (setvar "draworderctl" 0) (setvar "qaflags" 1) (command "._explode" (ssget "X" )"") (setvar "qaflags" 0) ; ) ;erase_hatch ;(defun c:nohatch () ;(if (or (ssget '((0 . "HATCH"))) (ssget "_X" '((0 . "HATCH")))) (setq ss1 (ssget "X" '((0 . "HATCH")))) (command "_.erase" ss1 "") ; ) ;plot ;(defun c:pp () (command "-plot" "no" "Layout1" "previous plot" "DWG to PDF" "" "" "") (princ) ; ) Thank you!!
  22. Hey guys, I've been using ProSteel for just over a year now, and have been learning LISP for around the same amount of time. I recently came accross this site... https://sites.google.com/site/mclisp/Home/Home ...which has a bunch of LISP routines which are to be used in conjunction with ProSteel (the routines contain ProSteel functions). I reckon there could be some real benefit to creating some routines to enhance ProSteel - but there is very little documentation on ProSteel + LISP. So... i was wondering if any of you guys have had any experience on writing LISP for ProSteel - and if you could off me any pointers/advice to get me started. Thanks for any help.
  23. I am new to this but I need a lisp that would create the following layers with every (even pre existing) files that I open. Layer: 1 in cyan, 2 in white, 2L in white, 3 in red, 4 in yellow, 5 in white, 6 in blue, SK1 in cyan, SK2 in white, SK3 in red, SK4 in yellow, and SK6 in blue. I have looked at existing lisps and macros but I am new and am having trouble making sense of them.
  24. I needed to print 200+ drawings located in multiple locations, but only a section of each drawing that was not previously defined by a view or common coordinates... A batch printing process that could pause at each drawing to accept user input was what i was after. I stumbled upon a bundle of code that works! As a novice coder, I am hoping someone out there will tell me there is a much easier way! In order for this to work, I had to break in to a script file for user input. Since this cant be done, I created 2 seperate scripts within 2 LISPS that would loop infinitely.. I had to creat a txt file containing every drawing to be opened. This was done in excell fairly easily. The purpose of this list is to "read-line" and write to a script file. The script file would then contain one line. "OPEN" "file" "custom command" hopefully it makes sense as I post the code. The master list had to be modified everytime so that the first line is always "next" so I used VBA to delete the first line. This was all done with SDI=1 so i didnt have to worry about coding in a close.. Ok, here goes nothin... SET SDI=1 Main start program. The first drawing must be open at this time, and the master list will contain drawings 2 on. ;BATCH PRINT USER DEFINED VIEW ;JPLANERA 7/3/12 ;This routine will allow the user to define the view and will print the stored view ;Then the script callout starts the process that alters the "open" file script. ;Open the first drawing in the master list and initiate the DVP command to start. ;The master list will contain ALL but the current open drawing. (DEFUN C:DVP () (command "-view" "W" "1" pause pause) (while (= 1 (getvar "cmdactive") ) (command pause) ) (command "-plot" "y" "model" "RICOH C5000 ENG" "Letter (8.5\" X 11\")" "i" "P" "n" "V" "1" "f" "c" "y" "monochrome.ctb" "y" "a" "n" "y" "y") (command "script" "U:\\batchpress\\mos.scr") ) Contents of mos.scr -VIEW RESTORE 1 QSAVE MOS MOS.LSP this is the routine that reads from the master list, writes to a script file and erases the first line of the master list... ;OPEN DRAWING SCRIPT MODIFY ;JPLANERA 7/3/12 ;This routine will read the first line of the "master" list of drawings, then write it to a script file. ;This script file will contain only 1 line of code so autocad does not get "confused" ;A VBA routine is then used to delete the first line of the master list so that when ;this routine is run again, the first line to be read is the "next" drawing in the list. (defun c:MOS (/ MPTL L1 OF) (setq MPTL (open "U:\\batchpress\\masterpresstoollist.txt" "r") ) (setq L1 (read-line MPTL) ) (close MPTL) (setq OF (open "U:\\batchpress\\openfile.scr" "w") ) (write-line L1 OF) (close OF) (startapp "wscript" "\"U:\\batchpress\\deleteline.vbs\"") (princ) (command "script" "U:\\batchpress\\openfile.scr") ) contents of master list txt file (shortened of course). Done in excell. "DVP" at the end starts the loop back to the first LISP routine. OPEN M:\ENGR\Drawings\TOOLING\T18516\T18516.dwg DVP OPEN M:\ENGR\Drawings\TOOLING\T18519\T18519.dwg DVP OPEN M:\ENGR\Drawings\TOOLING\T18530\T18530.dwg DVP contents of script file to open drawings and call back first command LISP. I tried to do this all in the master list but kept getting runtime errors. I suspect because the list was being used while I was trying to edit it... solution was two files. OPEN M:\ENGR\Drawings\TOOLING\T18515\T18515.dwg DVP DeleteLine Function by TomRiddle 2008 DeleteLine "U:\BATCHPRESS\masterpresstoollist.txt", "", 1, 0 Function DeleteLine(strFile, strKey, LineNumber, CheckCase) 'DeleteLine Function by TomRiddle 2008 'Remove line(s) containing text (strKey) from text file (strFile) 'or 'Remove line number from text file (strFile) 'or 'Remove line number if containing text (strKey) from text file (strFile) 'Use strFile = "c:\file.txt" (Full path to text file) 'Use strKey = "John Doe" (Lines containing this text string to be deleted) 'Use strKey = "" (To not use keyword search) 'Use LineNumber = "1" (Enter specific line number to delete) 'Use LineNumber = "0" (To ignore line numbers) 'Use CheckCase = "1" (For case sensitive search ) 'Use CheckCase = "0" (To ignore upper/lower case characters) Const ForReading=1:Const ForWriting=2 Dim objFSO,objFile,Count,strLine,strLineCase,strNewFile Set objFSO=CreateObject("Scripting.FileSystemObject") Set objFile=objFSO.OpenTextFile(strFile,ForReading) Do Until objFile.AtEndOfStream strLine=objFile.Readline If CheckCase=0 then strLineCase=ucase(strLine):strKey=ucase(strKey) If LineNumber=objFile.Line-1 or LineNumber=0 then If instr(strLine,strKey) or instr(strLineCase,strkey) or strKey="" then strNewFile=strNewFile Else strNewFile=strNewFile&strLine&vbcrlf End If Else strNewFile=strNewFile&strLine&vbcrlf End If Loop objFile.Close Set objFSO=CreateObject("Scripting.FileSystemObject") Set objFile=objFSO.OpenTextFile(strFile,ForWriting) objFile.Write strNewFile objFile.Close End Function Ok hopefully this all makes sense. If further explaing is needed please let me know. Also i would be happy to hear there is an easier way!! Im sure this could be used to do multiple user input commands but i think i am going to take a break before I try to do any more!
  25. Maybe someone can help me out here. Is it possible that I can create a link between dimensions (width & length) of a rectangle in AutoCAD, and two cells in a pre-existing Excel sheet; so when I modify the size of this rectangle in AutoCAD, the cells will also get updated? I'm using AutoCAD 2002, 2006 & Excel 2003.
×
×
  • Create New...