Run from VLIDE. At the command line enter VLIDE
From the pull down menus at the top select File/Open
Navigate to this new lisp & load it.
Left click in that window with the new lisp to make sure it is active.
From the pull down menus at the top select Debug & make sure the "Break on Error" is checked.
From the pull down menus at the top select Tools/Enviornmental Options/General
Activate the Diagnostic Tab
Check Report statistics...
Check Print notification ...
Check Echo PRINx ....
Check Inspect drawings....
From the pull down menus at the top select Tools/Load Text in Editor
In the Visual Lisp Console window you should see something liske this:
; 2 forms loaded from #<editor "C:/Program Files/ACAD2000/LISP Routines/Title Block Index CAB.LSP">
_$
It will reflect your path, not the one shown here.
Activate ACAD & run the routine again.
Please post the output at the command line.
If you are taken back to VLIDE Press [Ctrl+F9] and tell me the line that is highlighted.
CAB,
I followed your instructions and on the command line I received....too few arguments......then I hit [Ctrl+F9] and the lines below were highlighted......I hope this was helpful....!
;|function to extract 2 attribute values from a specific block in the drawings of a specified folder
by Jeff Mishler Feb. 9, 2006 |;
(defun getindex (blkname attname1 attname2 attname3 attname4 / *acad atts dwgs f folder layouts masterlist name odbx val1 val2 val3 val4)
(defun BrowseForFolder (/ sh folder parentfolder folderobject result)
;;as posted the autodesk discussion customization group by Tony Tanzillo
(vl-load-com)
(setq sh
(vla-getInterfaceObject
(vlax-get-acad-object)
"Shell.Application"
)
)
(setq folder
(vlax-invoke-method
sh 'BrowseForFolder 0 "" 0)
)
(vlax-release-object sh)
(if folder
(progn
(setq parentfolder
(vlax-get-property folder 'ParentFolder)
)
(setq FolderObject
(vlax-invoke-method
ParentFolder
'ParseName
(vlax-get-property Folder 'Title)
)
)
(setq result
(vlax-get-property FolderObject 'Path)
)
(mapcar 'vlax-release-object
(list folder parentfolder folderobject)
)
result
)
)
)
(defun getdwglist (folderlist)
(apply 'append
(mapcar '(lambda (f)
(mapcar '(lambda (name)
(strcat f "\\" name)
)
(vl-directory-files f "*.dwg" 1)
)
)
folderlist
)
)
)
(if (and (setq *acad (vlax-get-acad-object))
(setq folder (browseforfolder))
(setq dwgs (getdwglist (list folder)))
)
(progn
(setq
odbx (if (< (atoi (substr (getvar "acadver") 1 2)) 16)
(vla-GetInterfaceObject *acad "ObjectDBX.AxDbDocument")
(vla-GetInterfaceObject
*acad
"ObjectDBX.AxDbDocument.17"
)
)
)
(foreach dwg dwgs
(if
(and
(not (vl-catch-all-error-p
(vl-catch-all-apply
'(lambda ()
(vla-open odbx dwg)
)
)
)
)
;see if the block is even in the drawing
(not
(vl-catch-all-error-p
(vl-catch-all-apply
'(lambda ()
(setq blk (vla-item (vla-get-blocks odbx) blkname))
)
)
)
)
)
(progn
;;it is...carry on
(setq layouts (vla-get-layouts odbx))
(vlax-for layout layouts
(if (not (eq "MODEL" (strcase (vla-get-name layout))))
(progn
(vlax-for ent (vla-get-block layout)
(if (and (eq (vla-get-objectname ent)
"AcDbBlockReference"
)
(eq (strcase (vla-get-name ent))
(strcase blkname)
)
)
(progn
(setq atts (vlax-invoke ent 'getattributes))
(foreach att atts
(if (eq (vla-get-tagstring att)
(strcase attname1)
)
(setq val1 (vla-get-textstring att))
)
(if (eq (vla-get-tagstring att)
(strcase attname2)
)
(setq val2 (vla-get-textstring att))
)
(if (eq (vla-get-tagstring att)
(strcase attname3)
)
(setq val3 (vla-get-textstring att))
)
(if (eq (vla-get-tagstring att)
(strcase attname4)
)
(setq val4 (vla-get-textstring att))
)
)
(setq masterlist
(cons (cons (cons (cons val1 val2) val3) val4) masterlist)
;(cons (list (vla-get-name odbx) (cons val1 val2)) masterlist);for testing
)
)
)
)
)
)
)
)
)
)
(mapcar 'vlax-release-object (list odbx *acad))
)
)
(reverse masterlist)
)
Thanks, Vince