AboutScott Cook Expertise I`ve been using AutoCAD since 1987 and programming AutoLISP nearly as long. I can answer questions about programming AutoCAD (except ARX) and production enhancement techniques. I cannot answer questions about AutoCAD crashes or DWG corruption. AutoCAD PROGRAMMING (menus, lisp) related questions only!
Experience Since 1987. Author of Plot2000 software for for AutoCAD, http://www.plot2000.com.
PROGRAMMING QUESTIONS ONLY PLEASE. Questions that are NOT related to programming or AutoCAD customization (menus and lisp only please) are outside the scope of my volunteer services and will NOT BE ANSWERED.
Question AutoCAD 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!
Answer I 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 ...)