Author Topic: Place a attribiute block along each segment of polyline with increase number  (Read 1930 times)

0 Members and 1 Guest are viewing this topic.

pedroantonio

  • Guest
Hi , i am trying to write a lisp that place an attribiute block along each segment of 2d or 3d polyline with increase number (like 1 , 2 ,3 ,4 ,5,6,7,...  or  T1,T2,T3,T4,.....)

I start with this code

Code - Auto/Visual Lisp: [Select]
  1.  
  2. ;This code works for any block but have a little problem with attributes
  3. (defun c:Bv ()
  4.   (princ "\nMark your polyline with blocks ")
  5.   (if (setq pObj (car (entsel "\nSelect a Polyline ")))
  6.     (progn
  7.       (setq vList (acet-geom-vertex-list pObj))
  8.       (initget "Yes No")
  9.       (if (null (getkword "\nDo you want marks all vertex ? [Yes/No] <Yes>"))
  10.         (if (not (tblsearch  "BLOCK" (setq bname (getstring "\nType in a block name "))))
  11.           (princ "\nWrong block name, not in library ...")
  12.           (repeat (length vList)
  13.             (command "_INSERT" bname (car Vlist) 1 1 0 )
  14.             (setq vList (cdr vList))
  15.             )
  16.          
  17.           )
  18.         )
  19.       )
  20.     )(princ)
  21.   )
  22.  
  23.  

Any ideas
« Last Edit: May 01, 2014, 10:09:09 AM by Topographer »

pedroantonio

  • Guest
I update the post . Any ideas

pedroantonio

  • Guest
This code works for any block but have a little problem with attributes.Can any one help?

ChrisCarlson

  • Guest
I don't see any lines for editing the attribute

Code: [Select]
(setq col_ida
(car
             (nentsel "\n--- SELECT COL_ID ATTRIBUTE ---- ")))
(if (and col_ida ; perform check to ensure attribute is col_id
         (setq col_idd (entget col_ida))
         (= (cdr (assoc 0 col_idd)) "ATTRIB")
         (= (cdr (assoc 2 col_idd)) "COL_ID")
) ; end check
         (progn ; start renaming process
(setq col_id (getstring "\n ENTER NEW COL_ID VALUE: "))
(vla-put-TextString
(vlax-ename->vla-object col_ida)col_id)
         ); end progn
        (princ "\n--- THIS IS NOT THE COL_ID ATTRIBUTE ---- ")
        ); end if
[/quote]

Here is a rough section of code I'm using for modifying the attribute of our Col ID block for easier renaming.

Bhull1985

  • Guest
I don't see any lines for editing the attribute

Code: [Select]
(setq col_id (getstring "\n ENTER NEW COL_ID VALUE: "))



pedroantonio

  • Guest
something like this ? I prefare to work all the time with point block  (look post 1)

Code - Auto/Visual Lisp: [Select]
  1. ;This code works for any block but have a little problem with attributes
  2. (defun c:Bv ()
  3.   (princ "\nMark your polyline with blocks ")
  4.   (if (setq pObj (car (entsel "\nSelect a Polyline ")))
  5.     (progn
  6.       (setq vList (acet-geom-vertex-list pObj))
  7.       (initget "Yes No")
  8.       (if (null (getkword "\nDo you want marks all vertex ? [Yes/No] <Yes>"))
  9.         (if (not (tblsearch  "BLOCK" (setq bname (getstring "\nType in a block name "))))
  10.           (princ "\nWrong block name, not in library ...")
  11.           (repeat (length vList)
  12.             (command "_INSERT" bname (car Vlist) 1 1 0 )
  13.             (setq vList (cdr vList))
  14.            (setq col_id (getstring "\n ENTER NEW COL_ID VALUE: "))
  15.                 (if (and col_ida ; perform check to ensure attribute is col_id
  16.          (setq col_idd (entget col_ida))
  17.          (= (cdr (assoc 0 col_idd)) "ATTRIB")
  18.          (= (cdr (assoc 2 col_idd)) "COL_ID")
  19.                 ) ; end check
  20.          (progn ; start renaming process
  21.                         (setq col_id (getstring "\n ENTER NEW COL_ID VALUE: "))
  22.                         (vla-put-TextString
  23.                                 (vlax-ename->vla-object col_ida)col_id)
  24.          ); end progn  
  25.         (princ "\n--- THIS IS NOT THE COL_ID ATTRIBUTE ---- ")
  26.         ); end if
  27.  
  28.             )
  29.  
  30.           )
  31.         )
  32.       )
  33.     )(princ)
  34.   )
  35.