Thank you for these files, could explaiin them further? The dwg files are your title blocks, are the used with .lsp routines? Please advise, thank you.
Thank you for these files, could explaiin them further? The dwg files are your title blocks, are the used with .lsp routines? Please advise, thank you.
Darren
Could you possibly save the files you attached to 2007 version, i'm using acad2007 and the cant even run DwgTrueVew on my windows version.... [windows 7 starter]
I worked on something similar a year or so ago. it might help, but i need to see what you got
Last edited by pbejse; 2012-09-29 at 09:59 AM.
Darren,
I need to modify the code for it to work on your drawing, and not modify the drawing to fit the code. Hence i'm asking for a sample of your drawing in 2007 version.
![]()
HTHCode:(defun c:DetNum ( / sortYX aDoc bn aLayout coll layblk) (vl-load-com) ;;; pBe 13Oct2012 ;;; (defun sortYX (ptlist / yvals newptlist) ;;; Kent Cooper ;;; (foreach pt ptlist (if (not (vl-remove-if-not '(lambda (y) (equal (cadr pt) y 0.0001)) yvals ) ) (setq yvals (cons (cadr pt) yvals)) ) ) (setq yvals (vl-sort yvals '(lambda (y1 y2) (> y1 y2)))) (foreach yval yvals (setq pts (vl-remove-if-not '(lambda (pt) (equal yval (cadr pt) 0.0001)) ptlist ) pts (vl-sort pts '(lambda (pt1 pt2) (< (car pt1) (car pt2)))) newptlist (append newptlist pts) ) ) newptlist ) (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (if (tblsearch "BLOCK" (setq bn "View Label01")) (progn (vlax-for layout (setq aLayout (vla-get-layouts aDoc)) (if (not (equal (setq ln (vla-get-name layout)) "Model")) (progn (vlax-for i (vla-get-block layout) (if (and (= (vla-get-objectname i) "AcDbBlockReference") (= (strcase (vla-get-effectivename i)) (strcase bn)) ) (setq coll (cons (list (vlax-get i 'InsertionPoint) i) coll)) ) ) (setq layblk (cons (list ln (vla-get-taborder (vla-item aLayout ln)) coll) layblk ) coll nil ) ) ) ) (setq cnt 0) (foreach itm (vl-sort layblk (function (lambda (a b) (< (cadr a)(cadr b))))) (if (and (setq f (last itm)) (setq g (sortYX (mapcar 'car f)))) (foreach pt g (if (setq b (assoc pt f)) (vla-put-textstring (car (vl-remove-if-not '(lambda (j) (eq (vla-get-tagstring j) "DETAIL_NUMBER")) (vlax-invoke (cadr b) 'GetAttributes) )) (itoa (setq cnt (1+ cnt))) ) ) ) ) ) ) hth ) (princ) )
You are the King for the day! Thank you, works great!
After further using the lisp; it does has a glitch. On one of the sheets, there are 6 view lables, the numbering went around in a circle vs. left to right, top to bottom. Please advise, thanks.
Last edited by Darren Allen; 2012-10-03 at 03:02 PM.
I'm expecting that to happen, we may need a smarter sort routine, but in any case if the labels are lined up properly (horizontally aligned) then it would be numbered Left-to-Right , Top-to-Bottom.