Lisp to bulk rotate north arrows based on specific Viewport

Lisp to bulk rotate north arrows based on specific Viewport

Anonymous
Not applicable
822 Views
1 Reply
Message 1 of 2

Lisp to bulk rotate north arrows based on specific Viewport

Anonymous
Not applicable

Hi,

Im pretty New to Lisps, Trying to get the below working. I have about 200 drawings and i want to update all the north arrows as multiple views have changed, i can right a script to delete the old arrows and insert a new one in the paper space just trying to sort out a bit of lisp routine to rotate the new north arrow based on the main viewport (i have 2 in each drawing)

 

This is what I have:

 

(setq tw(entget(car(ssget "_F" '((280 565) (270 575)) '((0 . "VIEWPORT"))))))
(setq new (cdr (assoc 0 tw)))
(cond
((= new "VIEWPORT")(setq rt(cdr(assoc 51 tw))))
((= new "LWPOLYLINE")(setq temp (entget(cdr (assoc 330 tw))))(setq rt(cdr(assoc 51 temp))))
)
(setq en(ssname (ssget "X" (LIST (CONS 0 "INSERT")(CONS 2 "NORTH_ARROW")) 0)))
(setq elist(entget en))
(setq elist(subst (cons 50 rt)(assoc 50 elist) elist))
(entmod elist)
(princ)
)

0 Likes
823 Views
1 Reply
Reply (1)
Message 2 of 2

john.uhden
Mentor
Mentor

Um, why not leave them all in their Modelspace?

If I have to, sometimes I will copy a twisted viewport and adjust its boundary to focus on the north arrow and move it to wherever I want.

Always remember to lock your viewports.

John F. Uhden

0 Likes