Jump to content

How to construct a block name in a list ?


Recommended Posts

Posted

I want to enter name of a Block and after that going to erase it by the command call as shown below .

 

(defun c:test (/ e a )
 (if (setq e (getstring "\n Enter Block name to delete :"))
    (progn
      (setq a (ssget "_x" '((0 . "INSERT")[color=red][b](cons 2 e)[/b][/color])))[b][color=red]<- The problem is here[/color][/b]
         (command "_.erase" a "")
      )
   (princ)
   )
 (princ)
 )

 

Thanks

Posted

Read this about the use of quoted statements, and see if you can come up with a solution.

Posted

tharwat, I have to ask: what is the logic behind your variable naming?

Posted

I got it worked Lee. :)

 

(defun c:test (/ e a )
 (if (setq e (getstring "\n Enter Block name to delete :"))
    (progn
      (setq a (ssget "_x" (list '(0 . "INSERT")(cons 2 e))))
         (command "_.erase" a "")
      )
   (princ)
   )
 (princ)
 )

 

Thanks

Posted
tharwat, I have to ask: what is the logic behind your variable naming?

 

Nothing. :)

 

So I would ask , what kind of sence does it give ? :)

 

I would like to know your opinion.

Posted
Nothing. :)

 

So I would ask , what kind of sence does it give ? :)

 

I would like to know your opinion.

I just don't see how "e" correlates to a block name string (Why not something like s/str/string/b/blk/block/n/name?) or how "a" correlates to your selection set (Why not ss/selectionset?). It's your routine, I was just wondering how your defined variables relate to what they are defining.

Posted
tharwat, I have to ask: what is the logic behind your variable naming?

 

Its the brackets that confuse me... :wacko:

Posted
I just don't see how "e" correlates to a block name string (Why not something like s/str/string/b/blk/block/n/name?) or how "a" correlates to your selection set (Why not ss/selectionset?). It's your routine, I was just wondering how your defined variables relate to what they are defining.

 

Yeah .... that's the proper way in dealing with variable names and a good naming to return to when being in need of them .

 

But for me , I used "e" as a matter of Entity to get . and for "a" as the first action to do within "progn" list .

 

That's it .

Posted
Its the brackets that confuse me... :wacko:

 

Do not tell me it is the "insert tab" option ! !!! :lol:

Posted
Do not tell me it is the "insert tab" option ! !!! :lol:

 

Its more the alignment, try to align the closing parenthesis with the relevant expression - makes for easier reading.

Posted
Yeah .... that's the proper way in dealing with variable names and a good naming to return to when being in need of them .

 

But for me , I used "e" as a matter of Entity to get . and for "a" as the first action to do within "progn" list .

 

That's it .

Whatever tickles your pickle.

Posted
Whatever floats your boat...

 

Whatever tickles your pickle...

 

Whatever next... :P

Posted
Whatever next... :P

I'm sure I'll come up with something else.

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