Jump to content

Recommended Posts

Posted

Yes, but can you put the "Alert that the drawing already exists" so they know why it didn't block the item?

 

thanks

brian

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • BrianTFC

    15

  • Tharwat

    14

  • Lee Mac

    2

Posted
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 .

Posted

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

Posted
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 . :thumbsup:

Posted

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

Posted
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 . :x

Posted

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.:(

Posted

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])

Posted

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.:oops:

 

Thank You to Tharwat And Lee Mac for all of your help it is very much appreciated.:thumbsup:

Brian

Posted (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 by Tharwat

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...