Hi,
Could anyone assist me in modifying the following code that I found to enable the following:
step 1:Select blocks
step 2: Select a single point that all blocks should point towards (blocks are arrows and all have to point towards mecca)
step 3: then using the rotate command on each block
base point = insertion point
use a reference angle of 90
for the new angle it should use a point (that being the point selected in step 2)
#
;RotBlock.lsp by Maurizio
;Start code
(defun C:RotBlock ()
(princ “nSelect blocks: “)
(setq grp (ssget))
(setq rotAngle (getangle “nRotation angle: “)) ;
(setq rotAngle (atof (angtos rotAngle 0)))
(setq j 0)
(repeat (sslength grp)
(setq eName (ssname grp j))
(setq pt (cdr (assoc 10 (entget eName))))
(command “_rotate” eName “” pt rotAngle)
(setq j (1+ j))
)
)
;End code
#
for me I need to change this to
(setq rotAngle (getangle “nRotation angle: “)) ;
(setq rotAngle (atof (angtos rotAngle 0)))
to (setq Rotangle (getpoint "nRotate block to point: "))
and this line
(command “_rotate” eName “” pt rotAngle)
to (command "_rotate" ename "" pt "_r" "90" "_p" rotangle)
but that does not do it.
any ideas? I thought it strange that I was not able to find a similar lisp online.
Any help much appreciated.
thanks