pmadhwal7 Posted March 7, 2020 Posted March 7, 2020 Dear All, I Need help i have multiple layout and i want to do sheet numbering on each layout like 1/250,2/250.... how can i able to do this because if i do manually so it will take too much time is their any lsp or any short method to do the same i also attached my sample dwg sample.dwg Quote
Lee Mac Posted March 7, 2020 Posted March 7, 2020 Perhaps these can help you: Renumber Layouts Layout Field Quote
marko_ribar Posted March 7, 2020 Posted March 7, 2020 (edited) Try this routine : (defun c:numberpages ( / *error* objectid layoutof adoc aobj ct e o ) (vl-load-com) (defun *error* ( m ) (if ct (setvar 'ctab ct) ) (if m (prompt m) ) (vla-regen adoc acactiveviewport) (princ) ) (defun objectid ( o ) (vla-getobjectidstring (vla-get-utility adoc) o :vlax-false) ) (defun layoutof ( o ) (vla-item (vla-get-layouts adoc) (cdr (assoc 410 (entget (vlax-vla-object->ename o))))) ) (setq adoc (vla-get-activedocument (setq aobj (vlax-get-acad-object)))) (setq ct (getvar 'ctab)) (foreach lay (layoutlist) (setvar 'ctab lay) (vla-zoomextents aobj) (setq e (ssname (ssget "_W" '(5800.0 2000.0) '(6200.0 2200.0)) 0)) (setq o (vlax-ename->vla-object e)) (vla-put-textstring o (strcat "%<\\AcObjProp Object(%<\\_ObjId " (objectid (layoutof o)) ">%).TabOrder>%" "/" "%<\\AcExpr %<\\AcObjProp Object(%<\\_ObjId " (objectid (vla-get-layouts adoc)) ">%).Count>%-1 >%")) ) (*error* nil) ) Regards, M.R. Edited March 7, 2020 by marko_ribar 1 Quote
BIGAL Posted March 7, 2020 Posted March 7, 2020 Nicely done Marko. Pmadhwal I would suggest you make your title into a block with attributes, if for some reason your 1/250 is not at the position searched for, then code will fail. If its an attribute it can be found any where on the layout. Quote
pmadhwal7 Posted March 9, 2020 Author Posted March 9, 2020 On 3/7/2020 at 6:54 PM, marko_ribar said: Try this routine : (defun c:numberpages ( / *error* objectid layoutof adoc aobj ct e o ) (vl-load-com) (defun *error* ( m ) (if ct (setvar 'ctab ct) ) (if m (prompt m) ) (vla-regen adoc acactiveviewport) (princ) ) (defun objectid ( o ) (vla-getobjectidstring (vla-get-utility adoc) o :vlax-false) ) (defun layoutof ( o ) (vla-item (vla-get-layouts adoc) (cdr (assoc 410 (entget (vlax-vla-object->ename o))))) ) (setq adoc (vla-get-activedocument (setq aobj (vlax-get-acad-object)))) (setq ct (getvar 'ctab)) (foreach lay (layoutlist) (setvar 'ctab lay) (vla-zoomextents aobj) (setq e (ssname (ssget "_W" '(5800.0 2000.0) '(6200.0 2200.0)) 0)) (setq o (vlax-ename->vla-object e)) (vla-put-textstring o (strcat "%<\\AcObjProp Object(%<\\_ObjId " (objectid (layoutof o)) ">%).TabOrder>%" "/" "%<\\AcExpr %<\\AcObjProp Object(%<\\_ObjId " (objectid (vla-get-layouts adoc)) ">%).Count>%-1 >%")) ) (*error* nil) ) Regards, M.R. Thanks Sir perfectly working....many thanks Quote
pmadhwal7 Posted March 9, 2020 Author Posted March 9, 2020 On 3/8/2020 at 4:46 AM, BIGAL said: Nicely done Marko. Pmadhwal I would suggest you make your title into a block with attributes, if for some reason your 1/250 is not at the position searched for, then code will fail. If its an attribute it can be found any where on the layout. thanks for advice sir....... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.