Jump to content

Editing blocks alternative lisp


jim78b

Recommended Posts

1 hour ago, jim78b said:

some commands in the blocks do not work, such as axis of symmetry and center of the circles, create nested blocks, command series etc etc

 

So maybe we can turn the question about a bit?

If I start with the assumption that block editor is probably the best way to edit a block, retaining all its properties where ever it is inserted and so on.

 

Now if I take an example from you, inserting nested blocks... well actually editing nested blocks... there might be an easier way around. If I prefix LISP commands with say an 'n-' here:

nbedit : Lisp 'select block', then store the block name for later (if required), save this into a list in case you want to edit multiple levels of nested blocks, then standard bedit

- do your Block Editing until you need to edit a nested block -

nbedit : Same as before.....

- Finish editing the nested block

nbclose : Close the block editor, remove that block reference from the list, then using the new last item in the nbedit blocks list, open that block.

- Should be back into editing the first block now with an updated nested block

nbclose : As before, closes the block editor, delete the list reference and if list is empty don't open a block

 

Something like that is possible I think and retains the benefits of block editor.

 

 

So if you know what you regularly use which doesn't work maybe switch the question about, how to do that in block editor?

 

 

Wblock would also work, and might be a good solution.

 

 

 

 

 

EDIT HERE... example from what I said above, edit nested blocks in block editor then return to the parent block... not a polished solution but an example for you

 

(defun c:nbedit ( / )
  (setq myent (car (entsel)))
  (setq myentname (cdr (assoc '2 (entget myent))))
  (if ( = myentnamelist nil)
    (setq myentnamelist (list myentname))
    (setq myentnamelist (append (list myentname) myentnamelist))
  )
  (command "-bedit" myentname)
)

(defun c:nbclose ( / )
  (setq MyParentBlock (nth 0 myentnamelist))
  (setq myentnamelist (cdr myentnamelist))
  (command "bsave")
  (command "bclose")
  (if (= myentnamelist nil)
    ()
    (progn
      (command "-bedit" MyParentBlock)
    )
  )
)

 

Edited by Steven P
Link to comment
Share on other sites

3 minutes ago, jim78b said:

Yes but i would do it with a macro🙂

Did you find the macro searching as I suggested or where I said it should be on the Ribbon?

 

In the CUI search for the "Write Block" command, the macro should be:

Name

Description

Command Name  WBLOCK

Macro                     ^C^C_wblock

Small image          RCDATA_16_SAVE_BLOCK_AS

Large image          RCDATA_32_SAVE_BLOCK_AS

 

  • Agree 1
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...