Jump to content

Recommended Posts

Posted

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

  • 2 weeks later...
  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • crisraj99

    9

  • pBe

    5

  • ReMark

    4

  • SLW210

    3

Top Posters In This Topic

Posted

What count? Number of Entities? What specific properties are you wanting to count?

Posted

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.

Posted

And features are what? Any kind of Entity? Help us out here crisraj99

Posted

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.

Posted (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 by pBe
(vl-load-com);<-----
Posted (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 by pBe
Posted

I moved your posts to a separate thread.

Posted

Feature count? As in a count of the number of blocks per layer?

Posted

NO not only blocks what ever entities (Point line polyline text and polygon) in layers

i need layer wise count.

Posted

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.

Posted

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.

Posted

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.

  • 3 weeks later...
Posted

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")

)

Posted

Didn't you get a lisp routine in post #8?

 

Couldn't you have used the DATAEXTRACTION command?

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