crisraj99 Posted May 13, 2013 Posted May 13, 2013 Hi, i need total count of each layer available in Drawing. example in fitting layer i have 30 features pipe layer i have 45 features fitting : 30 line : 45 i need total layers like above mentioned Quote
crisraj99 Posted May 22, 2013 Author Posted May 22, 2013 Hi All, any body please help me to get feature count by layer wise from the attached drawing and i need that count in .csv file.please its urgent......!!! thanks in advance... C0300-GS-0111-LDR-01B0000-001.dwg count.csv Quote
pBe Posted May 22, 2013 Posted May 22, 2013 What count? Number of Entities? What specific properties are you wanting to count? Quote
crisraj99 Posted May 22, 2013 Author Posted May 22, 2013 i need in each layer how many features available for example DR-DRAIN-AREA DRAIN-AD-pnt-----200 DR-DRAIN-FUNNEL FLOOR DRAIN-pnt------120 DR-FITTING-CONTROL PANEL-pnt-----55 DR-FITTING-ELBOW-pnt----25 DR-FITTING-FLOOR CHANNEL-pnt---55 like that because after this i have to migrate this drawing in to PGDB and i want to match the counts. Quote
pBe Posted May 22, 2013 Posted May 22, 2013 And features are what? Any kind of Entity? Help us out here crisraj99 Quote
crisraj99 Posted May 22, 2013 Author Posted May 22, 2013 I need layer wise FEATURE count in that attached csv file. count.csv C0300-GS-0111-LDR-01B0000-001.dwg Quote
crisraj99 Posted May 22, 2013 Author Posted May 22, 2013 i need only entity count by each layer....actually now i am swith off and swith on for counting entities in each layer i need code for counting the entities by each layer. Quote
pBe Posted May 22, 2013 Posted May 22, 2013 (edited) (defun c:demo ( / objects data) [color="blue"](vl-load-com)[/color] (setq data '(("DOUBT" 0) ("DR-CLEANOUT-FLOOR CLEAN OUT-FCO-pnt" 0) ("DR-DRAIN-AREA DRAIN-AD-pnt" 0) ("DR-DRAIN-FUNNEL FLOOR DRAIN-pnt" 0) ("DR-FITTING-CONTROL PANEL-pnt" 0) ("DR-FITTING-ELBOW-pnt" 0) ("DR-FITTING-FLOOR CHANNEL-pnt" 0) ("DR-FITTING-PUDDLE FLANGE-pnt" 0) ("DR-FITTING-RISER DOWN-pnt" 0) ("DR-FITTING-RISER UP-pnt" 0) ("DR-FITTING-RODDING EYE-pnt" 0) ("DR-FITTING-SSPFD-pnt" 0) ("DR-FITTING-TEE-pnt" 0) ("DR-FITTING-VENT CONNECTION-pnt" 0) ("DR-FITTING-WASTE CONNECTION-pnt" 0) ("DR-OIL-INETERCEPTOR-pnt" 0) ("DR-PIPE-AC DRAIN PIPE-lin" 0) ("DR-PIPE-KWP-lin" 0) ("DR-PIPE-LAB DRAINAGE WASTE PIPE-lin" 0) ("DR-PIPE-PUMP SOIL-PSP-lin" 0) ("DR-PIPE-PWP-lin" 0) ("DR-PIPE-SEWAGE PIPE-SP-lin" 0)("DR-PIPE-VENT PIPE-VP-lin" 0) ("DR-PIPE-WASTE PIPE-WP-lin" 0) ("DR-PIT-NEUTRALIZATION-ply" 0) ("DR-PIT-SEWAGE EJECTION-ply" 0) ("DR-PUDDLE SLEEVE-lin" 0) ("DR-PUMP-SUBMERSIBLE PUMP-pnt" 0) ("DR-SENSOR-pnt" 0) ("DR-TEXT" 0) ("DR-TRENCH-Ply" 0) ("DR-VALVE-GATE VALVE-pnt" 0)) ) (vlax-for layout (vla-get-layouts (vla-get-ActiveDocument (vlax-get-acad-object))) (vlax-for i (vla-get-block layout) (if (setq f (assoc (Vla-get-layer i) data)) (setq data (subst (list (car f) (1+ (cadr f))) f data)) ) ) ) [b][color="blue"](textscr)[/color][/b] [color="blue"] (foreach itm data (if (not (zerop (Cadr itm))) (princ (Strcat "\n\"" (car itm) "-----> " (itoa (Cadr itm)))) ))[/color] (princ) ) Edited May 22, 2013 by pBe (vl-load-com);<----- Quote
pBe Posted May 22, 2013 Posted May 22, 2013 (edited) Dont see anything wrong with it crisraj99 .. maybe you need to add (textscr) to see the result. or if you want to it to "look" like your sample" (foreach itm data (if (not (zerop (Cadr itm))) (princ (Strcat "\n\"" (car itm) "-----> " (itoa (Cadr itm)))) )) In case you guys are wondering why VL and not Vanilla.... ODBX at the ready] Edited May 22, 2013 by pBe Quote
Lee Mac Posted May 22, 2013 Posted May 22, 2013 I moved your posts to a separate thread. Suggest merging with duplicate post/thread: http://www.cadtutor.net/forum/showthread.php?79502-I-need-help-for-counting-the-features Quote
ReMark Posted May 22, 2013 Posted May 22, 2013 Feature count? As in a count of the number of blocks per layer? Quote
crisraj99 Posted May 22, 2013 Author Posted May 22, 2013 NO not only blocks what ever entities (Point line polyline text and polygon) in layers i need layer wise count. Quote
ReMark Posted May 22, 2013 Posted May 22, 2013 It's helpful to be specific. One non-lisp option would be to use the QSELECT command. See your Help file re: Count Objects Within a Drawing. I don't know if this could be automated via a lisp routine. Quote
crisraj99 Posted May 22, 2013 Author Posted May 22, 2013 for example i switch on DR-FITTING-TEE-pnt layer and i found 13 entities. as like i need all layer count in csv file. not only that drawing i have so many drawings to do like that.please do the need .thanks in advance. Quote
ReMark Posted May 22, 2013 Posted May 22, 2013 Count & Highlight Any AutoCAD Entity. http://www.simplecad.com/count-highlight-any-autocad-entity.htm ToolPac by DotSoft has the ability to count objects by layer. Object Count by Layer: Layer Object Count breakdown by type with report or optional table. Look under the "Inquiry" section. http://www.dotsoft.com/toolpac.htm One last option would be to use the Data Extraction command (EATTEXT) that comes with AutoCAD. You can set this up to be as specific as you want. Output can be to a mdb, xls, csv or txt file. Quote
crisraj99 Posted June 10, 2013 Author Posted June 10, 2013 Finally i found the Code I think this form will help me but no one can give me this code.... (vl-load-com) (defun c:FCNT( / lays lay sel f tcnt ) (setq lays (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))) (setq f (open "c:\\Temp\\Feacount.txt" "w")) (write-line (strcat "LayerName" "\t\t\t\t" "Count") f) (write-line "---------------------------------------------------" f) (setq tcnt 0) (vlax-for lay lays (setq Lname (vla-get-name lay)) (setq sel (ssget "x" (list(cons 8 Lname)))) (if sel (progn (setq len (sslength sel)) (setq tcnt (+ len tcnt)) (write-line (strcat Lname "\t\t\t" (itoa len)) f) (write-line "---------------------------------------------------" f) ) ) ) (write-line (strcat "TotalCount----------" "\t\t\t" (itoa tcnt)) f) (close f) (command "notepad" "c://Temp/Feacount.txt") ) Quote
ReMark Posted June 10, 2013 Posted June 10, 2013 Didn't you get a lisp routine in post #8? Couldn't you have used the DATAEXTRACTION command? Quote
Recommended Posts
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.