Jump to content

Recommended Posts

Posted

Go to the block took the name lisp

Posted

What is this and why would you post such a sentence

Posted

Well we can't accuse the OP of being too verbose.

 

Maybe he is looking for something like SELECTSIMILAR but for blocks. You know...select blocks by name. I think I may have encountered such a lisp routine in my travels. I'll have a look.

 

I'm thinking it may have been by Tharwat. Possibly back in 2012?

Posted
What is this and why would you post such a sentence

 

and such a name?:nono:

Posted

I found the lisp routine but it works differently than I had remembered. The user has to edit the lisp routine for the name of the block they want to find rather than clicking on a block in the drawing. Oh well.

 

I got it. Use QSELECT to find all the instances of a particular block in a drawing. No need for a lisp routine. The sequence is as follows...

 

 

  1. Display the Properties palette (Ctrl+1).
  2. Click the Quick Select button at the upper-right corner of the Properties palette.
  3. In the Quick Select dialog box, from the Object Type drop-down list, choose Block Reference. If you choose one of the blocks before you start, the Object Type will already be set to Block Reference
  4. From the Properties pane, choose Name.
  5. From the Value drop-down list, choose the name of the block that you want to count.
  6. Click OK to close the Quick Select dialog box.

Source: Ellen Finkelstein's website.

Posted

Respectfully, are you assuming OP's intentions or were you able to somehow decipher his 8 word description of a need?

Posted

Yes, because you seem to have an idea of what the OP needs

Posted

It was only a guess. The OP's other requests are just as cryptic.

Posted

Write a lisp block name

 

7mPD25.jpg

Posted

Write a lisp block name

 

7mPD25.jpg[/url[/img]

Posted

This will tell you the name

 

(princ "\nPick a block)
(setq bname (cdr (Assoc 2 (entget (car (entsel))))))
(alert (strcat "Block name is " bname))

Posted

It might help in the future if you (solidworks2014) were a bit more descriptive with your questions.

Posted

try this.

(defun c:blknm()
 (setq blknm (cdr (Assoc 2 (entget (car (entsel))))))
 (setq ptxt (getpoint"\nPoint"))
 (COMMAND "TEXT" ptxt 5 0 blknm )
)

Posted

That code will fail for entities that doesn't use DXF code 2 (i.e. a line), so may be interesting to filter for blocks only:

(if (and (setq ssetBlock (ssget "_:S:E" '((0 . "INSERT"))))
        (setq nameBlock (cdr (assoc 2 (entget (ssname ssetBlock 0)))))
        (setq pointPick (getpoint "\nInsertion point: ")))
(command "_TEXT" "_J" "_MC" "_non" pointPick (getvar "TEXTSIZE") 0.0 nameBlock)
)

Posted
That code will fail for entities that doesn't use DXF code 2 (i.e. a line), so may be interesting to filter for blocks only:

(if (and (setq ssetBlock (ssget "_:S:E" '((0 . "INSERT"))))
        (setq nameBlock (cdr (assoc 2 (entget (ssname ssetBlock 0)))))
        (setq pointPick (getpoint "\nInsertion point: ")))
(command "_TEXT" "_J" "_MC" "_non" pointPick (getvar "TEXTSIZE") 0.0 nameBlock)
)

Thanks MSasu for this clarify you are right for this .

Posted
That code will fail for entities that doesn't use DXF code 2 (i.e. a line), so may be interesting to filter for blocks only:

MSasu Why all of them fail with dynamic block,if it possible to work with DB please clarify the reasons .

thanks.

Posted

Seeing how we are all guessing (solidworks2014 where are you), guys why not just pull block insertion pt out also do a quick polar and write blockname removing need for pick point.

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