entity in blocks
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
entity in blocks

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
M_Dobek
Guest





Posted: Tue Jan 04, 2005 6:41 am    Post subject: entity in blocks Reply with quote

Hi everyone,

In my drawing I've got a lot of blocks
Some blocks have a circle (0.5 radius) and I need to count all circles.

Maybe someone have a lisp that he can count entity (circle) in blocks?

any help will be greatfull,
Marcin_D

Back to top
LUCAS
Guest





Posted: Tue Jan 04, 2005 7:44 am    Post subject: Re: entity in blocks Reply with quote

;;not for nested blk
(defun C:TT (/ BLK COUNT SS)
(setq BLK (car (entsel)))
(command "_.explode" BLK)
(if (setq SS (ssget "p" '((0 . "circle"))))
(setq COUNT (sslength SS))
(setq COUNT 0)
)
(command "_.undo" "1")
COUNT
)
"M_Dobek" <mar_dob@wp.pl> ¦b¶l¥ó news:41d9f44f_3@newsprd01 ¤¤¼¶¼g...
Quote:
Hi everyone,

In my drawing I've got a lot of blocks
Some blocks have a circle (0.5 radius) and I need to count all circles.

Maybe someone have a lisp that he can count entity (circle) in blocks?

any help will be greatfull,
Marcin_D

Back to top
LUCAS
Guest





Posted: Tue Jan 04, 2005 7:52 am    Post subject: Re: entity in blocks Reply with quote

;;not for nested blk
(defun C:TTT (/ BLK COUNT ENT)
(vl-load-com)
(setq BLK (car (entsel))
COUNT 0
)
(vlax-for ENT
(vla-item (vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object))
)
(vla-get-name (vlax-ename->vla-object BLK))
)
(if (= (vla-get-objectname ENT) "AcDbCircle")
(setq COUNT (1+ COUNT))
)
)
COUNT
)

"LUCAS" <lai_wan_lung@pchome.com.tw> ¦b¶l¥ó news:41da03c4_1@newsprd01 ¤¤¼¶¼g
....
Quote:
;;not for nested blk
(defun C:TT (/ BLK COUNT SS)
(setq BLK (car (entsel)))
(command "_.explode" BLK)
(if (setq SS (ssget "p" '((0 . "circle"))))
(setq COUNT (sslength SS))
(setq COUNT 0)
)
(command "_.undo" "1")
COUNT
)
"M_Dobek" <mar_dob@wp.pl> ¦b¶l¥ó news:41d9f44f_3@newsprd01 ¤¤¼¶¼g...
Hi everyone,

In my drawing I've got a lot of blocks
Some blocks have a circle (0.5 radius) and I need to count all circles.

Maybe someone have a lisp that he can count entity (circle) in blocks?

any help will be greatfull,
Marcin_D





Back to top
LUCAS
Guest





Posted: Tue Jan 04, 2005 8:04 am    Post subject: Re: entity in blocks Reply with quote

;;For nested blk
(defun C:TTTT (/ BLK BLKS COUNT ENT)
(vl-load-com)

(defun DO_IT ()
(cond
((= (vla-get-objectname ENT) "AcDbCircle")
(setq COUNT (1+ COUNT))
)
((= (vla-get-objectname ENT) "AcDbBlockReference")
(TTT1 ENT)
)
)
)

(defun TTT1 (BLK / ENT)
(vlax-for ENT (vla-item BLKS (vla-get-name BLK))
(DO_IT)
)
)

(setq BLK (car (entsel "\nSelect Block: "))
COUNT 0
BLKS (vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object))
)
)
(vlax-for ENT
(vla-item BLKS (vla-get-name (vlax-ename->vla-object BLK)))
(DO_IT)
)
(vlax-release-object BLKS)
COUNT
)


"LUCAS" <lai_wan_lung@pchome.com.tw> ¦b¶l¥ó news:41da05b3_2@newsprd01 ¤¤¼¶¼g
....
Quote:
;;not for nested blk
(defun C:TTT (/ BLK COUNT ENT)
(vl-load-com)
(setq BLK (car (entsel))
COUNT 0
)
(vlax-for ENT
(vla-item (vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object))
)
(vla-get-name (vlax-ename->vla-object BLK))
)
(if (= (vla-get-objectname ENT) "AcDbCircle")
(setq COUNT (1+ COUNT))
)
)
COUNT
)

"LUCAS" <lai_wan_lung@pchome.com.tw> ¦b¶l¥ó news:41da03c4_1@newsprd01 ¤¤¼¶
¼g
...
;;not for nested blk
(defun C:TT (/ BLK COUNT SS)
(setq BLK (car (entsel)))
(command "_.explode" BLK)
(if (setq SS (ssget "p" '((0 . "circle"))))
(setq COUNT (sslength SS))
(setq COUNT 0)
)
(command "_.undo" "1")
COUNT
)
"M_Dobek" <mar_dob@wp.pl> ¦b¶l¥ó news:41d9f44f_3@newsprd01 ¤¤¼¶¼g...
Hi everyone,

In my drawing I've got a lot of blocks
Some blocks have a circle (0.5 radius) and I need to count all
circles.

Maybe someone have a lisp that he can count entity (circle) in blocks?

any help will be greatfull,
Marcin_D





Back to top
Adesu
Guest





Posted: Tue Jan 04, 2005 8:08 am    Post subject: Re: entity in blocks Reply with quote

Hi M_Dobek,try this

; co is stand for count object
; Design by Ade Suharna <mteybid@yuasabattery.co.id>
; 4 January 2005
; Program no.156/01/2005
; Edit by
(defun c:co (/ ob ss n)
(while
(setq ob (strcase (getstring T "\nENTER NAME OBJECT: ")))
(setq ss (ssget "x" (list (cons 0 ob))))
(setq n (sslength ss))
(alert (strcat "\nTOTAL" " " ob " " "=" ( rtos n 2 0)))
(princ)
)
)

M_Dobek <mar_dob@wp.pl> wrote in message news:41d9f44f_3@newsprd01...
Quote:
Hi everyone,

In my drawing I've got a lot of blocks
Some blocks have a circle (0.5 radius) and I need to count all circles.

Maybe someone have a lisp that he can count entity (circle) in blocks?

any help will be greatfull,
Marcin_D

Back to top
LUCAS
Guest





Posted: Tue Jan 04, 2005 8:12 am    Post subject: Re: entity in blocks Reply with quote

;;For nested blk
;;(tttt <objectname>)
;;(tttt "AcDbCircle")
;;By LUCAS

(defun TTTT (OBJECTNAME / BLK BLKS COUNT ENT)
(vl-load-com)

(defun TTT1 (BLK / ENT)
(vlax-for ENT (vla-item BLKS (vla-get-name BLK))
(cond
((= (vla-get-objectname ENT) OBJECTNAME)
(setq COUNT (1+ COUNT))
)
((= (vla-get-objectname ENT) "AcDbBlockReference")
(TTT1 ENT)
)
)
)
)

(setq BLK (car (entsel "\nSelect Block: "))
COUNT 0
BLKS (vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object))
)
BLK (vlax-ename->vla-object BLK)
)
(TTT1 BLK)
(vlax-release-object BLKS)
COUNT
)

"LUCAS" <lai_wan_lung@pchome.com.tw> ¦b¶l¥ó news:41da089a$1_2@newsprd01 ¤¤¼¶
¼g...
Quote:
;;For nested blk
(defun C:TTTT (/ BLK BLKS COUNT ENT)
(vl-load-com)

(defun DO_IT ()
(cond
((= (vla-get-objectname ENT) "AcDbCircle")
(setq COUNT (1+ COUNT))
)
((= (vla-get-objectname ENT) "AcDbBlockReference")
(TTT1 ENT)
)
)
)

(defun TTT1 (BLK / ENT)
(vlax-for ENT (vla-item BLKS (vla-get-name BLK))
(DO_IT)
)
)

(setq BLK (car (entsel "\nSelect Block: "))
COUNT 0
BLKS (vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object))
)
)
(vlax-for ENT
(vla-item BLKS (vla-get-name (vlax-ename->vla-object BLK)))
(DO_IT)
)
(vlax-release-object BLKS)
COUNT
)


"LUCAS" <lai_wan_lung@pchome.com.tw> ¦b¶l¥ó news:41da05b3_2@newsprd01 ¤¤¼¶
¼g
...
;;not for nested blk
(defun C:TTT (/ BLK COUNT ENT)
(vl-load-com)
(setq BLK (car (entsel))
COUNT 0
)
(vlax-for ENT
(vla-item (vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object))
)
(vla-get-name (vlax-ename->vla-object BLK))
)
(if (= (vla-get-objectname ENT) "AcDbCircle")
(setq COUNT (1+ COUNT))
)
)
COUNT
)

"LUCAS" <lai_wan_lung@pchome.com.tw> ¦b¶l¥ó news:41da03c4_1@newsprd01 ¤¤
¼¶
¼g
...
;;not for nested blk
(defun C:TT (/ BLK COUNT SS)
(setq BLK (car (entsel)))
(command "_.explode" BLK)
(if (setq SS (ssget "p" '((0 . "circle"))))
(setq COUNT (sslength SS))
(setq COUNT 0)
)
(command "_.undo" "1")
COUNT
)
"M_Dobek" <mar_dob@wp.pl> ¦b¶l¥ó news:41d9f44f_3@newsprd01 ¤¤¼¶¼g...
Hi everyone,

In my drawing I've got a lot of blocks
Some blocks have a circle (0.5 radius) and I need to count all
circles.

Maybe someone have a lisp that he can count entity (circle) in
blocks?

any help will be greatfull,
Marcin_D







Back to top
M_Dobek
Guest





Posted: Wed Jan 05, 2005 1:24 am    Post subject: Re: entity in blocks Reply with quote

This is what I need
It works great!

Thanks LUCAS

Marcin_D

U¿ytkownik "LUCAS" <lai_wan_lung@pchome.com.tw> napisa³ w wiadomo¶ci
news:41da0a6d_1@newsprd01...
Quote:
;;For nested blk
;;(tttt <objectname>)
;;(tttt "AcDbCircle")
;;By LUCAS

(defun TTTT (OBJECTNAME / BLK BLKS COUNT ENT)
(vl-load-com)

(defun TTT1 (BLK / ENT)
(vlax-for ENT (vla-item BLKS (vla-get-name BLK))
(cond
((= (vla-get-objectname ENT) OBJECTNAME)
(setq COUNT (1+ COUNT))
)
((= (vla-get-objectname ENT) "AcDbBlockReference")
(TTT1 ENT)
)
)
)
)

(setq BLK (car (entsel "\nSelect Block: "))
COUNT 0
BLKS (vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object))
)
BLK (vlax-ename->vla-object BLK)
)
(TTT1 BLK)
(vlax-release-object BLKS)
COUNT
)

"LUCAS" <lai_wan_lung@pchome.com.tw> ¦b¶l¥ó news:41da089a$1_2@newsprd01
¤¤¼¶
¼g...
;;For nested blk
(defun C:TTTT (/ BLK BLKS COUNT ENT)
(vl-load-com)

(defun DO_IT ()
(cond
((= (vla-get-objectname ENT) "AcDbCircle")
(setq COUNT (1+ COUNT))
)
((= (vla-get-objectname ENT) "AcDbBlockReference")
(TTT1 ENT)
)
)
)

(defun TTT1 (BLK / ENT)
(vlax-for ENT (vla-item BLKS (vla-get-name BLK))
(DO_IT)
)
)

(setq BLK (car (entsel "\nSelect Block: "))
COUNT 0
BLKS (vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object))
)
)
(vlax-for ENT
(vla-item BLKS (vla-get-name (vlax-ename->vla-object BLK)))
(DO_IT)
)
(vlax-release-object BLKS)
COUNT
)


"LUCAS" <lai_wan_lung@pchome.com.tw> ¦b¶l¥ó news:41da05b3_2@newsprd01
¤¤¼¶
¼g
...
;;not for nested blk
(defun C:TTT (/ BLK COUNT ENT)
(vl-load-com)
(setq BLK (car (entsel))
COUNT 0
)
(vlax-for ENT
(vla-item (vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object))
)
(vla-get-name (vlax-ename->vla-object BLK))
)
(if (= (vla-get-objectname ENT) "AcDbCircle")
(setq COUNT (1+ COUNT))
)
)
COUNT
)

"LUCAS" <lai_wan_lung@pchome.com.tw> ¦b¶l¥ó news:41da03c4_1@newsprd01
¤¤
¼¶
¼g
...
;;not for nested blk
(defun C:TT (/ BLK COUNT SS)
(setq BLK (car (entsel)))
(command "_.explode" BLK)
(if (setq SS (ssget "p" '((0 . "circle"))))
(setq COUNT (sslength SS))
(setq COUNT 0)
)
(command "_.undo" "1")
COUNT
)
"M_Dobek" <mar_dob@wp.pl> ¦b¶l¥ó news:41d9f44f_3@newsprd01 ¤¤¼¶¼g...
Hi everyone,

In my drawing I've got a lot of blocks
Some blocks have a circle (0.5 radius) and I need to count all
circles.

Maybe someone have a lisp that he can count entity (circle) in
blocks?

any help will be greatfull,
Marcin_D









Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Contact Us
Powered by phpBB