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
Attribute height is changing each time routine is run with an Annotative block
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I need some help updating a routine I wrote several years ago. I only do programming when absolutely needed so it usually only happens every couple years. I wrote this routine to count nested blocks inside of dynamic blocks to count parking spaces. The routine worked fine but was relying on the ltscale to scale a block containing an attribute for the total number of spaces. I want to update the routine to use an annotative block so the scale doesn't have to be set. I changed my block containing the attribute but now when I run my routine, the attribute height gets changed each time the routine is run. The text just gets larger and larger. Here is the portion of the routine where the attribute info is gathered and updated with the new value for that attribute. If you need the entire routine, I can post it with a slight modification so it will work outside our network.
(defun updateattrib ()
(setq CNT 0) ; sets count to 0
(while (< CNT (sslength ss)) ; starts loop while CNT is less than the number of objects in the group
(setq ele (ssname ss cnt)) ; gets the object name
(setq blst (entget ele)) ; creates a list of objects inside the block
(setq ename (entnext (cdr (assoc -1 blst))))
(setq edata (entget ename)) ; creates a list of that specific entity name
(setq SORT (cdr (assoc 0 edata))) ; sets SORT to the entity type
(if (= (cdr (assoc 0 edata)) "ATTRIB")
(progn
(setq edata (subst (cons 1 (itoa pcnt))(assoc 1 edata) edata))
(entmod edata)
)
)
(setq CNT (+ CNT 1))
) ;first while
);defun updateattrib
I am running this in Civil 3D 2010 but will want it to work in 2013 so if the solution will only work in 2013, that is fine with me.
Woolpert, Inc.
Civil 3D 2013
Solved! Go to Solution.
Re: Attribute height is changing each time routine is run with an Annotative blo
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
entmod doesnt work well with Annotative text style
(defun updateattrib ()
(vl-load-com)
(setq CNT 0) ; sets count to 0
(while (< CNT (sslength ss)) ; starts loop while CNT is less than the number of objects in the group
(setq ele (ssname ss cnt)) ; gets the object name
(setq blst (entget ele)) ; creates a list of objects inside the block
(setq ename (entnext (cdr (assoc -1 blst))))
(setq edata (entget ename)) ; creates a list of that specific entity name
(setq SORT (cdr (assoc 0 edata))) ; sets SORT to the entity type
(if (= (cdr (assoc 0 edata)) "ATTRIB")
(vla-put-textstring (vlax-ename->vla-object ename) (itoa pcnt))
;;; (progn
;;; (setq edata (subst (cons 1 (itoa pcnt))(assoc 1 edata) edata))
;;; (entmod edata)
;;; )
)
(setq CNT (+ CNT 1))
) ;first while
)
HTH
Re: Attribute height is changing each time routine is run with an Annotative blo
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks for the help. Since I only get to do programming about once a year, it takes a while to remember everything and when I only want to do a little tweak, it seems to take even longer.
Woolpert, Inc.
Civil 3D 2013
Re: Attribute height is changing each time routine is run with an Annotative blo
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Tom_Berning wrote:Thanks for the help. Since I only get to do programming about once a year, it takes a while to remember everything and when I only want to do a little tweak, it seems to take even longer.
I know the feeling Tom.
Glad i could help

