YZ Posted October 22, 2008 Share Posted October 22, 2008 We have just worked out that the house lines in a series of diagrams blend in too much, and so I need to modify that layer's colour in order to plot thicker on our CTB file. Three layers are affected: HOUSE, SHED & GARAGE. They need to change from white to cyan. There are almost 100 drawing files, mostly in the same folder. Can someone tell me if this kind of repetitive task is one that a LISP routine could achieve? (Despite my profile I have access to full version in our office) Thanks. Quote Link to comment Share on other sites More sharing options...
ska67can Posted October 22, 2008 Share Posted October 22, 2008 Here's a vba routine I use in Excel: Sub DbxEx() Dim oDbx As AxDbDocument 'Add Reference to ObjectDbx Library Dim fPath, fName As String Dim oLay As AcadLayer fPath = "C:\Documents and Settings\user\Desktop\New Folder\" 'Change Directory to Suit fName = Dir(fPath & "*.dwg", vbNormal) Do Until fName = "" Set oDbx = AcadApplication.GetInterfaceObject("ObjectDBX.AxDbDocument.17") 'Change to match Your Version oDbx.Open (fPath & fName) For Each oLay In oDbx.Layers If oLay.Name = "HOUSE" Or oLay.Name = "SHED" Or oLay.Name = "GARAGE" Then oLay.color = acWhite End If Next oLay oDbx.SaveAs (fPath & fName) Set oDbx = Nothing fName = Dir() Loop End Sub ska Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted October 22, 2008 Share Posted October 22, 2008 a script file would do it as well, and is easier to write and run than trying to make a program to do it. However, that being said, we could do it in VBA or LISP, which ever you want Quote Link to comment Share on other sites More sharing options...
Rsteel13 Posted October 22, 2008 Share Posted October 22, 2008 I have the following Lisp routine that I want to apply to any DXF saved within a specified folder. I have located several BATCHing routines, but can't seem to fit it altogether. What was suggested about to create the VBA code above in a LISP routine would be great. As of now, what I am doing is opening the file, and then clicking the button I created for the routine below. I got the routine to automaticaly save the file as a DWG (i don't want to replace the DXF file) and then close it. Thus leaving me to open the next DXF file manually. Any thoughts? (defun C:3dtrs (/ tfl tpth tfilnam tfilinfo) (command "erase" (ssget "X" (list (cons 8 "ELEMENTS"))) "") (command "_pedit" "M" (ssget "X") "" "y" "J" "" "") (command "-purge" "La" "ELEMENTS" "N") (command "_extrude" (ssget "X") "" "1.75" "") (command "-view" "_left") (command "rotate" (ssget "X") "" "0,0,0" "270") (setq tfl (getvar "dwgname")) (setq tpth (getvar "dwgprefix")) (setq tfilnam (substr tfl 1 (- (strlen tfl) 4))) (setq tfilinfo (strcat tpth tfilnam ".dwg")) (command "saveas" "" tfilinfo) (command "close") (princ) ) Thanks, Robert Quote Link to comment Share on other sites More sharing options...
YZ Posted October 22, 2008 Author Share Posted October 22, 2008 Thanks ska. a script file would do it as well, and is easier to write and run than trying to make a program to do it. However, that being said, we could do it in VBA or LISP, which ever you want And thanks CmdrDuh. A script file would be fine. Forgive my ignorance, but I thought that was what a LISP routine was. So I might be using terms in a confusing way. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.