Jump to content

help needed on multiple layout numbering


pmadhwal7

Recommended Posts

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

Link to comment
Share on other sites

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 by marko_ribar
  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.......

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...