Jump to content

Recommended Posts

Posted

Hello Friends,

 

Greetings,

 

through lisp how to find the number of objects of a BLOCK and how to change its general properties.

 

for example:-

 

I have few circles in a block, which i would like to change its color, and few other objects thinckness.

 

thanks & Regards

Ramana

Posted

What version are you currently using? There should be a block counter in Express Tools called, strangely enough, BCount. It's a lisp program.

Posted

Short example in Visual LISP Console window:

 

Load Visual LISP extension:

_$(vl-load-com)

 

Get object of an Active Document:

 

_$ (setq actDoc(vla-get-ActiveDocument(vlax-get-acad-object)))
#<VLA-OBJECT IAcadDocument 01ff6950>

 

Get Blocks Collection:

 

_$ (setq blCol(vla-get-Blocks actDoc))
#<VLA-OBJECT IAcadBlocks 0e57d01c>

 

Get object of block with name "block1":

 

_$ (setq cBl(vla-Item blCol "block1"))
#<VLA-OBJECT IAcadBlock2 0e57d47c>

 

Retrieve number of entities of block:

 

_$ (vla-get-Count cBl)
4

 

Paint all circles in Red color (1):

 

_$ (vlax-for e cBl (if(= "AcDbCircle"(vla-get-ObjectName e))(vla-put-Color e 1)))
nil

 

Regenerate document to see change of color in block references:

 

_$  (vla-regen actDoc 1)
Regenerating model.

Posted

thanks friends,

 

I have not checked in express tools, I will go through it.

 

thanks again for vlisp codes.

 

 

Ramana

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