Jump to content

Search the Community

Showing results for tags 'process'.

More search options

  • 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 2 results

  1. 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!
  2. I created an action macro to do the following: 1) Select all objects 2) Change the colour to "140" I saved it as "ActMacro001" I needed to apply this macro to heaps of files, and used the following batch process lisp (It applies ActMacro001 to files A.DWG, B.DWG, C.DWG etc): [color=#ff0000]([/color][color=#0000ff]defun[/color] C:BATCH[color=#ff0000]([/color][color=#0000ff]/[/color] dwgs scr-name lsp-name[color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]setq[/color] dwgs '[color=#ff0000]([/color][color=#ff00ff]"C:/A.DWG" "C:/B.DWG" "C:/C.DWG" "C:/D.DWG"[/color][color=#ff0000])[/color] scr-name [color=#ff00ff]"c:/tmp.scr"[/color] lsp-name [color=#ff00ff]"c:/batch.lsp"[/color] [color=#ff0000])[/color] (create-script scr-name dwgs lsp-name [color=#ff00ff]"(ChangeColour)"[/color] [color=#0000ff]T[/color][color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]command[/color] [color=#ff00ff]"_.SCRIPT"[/color] scr-name[color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]vl-file-delete[/color] scr-name[color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]princ[/color][color=#ff0000])[/color] [color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]defun[/color] ChangeColour[color=#ff0000]([/color][color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]command[/color] [color=#ff00ff]"ActMacro001"[/color][color=#ff0000])[/color] [color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]defun[/color] create-script[color=#ff0000]([/color]scr dwgs lsp cmd save [color=#0000ff]/[/color] f dwg[color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]setq[/color] f [color=#ff0000]([/color][color=#0000ff]open[/color] scr [color=#ff00ff]"w"[/color][color=#ff0000])[/color][color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]foreach[/color] dwg dwgs [color=#ff0000]([/color][color=#0000ff]progn[/color] [color=#ff0000]([/color][color=#0000ff]write-line[/color] [color=#ff0000]([/color][color=#0000ff]strcat[/color] [color=#ff00ff]"_.OPEN \""[/color] dwg [color=#ff00ff]"\""[/color][color=#ff0000])[/color] f [color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]write-line[/color] [color=#ff0000]([/color][color=#0000ff]strcat[/color] [color=#ff00ff]"(load \""[/color] lsp [color=#ff00ff]"\")"[/color][color=#ff0000])[/color] f [color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]write-line[/color] cmd f[color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]if[/color] save [color=#ff0000]([/color][color=#0000ff]write-line[/color] [color=#ff00ff]"_.QSAVE"[/color] f[color=#ff0000])[/color] [color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]write-line[/color] [color=#ff00ff]"_.CLOSE"[/color] f[color=#ff0000])[/color] [color=#ff0000])[/color] [color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]close[/color] f[color=#ff0000])[/color] [color=#ff0000]([/color][color=#0000ff]princ[/color][color=#ff0000])[/color] [color=#ff0000])[/color] I have discovered now that some of the drawings which had the macro applied had blocks. All elements aside from the blocks were changed to colour 140. Now I want to improve my macro, or lisp routine, such that all elements within blocks are changed to colour 140, along with non block elements. Is there a way to automate the changing of block definitions with repect to nested object colour?? Would greatly appreciate some insight on this problem.
  • Create New...