Hello,
My question is, I have 10 blocks on the screen and I would like to select any 3 of the 10 blocks and be able to erase all 10 blocks and insert the 3 that where selected. Does anyone know what would be the best way to do this?
Thanks,
Steve
Things like this ... ?
(defun c:Test (/ ss s i sn p) ;;; Tharwat 28. May. 2012 ;;; (if (and (setq ss (ssget "_:L" '((0 . "INSERT")))) (> (sslength ss) 2) ) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (if (< (length s) 3) (setq s (cons (cdr (assoc 2 (entget sn))) s)) ) (entdel sn) ) ) (if (and (eq (length s) 3) (setq p (getpoint "\n Specify point to insert the three Blocks :") ) ) (foreach x s (entmakex (list '(0 . "INSERT") (cons 10 p) (cons 2 x) '(41 . 1.0) '(42 . 1.0) '(43 . 1.0) ) ) ) ) (princ) )
@safcadd08 wrote:
Hello Mentor, Wouldyou send me an email to safcadd@gmail.com and I will be able to give you the details of what I want to do. Thanks, Steve
I suppose other forum members wont be able to suggest/advice/chime-in then
This forum is also about sharing after all.
@pbejse wrote:I suppose other forum members wont be able to suggest/advice/chime-in then
This forum is also about sharing after all.
You know that you can , and you are always welcome to your precious and unique ideas pBe
Feel free to give what you have in mind to the OP and me as well .
Regards
@safcadd08 wrote:.... I have 10 blocks on the screen and I would like to select any 3 of the 10 blocks and be able to erase all 10 blocks and insert the 3 that where selected. Does anyone know what would be the best way to do this?
....
Do you want to re-Insert the selected Blocks in a different place than where they were? If you want to re-Insert them in the same place, it would be easy to come up with something that doesn't do that, but simply Erases all the rest except for the selected ones. And if you don't want them in the same place, do you want to Insert all 3 at once, keeping their positional relationship to each other, or do you want to Insert each one in its own new location?
And when you say "10 Blocks", are those all the Blocks in the drawing of any name, or 10 insertions of the same Block name? That would affect what you should use in a selection-set filter in (ssget) to find them all. You also say "on the screen," which makes me wonder whether you want to work with only those that are currently visible, or with all such Blocks in the drawing, whether visible at the moment or not.
Kent,
This might be a better explanation::
1.> I have 10 blocks (1x to 10x) on the screen.
2.> I want to pick any 3 at random, write the block names to a file. For future use.
3.> Be able to read the file and insert the 3 blocks at 3 user specified points.
Thanks,
Steve
@safcadd08 wrote:Kent,
This might be a better explanation::
1.> I have 10 blocks (1x to 10x) on the screen.
2.> I want to pick any 3 at random, write the block names to a file. For future use.
3.> Be able to read the file and insert the 3 blocks at 3 user specified points.
Thanks,
Steve
I personally would prefer a list of blocks hardcoded on a routine.
Example
(defun c:Ib ( / blks blklst cnt blknum)
(vl-load-com)
(setq blks '("Block1" "Block2" "Block3" "Block4" "Block5"
"Block6" "Block7" "Block8" "Block9" "Block10")
blklst nil)
(textscr)
(while
(or (initget 6)
(and (foreach
nme blks
(print (setq cnt (1+ cnt)))
(princ (strcat "\t" nme)))
(setq cnt 0
blknum (getint
(strcat
"\nEnter Block index number "
(if blklst
(strcat
"<Enter when done>: "
(vl-prin1-to-string blklst)
": ")
": ")))))
)
(if (<= blknum 5)
(setq blklst
(append blklst
(list (nth (1- blknum) blks))))
(princ "\nIndex number does not exist")
))
(graphscr)
(foreach
itm
blklst
(command "_Insert" itm "_Scale" "1" "_non" pause pause)
)
)
HTH