Jump to content

Convert to block


Johntosh

Recommended Posts

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!

Link to comment
Share on other sites

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    23

  • Johntosh

    8

  • David Bethel

    5

  • ectech

    5

Top Posters In This Topic

Posted Images

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

Link to comment
Share on other sites

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" :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :P

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

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"

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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) :shock:

Link to comment
Share on other sites

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