Automate drawing number x of y

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We have several sets of drawings that the client is asking to be numbered x of y
The number of drawings in each set keeps varying & drawing(s) inserted so I am attempting to automate the whole process. We do not use the AutoCAD drawing sets facility & each drawing is separate within one folder at each issue.
The drawing number part was fairly straight forward (the x part of 'x of y'), the following diesel expression used within a field:
$(if,$(=,$(substr,$(getvar,dwgname),$(-,$(strlen,$(getvar,dwgname)),6),1),0),$(substr,$(getvar,dwgname),$(-,$(strlen,$(getvar,dwgname)),5),1),$(substr,$(getvar,dwgname),$(-,$(strlen,$(getvar,dwgname)),6),2))
i.e. if the filename ends in "01A", it returns "1", if the filename ends in "94A", it returns "94"
It's the y part of 'x of y' that is giving me difficulties.
(length (car(list (vl-directory-files (getvar"dwgprefix") "*.dwg"))))
And
(length (car(list (acet-file-dir "*.dwg")))); unreliable, depends on Express Tools
Both return the number of AutoCAD files with the same folder as the drawing from which the functions are called & would be ideal if I could get them into a field or attribute.
Please does anybody know how to put one of these into a field, attribute or even a diesel expression ?