BrianTFC Posted March 27, 2013 Author Posted March 27, 2013 Yes, but can you put the "Alert that the drawing already exists" so they know why it didn't block the item? thanks brian Quote
Tharwat Posted March 27, 2013 Posted March 27, 2013 Yes, but can you put the "Alert that the drawing already exists" so they know why it didn't block the item? thanks brian Sure , but it is a bad idea to include the alert function within the process of the repeat function , and anyway since that is your needs I would not disappoint you with it . See the updated codes as indicated in the previous post . Quote
BrianTFC Posted March 27, 2013 Author Posted March 27, 2013 Tharwat, It works pefectly and it's dumby proof. THANK YOU!! for all of your help with this. I'm slowly learning what everything means when it comes to Lisp. Brian:D Quote
Tharwat Posted March 27, 2013 Posted March 27, 2013 Tharwat, It works pefectly and it's dumby proof. THANK YOU!! for all of your help with this. I'm slowly learning what everything means when it comes to Lisp. Brian:D Excellent , You're welcome . Quote
BrianTFC Posted March 28, 2013 Author Posted March 28, 2013 I had someone run the lisp through the paces and they found only one thing wrong with it, can you make it to where when it wblocks the block out that it would be an exploded dwg file? The program that i had you write the lisp routine for uses individual dwg files, but won't use the file if its a block. We do some very big jobs to where we would have 300 individual dwg files to run throgh this program and it would defeat the purpose to open up every file just to explode them. Thanks, Brian Quote
Tharwat Posted March 28, 2013 Posted March 28, 2013 I had someone run the lisp through the paces and they found only one thing wrong with it, You are wrong Brian to say after all over these posts that the code is wrong , and with almost every reply you wanted to export the objects as blocks and after all you blame the code ? That's not a good paying back the favor to me . Quote
BrianTFC Posted March 28, 2013 Author Posted March 28, 2013 My appoligies...im not blaming the code at all. it was my fault intirely and not explaining to you what the end result was supposed to be. i'm sorry if i offended you in any way. Quote
Lee Mac Posted March 28, 2013 Posted March 28, 2013 Easter treat: try this quickly-written program Brian, it should perform as required: [color=GREEN];; WBlock Rectangles - Lee Mac[/color] [color=GREEN];; For improved performance, disable DWG thumbnail generation[/color] ([color=BLUE]defun[/color] c:wbr ( [color=BLUE]/[/color] app blk cpy dir doc dwg err in1 in2 llp lst mid obj org sel ssc sso tmp urp ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] sel ([color=BLUE]ssget[/color] [color=MAROON]"_:L"[/color] '((0 . [color=MAROON]"LWPOLYLINE"[/color])))) ([color=BLUE]progn[/color] ([color=BLUE]setq[/color] app ([color=BLUE]vlax-get-acad-object[/color]) doc ([color=BLUE]vla-get-activedocument[/color] app) ssc ([color=BLUE]vla-get-selectionsets[/color] doc) sso ([color=BLUE]vl-catch-all-apply[/color] '[color=BLUE]vla-item[/color] ([color=BLUE]list[/color] ssc [color=MAROON]"wbr-sel"[/color])) org ([color=BLUE]vlax-3D-point[/color] 0 0) dir ([color=BLUE]getvar[/color] 'dwgprefix) ) ([color=BLUE]if[/color] ([color=BLUE]vl-catch-all-error-p[/color] sso) ([color=BLUE]setq[/color] sso ([color=BLUE]vla-add[/color] ssc [color=MAROON]"wbr-sel"[/color])) ) ([color=BLUE]vla-zoomextents[/color] app) ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] in1 ([color=BLUE]sslength[/color] sel)) ([color=BLUE]setq[/color] obj ([color=BLUE]vlax-ename->vla-object[/color] ([color=BLUE]ssname[/color] sel ([color=BLUE]setq[/color] in1 ([color=BLUE]1-[/color] in1))))) ([color=BLUE]vla-getboundingbox[/color] obj 'llp 'urp) ([color=BLUE]setq[/color] llp ([color=BLUE]vlax-safearray->list[/color] llp) urp ([color=BLUE]vlax-safearray->list[/color] urp) mid ([color=BLUE]vlax-3D-point[/color] ([color=BLUE]mapcar[/color] '([color=BLUE]lambda[/color] ( a b ) ([color=BLUE]/[/color] ([color=BLUE]+[/color] a b) 2.0)) llp urp)) ) ([color=BLUE]vla-clear[/color] sso) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] tmp ([color=BLUE]ssget[/color] [color=MAROON]"_C"[/color] ([color=BLUE]trans[/color] urp 0 1) ([color=BLUE]trans[/color] llp 0 1))) ([color=BLUE]progn[/color] ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] in2 ([color=BLUE]sslength[/color] tmp)) ([color=BLUE]setq[/color] cpy ([color=BLUE]vla-copy[/color] ([color=BLUE]vlax-ename->vla-object[/color] ([color=BLUE]ssname[/color] tmp ([color=BLUE]setq[/color] in2 ([color=BLUE]1-[/color] in2))))) lst ([color=BLUE]cons[/color] cpy lst) ) ([color=BLUE]vla-move[/color] cpy mid org) ([color=BLUE]if[/color] ([color=BLUE]=[/color] [color=MAROON]"AcDbText"[/color] ([color=BLUE]vla-get-objectname[/color] cpy)) ([color=BLUE]setq[/color] blk ([color=BLUE]vla-get-textstring[/color] cpy)) ) ) ([color=BLUE]cond[/color] ( ([color=BLUE]null[/color] blk)) ( ([color=BLUE]not[/color] ([color=BLUE]snvalid[/color] blk)) ([color=BLUE]princ[/color] ([color=BLUE]strcat[/color] [color=MAROON]"\nInvalid block name \""[/color] blk [color=MAROON]"\"."[/color])) ) ( ([color=BLUE]findfile[/color] ([color=BLUE]setq[/color] dwg ([color=BLUE]strcat[/color] dir blk [color=MAROON]".dwg"[/color]))) ([color=BLUE]princ[/color] ([color=BLUE]strcat[/color] [color=MAROON]"\n"[/color] dwg [color=MAROON]" already exists."[/color])) ) ( ([color=BLUE]progn[/color] ([color=BLUE]vlax-invoke[/color] sso 'additems lst) ([color=BLUE]vl-catch-all-error-p[/color] ([color=BLUE]setq[/color] err ([color=BLUE]vl-catch-all-apply[/color] '[color=BLUE]vla-wblock[/color] ([color=BLUE]list[/color] doc dwg sso)))) ) ([color=BLUE]princ[/color] ([color=BLUE]strcat[/color] [color=MAROON]"\nError creating drawing: "[/color] dwg [color=MAROON]"\nDetail: "[/color] ([color=BLUE]vl-catch-all-error-message[/color] err) ) ) ) ) ([color=BLUE]foreach[/color] obj lst ([color=BLUE]vla-delete[/color] obj)) ([color=BLUE]setq[/color] lst [color=BLUE]nil[/color] blk [color=BLUE]nil[/color] ) ) ) ) ([color=BLUE]vla-zoomprevious[/color] app) ([color=BLUE]vla-delete[/color] sso) ) ) ([color=BLUE]princ[/color]) ) ([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color]) Quote
BrianTFC Posted March 28, 2013 Author Posted March 28, 2013 Thanks you Lee, yes this is what i was looking for. Tharwat has been a big help, if i would have asked the right question's he wouldn't wasted some much time. Sorry about that Tharwat. Thank You to Tharwat And Lee Mac for all of your help it is very much appreciated. Brian Quote
Tharwat Posted March 28, 2013 Posted March 28, 2013 (edited) My appoligies...im not blaming the code at all. it was my fault intirely and not explaining to you what the end result was supposed to be. i'm sorry if i offended you in any way. NO worries Brian , You do know that I was about to write the code for you according to the last new modification on the code , but during the time that Lee wrote the routine for you , I was leaving the office for home and he did beat me to it . Edited March 28, 2013 by Tharwat Quote
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.