Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: Insert Dynamic Block programmat ically
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank you for your quick reply. I am trying it without success. Here is a sample file with a simple line block which has a length paramerter 'TheLength'. I would like to be able to change all of these lengths with LISP all at once. Then, I can train a Button to automatically change all these parameters in the drawing. I am able to change the lenth of one block selection at a time with (setq obj (car (entsel))).
Thanks again,
Re: Insert Dynamic Block programmat ically
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Dewlevlak wrote:Thank you for your quick reply. I am trying it without success. Here is a sample file with a simple line block which has a length paramerter 'TheLength'. I would like to be able to change all of these lengths with LISP all at once. Then, I can train a Button to automatically change all these parameters in the drawing. I am able to change the lenth of one block selection at a time with (setq obj (car (entsel))).
Thanks again,
Guess i need to put it together for you then.
(defun c:chpname ( / ChangePropertyLength objs ename)
(vl-load-com)
;;; Generic sub for property name ;;;
(defun ChangePropertyLength (ent pnme len / props name)
(setq props (vlax-invoke ent 'getdynamicblockproperties))
(foreach prop props
(if
(eq (strcase (vla-get-propertyname prop)) (strcase pnme))
(vla-put-value prop len)
)
)
)
(if (and
(setq TheLength
(cond ((getdist
(strcat "\nEnter Length <"
(rtos (setq TheLength
(cond (TheLength) (1.00))
) 2 2 ) ">: " )))
(TheLength)))
(setq objs (ssget ":L" '((0 . "INSERT")))))
(repeat (setq i (sslength objs))
(setq ename (vlax-ename->vla-object
(ssname objs
(setq i (1- i)))))
(ChangePropertyLength
ename "TheLength" TheLength))
)
)
There are many ways to write this code, but i opted not to deviate from the orignal.
HTH
Re: Insert Dynamic Block programmat ically
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
:smileyhappy Oh Sweet! That is so AWESOME! Thank you! Thank you! Thank you! That works great!
I will go through it to try to understand how it all works. But it does work in the drawings the way I needed it to! ![]()
Re: Insert Dynamic Block programmat ically
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hello again
Thank you, your help has been very helpful. I have been able to modify and use your program to modify all parameters of blocks in the drawing for different purposes. I have come across another situation to which I need help.
I would like to change the "Visibility" of blocks nested in another block. I have a block in the drawing which has 3 blocks nested in it. How do I selet the nested blocks within a particular block to be changed?
Thanks again,
Re: Insert Dynamic Block programmat ically
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Dewlevlak wrote:
I would like to change the "Visibility" of blocks nested in another block. I have a block in the drawing which has 3 blocks nested in it. How do I selet the nested blocks within a particular block to be changed?
Thanks again,
As it affect every instance of the block in the drawing might as well Bedit or Refedit the block then run the code there.
Re: Insert Dynamic Block programmat ically
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank you, that worked slick. Sometimes it is easy when programing to forget the simple used all the time AutoCAD commands.


