Ish 8 Posted April 3 Dear team Any tips or tricks to match only viewport angle. I have 2 viewport 1 viewport have road plan and already rotate. And 2 viewport I have only north symbol, So I want match the only rotation angle of road plan to north symbol. Thanks Quote Share this post Link to post Share on other sites
BIGAL 588 Posted April 3 Here is a more than you asked for but shows the properties of a viewport you could pick north point and get angle, you may need to set angdir 1st else will possibly get wrong angle. You should be able to put twistangle not tested. (command "._PSPACE") (setq sss (ssget "_+.:E:S" (list (cons 0 "Viewport")))) (setq cspace (cdr (assoc 69 (entget (ssname sss 0))))) (setq obj (vlax-ename->vla-object (ssname sss 0))) (if (= (vla-get-objectname obj) "AcDbViewport") (progn (setq cen (vlax-get obj 'Center )) (setq ht (vlax-get obj 'Height)) (setq wid (vlax-get obj 'Width)) (setq sc (vlax-get obj 'customscale )) (setq ang (vlax-get obj 'TwistAngle)) )) I have the other rotate block to match a viewpoint angle. 2 Quote Share this post Link to post Share on other sites
Ish 8 Posted April 4 Actually Sir, I have around 200 layout of road plan, in every layout view port Angle is different, So, engineer told me show North arrow at every road plan viewport, Don't copy North symbol in model space at every km. Just one North symbol in model space, and make separate viewport for north at near road plan viewport corner. In image inside red colour cloud is viewport of North, on layout. Other north is in model space, that one engineer don't want. Hope you understand my situation. I need a trick or lisp that can draw/make automatically viewport with north symbol with same rotation angle of road plan viewport. Thanks Quote Share this post Link to post Share on other sites
Kajanthan 3 Posted April 4 Hi @BIGAL Your Lisp working well. According @Ish requirement is here (defun c:dd (/ sss obj ang ss vpo) (command "._PSPACE") (prompt "\nSelect source Viewport") (setq sss (ssget "_+.:E:S" (list (cons 0 "Viewport")) )) (setq obj (vlax-ename->vla-object (ssname sss 0))) (if (= (vla-get-objectname obj) "AcDbViewport") (setq ang (vlax-get obj 'TwistAngle)) ) (prompt "\nSelect North symbol Vewport") (setq ss (ssget "_+.:E:S" (list (cons 0 "Viewport")))) (setq vpo (vlax-ename->vla-object (ssname ss 0))) (vlax-put-property vpo 'TwistAngle ang) ) Original Result TwistAngle on Viewport.lsp 2 Quote Share this post Link to post Share on other sites
Ish 8 Posted April 7 (edited) Thanks for your good reply sir, I used twistable on viewport.lsp, Working nicely but when I match viewport to north , object gone again I need to zoom and pan inside VP. Sir I don't want zoom and pan inside VP. Hope you understand Edited April 7 by Ish Modified Quote Share this post Link to post Share on other sites
ronjonp 248 Posted April 7 Put your north arrows in model space then you don't have to worry about the angle. 1 1 Quote Share this post Link to post Share on other sites
BIGAL 588 Posted April 8 Like ronjonp do a insert say using top right cnr of viewport than can set angle correct rather than modify existing. Use cen wid ht to work out a insertion point. Quote Share this post Link to post Share on other sites
Ish 8 Posted April 8 11 hours ago, ronjonp said: Put your north arrows in model space then you don't have to worry about the angle. Sir in model space I have many existing things, Building, trees, temple, and survey plan , canal etc, If I put on layout easy to move forward, up and down , that's why I need on layout. Sir Quote Share this post Link to post Share on other sites
BIGAL 588 Posted April 8 I should have said more you can read the viewport angle, get its width and ht so can work out any of the 4 corners, if you do do (command "pspace") it will make sure your in paper space. Change the block name Northn. Like Ronjonp sometimes easier in model. (defun c:insnorth ( / lay sss obj cen ht wid sc ang oldang ) (setq oldang (getvar 'aunits)) (setvar 'aunits 3) (vlax-for lay (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object))) (setq layname (vla-get-name lay)) (if (= layname "Model") (princ) (progn (setvar 'ctab layname) (command "._PSPACE") (setq sss (ssget "X"(list (cons 0 "Viewport")(cons 410 (getvar 'ctab))))) (setq obj (vlax-ename->vla-object (ssname sss 0))) (if (= (vla-get-objectname obj) "AcDbViewport") (progn (setq cen (vlax-get obj 'Center )) (setq ht (vlax-get obj 'Height)) (setq wid (vlax-get obj 'Width)) (setq sc (vlax-get obj 'customscale )) (setq ang (vlax-get obj 'TwistAngle)) ) ) (setq pt (mapcar '+ cen (list (/ wid 2.0) (/ ht 2.0) 0.0))) (command "-insert" "NORTHN" pt 1.0 1.0 ang) ) ) ) (setvar 'aunits oldang) (princ) ) (c:insnorth) Quote Share this post Link to post Share on other sites
ronjonp 248 Posted April 8 17 hours ago, Ish said: Sir in model space I have many existing things, Building, trees, temple, and survey plan , canal etc, If I put on layout easy to move forward, up and down , that's why I need on layout. Sir Here's some code I wrote a looong time ago. I added the 'name' variable at the top for your blockname. It will insert that block in the upper right corner of the viewport at the correct twistangle. (defun c:northarrows (/ a ang msg name ss tab ur vtab) (if (tblobjname "block" (setq name "nameofyournortharrowblock")) (if (setq ss (ssget "_X" '((0 . "VIEWPORT") (-4 . "!=") (69 . 1)))) (progn (setq msg "") (foreach vp (mapcar 'cadr (ssnamex ss)) (vla-getboundingbox (vlax-ename->vla-object vp) 'll 'ur) (setq tab (cdr (assoc 410 (entget vp))) vtab (vla-get-layout (vlax-ename->vla-object (cdr (assoc 330 (entget vp))))) ang (cdr (assoc 51 (entget vp))) ur (vlax-safearray->list ur) ) (vla-insertblock (vla-get-block vtab) (vlax-3d-point ur) name 1 1 1 ang) (setq msg (strcat msg "\n North Arrow inserted on tab " tab " rotation " (rtos (* (/ ang pi) 180.0) 2 2) ) ) ) (princ msg) ) ) (alert (strcat "\nBlock definition '" name "' not found!")) ) (princ) ) Quote Share this post Link to post Share on other sites
Kajanthan 3 Posted April 9 Simple way.. Copy with Base point your North Symbol Double click in the viewport Paste Click Your clear location Quote Share this post Link to post Share on other sites
ronjonp 248 Posted April 9 7 hours ago, Kajanthan said: Simple way.. Copy with Base point your North Symbol .. Double click in the viewport .. Paste ... Click Your clear location ... Exactly 1 Quote Share this post Link to post Share on other sites
BIGAL 588 Posted April 10 Why not add Chspace if want in Pspace but readabilty would be ok. Quote Share this post Link to post Share on other sites