irneb Posted July 6, 2011 Share Posted July 6, 2011 Yep, you could use the getfiled function to ask for the filename. If you send it the dwg extension is looks very much the same as a saveas (including the preview box). Quote Link to comment Share on other sites More sharing options...
BlackBox Posted July 6, 2011 Share Posted July 6, 2011 Woodman78, you're killing me.... I get your points about the wblock and I did consider it but I won't be saving the drawing to the same location each time. The user will choose the save location. ... If I was to do wblock could I invoke a dialog to choose the folder to save the drawing to and the drawing name. A bit like saveas? Have you never used wblock before? The wblock dialog has a button to both browse and named the new file already included: ... Never mind the QSELECT button in the upper right, which allows quick access to selecting all objects on a specified layer. I know there are a few guys here who get freaked out by anything that isn't an open or save dialog box. These individuals use Civil 3D!? Regardless, this is a training issue, and *should* be the least of your concerns as you develop functions... never mind in this case where you're simply using a core AutoCAD command. These individuals need to be educated on the capabilities of the platform on which they work, and get over their tendency to "get freaked out by anything that isn't an open or save dialog box." Failing to resolve this personal issue will continue to hold your production team back, and make additional technological advances all the more difficult. Quote Link to comment Share on other sites More sharing options...
woodman78 Posted July 6, 2011 Author Share Posted July 6, 2011 Oh believe me I know Renderman, oh I know. I went to management recently and got them to back me up on pushing standards through. I have one guy here and he asks me the same thing over and over again. If I show him something he says yeah and then the next time he asks as if he's never been shown. It is very frustrating but I have to work with what we have. I am trying to bring him along but it is very slow. And believe me I am very used to using wblock. But I am also aware of reality and reality is that some of these guys aren't very used to CAD or experienced. I have done along of work on standards. I have creates lisps for many aspects of our work and I have created standard legend blocks and standard notes. But I realised quite early on the the carrot is much more effective than the stick. Quote Link to comment Share on other sites More sharing options...
woodman78 Posted July 6, 2011 Author Share Posted July 6, 2011 I added the getfiled to my lisp and it does bring up the dialog box and I enter a filename and it appears to save it but it actually doesn't. This is what I have. (defun C:townland (/ pline SUCE SUOM SUSM SUAB SUAD SUCL SUCR) (setq SUCE (getvar "cmdecho")) (setq SUOM (getvar "orthomode")) (setq SUSM (getvar "osmode")) (setq SUAB (getvar "angbase")) (setq SUAD (getvar "angdir")) (setq SUCL (getvar "clayer")) (setq SUCR (getvar "cecolor")) (setq vl1 (list (cons 0 "LAYER") ;Name of entity (cons 100 "AcDbSymbolTableRecord") ;Open Records (cons 100 "AcDbLayerTableRecord") ;Locate Layer Table (cons 2 "CCC_LAYOUT_Townland_Boundary") ;Name of Layer (cons 6 "Continuous") ;Linetype (cons 62 7) ;colour = light grey (cons 70 0) ;state (cons 290 1) ;1=plot, 0=Don't plot ) ;End of entity list ) (entmake vl1) (setvar "clayer" "CCC_LAYOUT_Townland_Boundary") (setq ptlist nil) (while (setq pline(entsel "\nSelect a line or press ENTER when finished: ")) (command "_.insert" "townland_boundary" nil) (command "measure" pline "b" "townland_boundary" "y" "5" "") (setq ptlist (append ptlist (list pt))) ) (setq SS1 (ssget "X" (list '(0 . "INSERT") (cons 2 "townland_Boundary")))) (getfiled "Save Townland Boundary XREF" "" "dwg" 1) (setvar "cmdecho" SUCE) (setvar "orthomode" SUOM) (setvar "osmode" SUSM) (setvar "angbase" SUAB) (setvar "angdir" SUAD) (setvar "cecolor" SUCR) (princ) ) Quote Link to comment Share on other sites More sharing options...
BlackBox Posted July 6, 2011 Share Posted July 6, 2011 No worries; I hope I've not harped on you too bad. Thanks for clarifying the situation - that makes much more sense now. It is unfortunate that you have to go this far out of the way in order to give your users something more easily accepted by their in-experience level. Keep on, keeping on.... Quote Link to comment Share on other sites More sharing options...
irneb Posted July 6, 2011 Share Posted July 6, 2011 The getfiled just gives you the name & path of the file. You still need to send that to somewhere (e.g. to the wblock command, or even the saveas). It's a general purpose file selection dialog, it doesn't actually do anything on its own. Quote Link to comment Share on other sites More sharing options...
woodman78 Posted July 6, 2011 Author Share Posted July 6, 2011 Thanks Irneb. This is what I have now: (setq saref (getfiled "Save Townland Boundary XREF" "" "dwg" 1)) (command "._wblock" saref "" "_None" '(0.0 0.0 0.0) (ssget "_X" (list (cons 8 (getvar "CLAYER")))) "") using your earlier code. It works great apart from the very last part where it asks to include Map info or not. I've tried adding a "n" into the wblock command but no joy. How do I get around this one? Quote Link to comment Share on other sites More sharing options...
irneb Posted July 6, 2011 Share Posted July 6, 2011 I'm sorry I don't have map/civil so mine doesn't ask for another query. Is the default answer "N"? Perhaps just add another blank string "" (as if enter). Or else look if the full word No should be passed, or perhaps "_No" to allow for other languages. BTW, you can check if the command has completed, if not keep passing enters: (while (/= (logand (getvar "cmdactive") 1) 0) (command "")) Quote Link to comment Share on other sites More sharing options...
BlackBox Posted July 6, 2011 Share Posted July 6, 2011 FYI - The last dailog simply asks if the user wants to include Map data. I'd have to dig into it as I cannot recall, but perhaps a simple expert variable setting manipulation will resolve this. Quote Link to comment Share on other sites More sharing options...
irneb Posted July 6, 2011 Share Posted July 6, 2011 FYI - The last dailog simply asks if the user wants to include Map data. I'd have to dig into it as I cannot recall, but perhaps a simple expert variable setting manipulation will resolve this.Perhaps something like FileDia? I know there's one or two commands around which pop open their dialogs even though they're called from lisp/script. Otherwise perhaps use the hyphen (minus sign) prefix on the wblock:(command ".-_wblock" ;... Quote Link to comment Share on other sites More sharing options...
woodman78 Posted July 6, 2011 Author Share Posted July 6, 2011 The looking for Map data happens on the command line. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted July 6, 2011 Share Posted July 6, 2011 I can't remember what it was... I thought is was the expert, or qaflags sysvar, but I cannot get it to prevent the suplemental dialog. Fildedia doesn't do anything either, nor cmddia. If I remember, I'll post back... I could have sworn I had used this very functionality in a routine last year. :frustrated: Quote Link to comment Share on other sites More sharing options...
woodman78 Posted July 7, 2011 Author Share Posted July 7, 2011 I tried looking at the "expert" variable but it didn't work. Quote Link to comment Share on other sites More sharing options...
woodman78 Posted July 11, 2011 Author Share Posted July 11, 2011 Hey, did anyone come up with anything on this? Is there some way I can force it to accept "n". Quote Link to comment Share on other sites More sharing options...
VVA Posted July 12, 2011 Share Posted July 12, 2011 Is there a way in lisp to delete all layers except the current? 1. Download bgtools 2.10.rar 2. Turn off (freeze) layer that you want to delete 3. Run BGLAYDEL command 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.