Johntosh Posted January 7, 2009 Share Posted January 7, 2009 Is there an option to access the convert to block option without bringing up the dialogue box? I don't appear to be able to get to it using the block command! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 7, 2009 Share Posted January 7, 2009 There is indeed: I worked on this with David Bethel: (defun c:obj2blk1 (/ ss bn pt i ent elist) ; Get Entities (while (not ss) (princ "\nSelect Objects to Convert to Blocks:") (setq ss (ssget '((-4 . "<NOT") (0 . "INSERT,POLYLINE,VIEWPORT") (-4 . "NOT>")))) ) ;_ end while ; Get Block Name and Base Point (while (or (not bn) (not (snvalid bn)) ) ;_ end or (setq bn (getstring "Specify Block Name: ")) ) ;_ end while (initget 1) (setq pt (getpoint "Specify Base Point for Block: ")) ;;; Create BLOCK Header (entmake (list (cons 0 "BLOCK") (cons 10 pt) (cons 2 bn) (cons 70 0))) ;;;STEP THRU THE SET (setq i (sslength ss)) (while (>= i (setq i (1- i)) 0) (setq ent (ssname ss i) elist (entget ent) ) ;_ end setq (entmake elist) ) ;_ end while ;;;FINISH THE BLOCK DEFINITION (entmake (list (cons 0 "ENDBLK") (cons 8 "0"))) ;;;Insert the Block & Delete Originals (entmake (list (cons 0 "INSERT") (cons 2 bn) (cons 8 "0") (cons 10 pt))) (command "_.ERASE" ss "") (redraw) (prin1) ) ;_ end defun Quote Link to comment Share on other sites More sharing options...
eldon Posted January 7, 2009 Share Posted January 7, 2009 Is there an option to access the convert to block option without bringing up the dialogue box? I don't appear to be able to get to it using the block command! Have you tried "-b" Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 7, 2009 Share Posted January 7, 2009 Have you tried "-b" John, You can use the "-BLOCK" and go through the usual command prompts, and its probably easier that way. But if you just want to block the objects, my LISP will bypass all the command prompts and create a block from the selected objects. Quote Link to comment Share on other sites More sharing options...
Johntosh Posted January 7, 2009 Author Share Posted January 7, 2009 eldon Using the -block command doesn't bring about an option to convert the original entities to the block definition. Like the -hatchedit command bring about more options like boundary creation to the -bhatch command. As impressive as Lee and David's solution is I am hoping that there is a command option. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 7, 2009 Share Posted January 7, 2009 What is the purpose of your convert to block function? Used within a LISP or independently? Why do you specifically need a "command" option? Just Curious Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 7, 2009 Share Posted January 7, 2009 The "-block" works well in conjunction with the "-insert" command if you specifically want to do it that way. But it may be quite temperamental! Quote Link to comment Share on other sites More sharing options...
MikeP Posted January 7, 2009 Share Posted January 7, 2009 this is the easiest way and i use it at least 20 times a day all you need to do it select the group of objects type in pb and place where you want to place the block. if you want to copy the group and insert as a block rather than removing the group replace (command "cutclip" ss1 "") with (command "copyclip" ss1 "") (defun c:pb (/ ss1) (setq ss1 (ssget )) (command "cutclip" ss1 "") (command "pasteblock") (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 7, 2009 Share Posted January 7, 2009 Nice solution Mike. Quote Link to comment Share on other sites More sharing options...
eldon Posted January 7, 2009 Share Posted January 7, 2009 eldon Using the -block command doesn't bring about an option to convert the original entities to the block definition. Where have I been going wrong all these years The "-block" command gives the facility to type in the block name, choose the insertion point, and then to select objects (i.e.entities) which then are formed into a block. It works for me. And then you get back the original entities with an "OOPS" Quote Link to comment Share on other sites More sharing options...
MikeP Posted January 7, 2009 Share Posted January 7, 2009 Nice solution Mike. thanks. i try to keep things simple Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 7, 2009 Share Posted January 7, 2009 And then you get back the original entities with an "OOPS" HAHA -- I never knew of the "OOPS" command - I thought you were joking when you posted it! I looked it up in ACAD help... brilliant! Great command name! haha, that made my day Quote Link to comment Share on other sites More sharing options...
Johntosh Posted January 7, 2009 Author Share Posted January 7, 2009 That's cute MikeP Lee: I am wanting to make the block - with attributes - and then these are extracted. I only need the one original block. Quote Link to comment Share on other sites More sharing options...
Johntosh Posted January 7, 2009 Author Share Posted January 7, 2009 Eldon My orignal entities did disappear and I founf the oops command, now when I make the -block all my entites are still seperated; I can however insert that block definition. so we're all looking in the same place: it's the 'Convert to Block' option in the 'Objects' tab in the block definition dialogue box that I am trying to select. I'm supposijg that this will cure my problem. Maybe it's a system variable? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 7, 2009 Share Posted January 7, 2009 Lee: I am wanting to make the block - with attributes - and then these are extracted. I only need the one original block. Ahh, ok - I see. Quote Link to comment Share on other sites More sharing options...
MikeP Posted January 7, 2009 Share Posted January 7, 2009 well if you do attdef and create the attributes it will be carried over when you do the PB command. Quote Link to comment Share on other sites More sharing options...
eldon Posted January 7, 2009 Share Posted January 7, 2009 Eldon My orignal entities did disappear and I founf the oops command, now when I make the -block all my entites are still seperated; I can however insert that block definition. You only do an "OOPS" if you want the original entites back as entities in the drawing. Otherwise they are all safely tucked up as the named block which can then be inserted. You have to define the attributes before making a block, and then they can be selected with any other entity to make the complete block. If an attribute is defined as invisible, it only becomes invisible when it is included in the block, otherwise you could never see it to choose it. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 7, 2009 Share Posted January 7, 2009 Everything can be done via the command line in this instance: create atts (-attdef) create block (-block) retrieve block (-insert) Shouldn't be any probs with that... And, of course, that legendary command "oops" if you want to keep the originals. Quote Link to comment Share on other sites More sharing options...
Johntosh Posted January 8, 2009 Author Share Posted January 8, 2009 Morning guys Thanks for your forbearance. My script does this… I define my attributes using –attdef (Invisible = “N”. In fact all defaults are used)) I define my block using –block (this collects the entity and the attributes from a selection set) This block then disappears from the screen, although the complete block has been defined as I can insert it into my drawing using –insert (this is a step more than I prefer) I read that the oops command would bring them back, which it did but as separate entities. So my reckoning is that the ‘delete’ option is selected and not ‘convert to block’ or ‘retain’ in the block dialogue box under the objects tab which I am struggling to find out how to change using the command line. I should have mentioned that I had no problems creating the attributes. Quote Link to comment Share on other sites More sharing options...
eldon Posted January 8, 2009 Share Posted January 8, 2009 It appears that the option to "convert to block" only arrived with the dialogue box, and the command line version was not updated to include that option. (My reference to the Invisible attribute was a whimsical musing on an apparent paradox) 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.