Jump to content

To select all blocks which have same name inside a selection windoe


Recommended Posts

Posted

Please can you help me to write a lisp code; to select at once all blocks which have same name (dot) and inside a selection window.

And after that I need to change scale factor of that blocks.

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • wimal

    9

  • Tharwat

    7

  • alanjt

    4

  • Lee Mac

    4

Posted

This ...?

 

(defun c:TesT (/ sc ss i sn)
 ;;; Tharwat 13. Dec. 2011 ;;;
 (if (and (setq sc (getdist "\n Specify Scale factor :"))
          (setq ss (ssget "_:L" '((0 . "INSERT") (2 . "dot"))))
     )
   (progn (repeat (setq i (sslength ss))
            (setq sn (ssname ss (setq i (1- i))))
            (command "_.scale" sn "" (cdr (assoc 10 (entget sn))) sc)
          )
          (sssetfirst nil ss)
   )
   (princ)
 )
 (princ)
)

Posted

Another, by modification of the DXF Group codes:

 

(defun c:scaleblocks ( / ent inc sel )
   (if
       (and
           (setq sel (ssget "_:L" '((0 . "INSERT") (2 . "dot"))))
           (setq *scale*
               (cond
                   (   (getdist
                           (strcat "\nSpecify Scale <"
                               (rtos (setq *scale* (cond (*scale*) (1.0)))) ">: "
                           )
                       )
                   )
                   (   *scale*   )
               )
           )
       )
       (repeat (setq inc (sslength sel))
           (setq ent (entget (ssname sel (setq inc (1- inc)))))
           (foreach x '(41 42 43) (setq ent (subst (cons x *scale*) (assoc x ent) ent)))
           (entmod ent)
       )
   )
   (princ)
)

Posted

Thanks a lot.

Both files are working properly.But difference ways.

 

Please can you wright one more code to select single line text that height is 100 and to change the height. If you do that it is very convenience to my cad jobs.

Posted
Again: QSELECT > PROPERTIES

Again: QSELECT > PROPERTIES

Posted
Again: QSELECT > PROPERTIES

 

Most of users would forget to use the basic commands that are attached within Cad with the use of Lisp , although that

I recommend using them . :D

 

(defun c:TesT (/ sc ss i sn)
 ;;; Tharwat 13. Dec. 2011 ;;;
 (if (and (setq sc (getdist "\n Specify new height :"))
          (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT") (40 . 100))))
     )
   (repeat (setq i (sslength ss))
            (setq sn (ssname ss (setq i (1- i))))
            (entmod (subst (cons 40 sc) (assoc 40 (entget sn))(entget sn)))
   )
   (princ)
 )
 (princ)
)

Posted
Most of users would forget to use the basic commands that are attached within Cad with the use of Lisp , although that

I recommend using them . :D

 

(defun c:TesT (/ sc ss i sn)
 ;;; Tharwat 13. Dec. 2011 ;;;
 (if (and (setq sc (getdist "\n Specify new height :"))
          (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT") (40 . 100))))
     )
   (repeat (setq i (sslength ss))
            (setq sn (ssname ss (setq i (1- i))))
            (entmod (subst (cons 40 sc) (assoc 40 (entget sn))(entget sn)))
   )
   (princ)
 )
 (princ)
)

Because people continue to post erroneous code, instead of just informing them of existing commands.

Posted
Because people continue to post erroneous code, instead of just informing them of existing commands.

Hope you don't talking about annotative texts .

Posted
Hope you don't talking about annotative texts .

facepalm-TommyLeeJones2.jpg

Posted

Thanks for all information.

But I could not found the way to use QSELECT command with command prompt

It is always going to dialog box:(.

Posted
Again: QSELECT > PROPERTIES

FILTER would be a better alternative, right? This way it gives the poster the use of a selection box, plus you can save Selection Filters.

 

Because people continue to post erroneous code, instead of just informing them of existing commands.
Hope you don't talking about annotative texts .
This made me el-oh-el.
Posted

 

This made me el-oh-el.

Made me whuh-tha-hell.

Posted

Even filter command could not use with the command prompt.

So I cannot feed data from a lisp code to evaluate.

That is why I asked some lisp codes.

Thanks all.

Posted

 

This made me el-oh-el.

 

Made me whuh-tha-hell.

 

What's made what ?

Posted

I try to feed a variable instead of value 100 to the following way but failed.What is the reasn

(setq [b][color=red]ht 100[/color][/b])(setq ss (ssget "_:L" '((0 . "TEXT,MTEXT") (40 . [b][color=red]ht[/color][/b]))))

;;Originally Posted by Tharwat
(defun c:TesT (/ sc ss i sn)   ;;; Tharwat 13. Dec. 2011 ;;;   (if (and (setq sc (getdist "\n Specify new height :"))            (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT") (40 . [color=red][b]100[/b][/color]))))       )     (repeat (setq i (sslength ss))              (setq sn (ssname ss (setq i (1- i))))              (entmod (subst (cons 40 sc) (assoc 40 (entget sn))(entget sn)))     )     (princ)   )   (princ)

Posted

This way .... ? :)

 

(setq ht 100)
(setq ss (ssget "_:L" (list '(0 . "TEXT,MTEXT") (cons 40 ht))))

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