AutoCAD/AutoLISP - assoc 50 rotation angle
Expert: Scott Cook - 3/4/2006
QuestionAutoCAD 2006, I would like to create a LISP routine that filters my selection to a certain block with a certain rotation angle. Manually, I do this by running the FILTER command, choosing the block name and rotation angle. Then I move the filtered objects to where I want. This is basically done 4 separate times for each block because of the 4 main ortho rotations, 0, 90, 180, 270.
I need to do this because I am redfining our furniture blocks and there were already 2 different sets of blocks in the drawings with different insertion points (Before I came on board). When the old blocks are replaced with the new blocks, the blocks move because of the different insertion points.
I know how to create simple LISP files that only use the "command" structure, but I don't understand the setq, ssget fully. I have some idea that I need to filter using (assoc 2) & (assoc 50) for the block name & rotation angle, but I don't know the full syntax of putting everything together to accomplish this filter. I would add moving this selection set as well to the lisp.
Alternatively, if I could redefine the old blocks to have the same insertion point as the new block, but not have the old block change position in the drawing, that would work as well.
Any help is greatly appreciated!
AnswerI think it would be something like this:
(setq ss1 (ssget "X"
'(
(-4 . "<AND")
(2 . "blockname")
(-4 . "<OR")
(50 . 0)
(50 . (/ pi 2.0))
(50 . pi)
(50 . (* pi 1.5))
(-4 . "OR>")
(-4 . "AND>")
)
))
(command "move" ss1 ...)