Jump to content

Using LISP to get total number of sheets in project


LXM

Recommended Posts

I'm very new to lisp.  I have searched this forum for a way to get a count of total sheets in a project.  Actually I've searched many different forums looking for some clue.  Perhaps this topic is so easy no one ever has to ask about it?  Anyway I don't know how this would be accomplished with LISP.   If I look in the Project Manager and do a title block update, in the "Update Title Block" dialog there is a variable for Sheet maximum that shows the total number of sheets in the active project.  I'm thinking that would be something I could use but I can't find any information on accessing that variable.  Is there any way to access that variable?  Barring that, is there a known method for using LISP to get a count of total sheets in the project?  Thanks in advance to anyone who might be able to shed a little light on this mystery (mystery to me that is).

Link to comment
Share on other sites

Sorry, I'm new to forums as well.  I am using AutoCAD Electrical 2016.  Perhaps this isn't even the right place to ask the question?

Link to comment
Share on other sites

If its a single layout per sheet then.

 


(SETQ LAYOUTS (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object))))
(SETQ COUNT (- (VLA-GET-COUNT LAYOUTS) 1))

 

The -1 is to account for "Model" its a layout also.

Link to comment
Share on other sites

no idea how the structure of a project is  AutoCad Electrical but if all the files (drawings) are in one (master) folder , simply count all the drawings in this folder / subfolders, easy as pie

Link to comment
Share on other sites

That could be a big "if". I presume this tool is similar in nature to Sheet Set Manager, in which you can have single layout drawings, multi-layout drawings, and drawings in varying folders.

 

Regardless, it feels like @LXM wants to query the 'project' itself, just like you might count the items in a .DST file (Sheet Set Manager) - in which case you're not really concerned with how many .DWG files or the number of layouts, you just want the sheet total so you can put Sheet Z of XX on each sheet (where XX is the variable).

Link to comment
Share on other sites

7 hours ago, rkmcswain said:

 

Doubtful since OP is talking about AutoCAD Electrical Project Manager. Almost certainly multiple DWG files in the project.

 

 

Besides that point, if it is indeed layout tabs then it could be just (length (layoutlist)). If the project manager is anything like sheet set, then .NET is the tool you want.

 

 

Link to comment
Share on other sites

  • 1 month later...

Can't query folder as there is always the possibility of extra drawings, recovered drawing or just plain bad housekeeping.  And no, I'm not dealing with tabs but individual drawings so that route is out. 

 

What I did to solve my dilemma was to query the .wdp (project file) and get a count from there based on an idea posted by Lee Mac.  Works like a charm.

 

Guess we can mark this one as solved.  Not sure how that is done here.

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