Author Topic: increase number of attribute block along a polyline  (Read 8256 times)

0 Members and 1 Guest are viewing this topic.

pedroantonio

  • Guest
increase number of attribute block along a polyline
« on: May 10, 2014, 03:08:42 AM »
Hi,Is it possible to increase number of attribute block along a polyline allways in clockwise direction. Look the attach test2.dwg

Thanks

reltro

  • Guest
Re: increase number of attribute block along a polyline
« Reply #1 on: May 10, 2014, 07:34:15 AM »
Hey...
its possible for sure...

Start with PseudoCode:
1. Select Polyline
2. Pick the Point
3. Get the Vertices of the Polyline
4. Sort them, so that the vertices nearest to the Point in 2. is the first.
5. reverse or not the list from step 4. to be clockwise
6. insert BlockReference on each vertex
7. change Attribute value

An approach...
Code: [Select]
(defun From1to4 ( / vertices entselOut PickPoint dist StartIndex)
   (vl-load-com)
   (setq   entselOut   (entsel "Pick a polyline near to the startpoint")
         PickPoint   (cadr entselOut)
         vertices   (mapcar
                     'cdr
                     (vl-remove-if-not
                        '(lambda (a / )
                           (= (car a) 10)
                        )
                        (entget (car entselOut))
                     )
                  )
         StartIndex   (vl-position
                     (apply
                        'min
                        (setq dist
                           (mapcar
                              '(lambda (a / )
                                 (distance PickPoint a)
                              )
                              vertices
                           )
                        )
                     )
                     dist
                  )
   )
   
   (repeat StartIndex (setq vertices (reverse (cons (car vertices) (reverse (cdr vertices))))))
)

Greets reltro

pedroantonio

  • Guest
Re: increase number of attribute block along a polyline
« Reply #2 on: May 10, 2014, 10:13:25 AM »
Hi reltro

Quote
1. Select Polyline
2. Pick the Point
3. Get the Vertices of the Polyline
4. Sort them, so that the vertices nearest to the Point in 2. is the first.
5. reverse or not the list from step 4. to be clockwise
6. insert BlockReference on each vertex
7. change Attribute value

this is exactly what i am looking for , but this code after select the polyline stops ....

Thanks

reltro

  • Guest
Re: increase number of attribute block along a polyline
« Reply #3 on: May 10, 2014, 10:28:11 AM »
sure it stops, all has to have an end ;)

look at his name! its called: "From1to4"
its just a Part...

Try coding yourself!

pedroantonio

  • Guest
Re: increase number of attribute block along a polyline
« Reply #4 on: May 10, 2014, 10:38:17 AM »
Thanks you for your time reltro

pedroantonio

  • Guest
Re: increase number of attribute block along a polyline
« Reply #5 on: May 14, 2014, 05:12:40 AM »
Can anyone help

Thanks

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ChrisCarlson

  • Guest
Re: increase number of attribute block along a polyline
« Reply #7 on: May 14, 2014, 08:05:58 AM »
Where have you left off? What part are you stuck on?

pedroantonio

  • Guest
Re: increase number of attribute block along a polyline
« Reply #8 on: May 14, 2014, 12:17:26 PM »
The polyline have allready attribiute blocks on it .The only thing i want to do is to increase the value of attribute block along a polyline clockwise all the times like this

1,2,3,4,5,6,7,8,...............
Or
Giving a letter first like
K1,K2,K3,K4,..........................
T1,T2,T3,.............................

1) first select the polyline .(The polyline have allready attribiuts on it)
2) Give or not a letter
3)Pick the first point (the point that will have the number 1 or K1 etc...)
4) increase the value of attribute block along a polyline clockwise 

ChrisCarlson

  • Guest
Re: increase number of attribute block along a polyline
« Reply #9 on: May 14, 2014, 04:24:06 PM »
I'm not sure how to gather the coordinates in a clockwise fashion but if it's not many attributes you can just manually select them one at a time?

Code: [Select]
(setq num_seq
    (getint
      (strcat "\nStarting number <"
         (itoa num_seq)">: ")))
(car (nentsel "\n--- SELECT ATTRIBUTE ---- ")))
(if (and curText ;
                 (setq curData (entget curText))
                 (= (cdr (assoc 0 curData)) "ATTRIB")
)
         (progn
            (vla-put-TextString
(vlax-ename->vla-object curText)curStr)
(setq num_seq(1+ num_seq))
         )
        (princ "\n--- THIS IS NOT AN ATTRIBUTE ---- ")

pedroantonio

  • Guest
Re: increase number of attribute block along a polyline
« Reply #10 on: May 14, 2014, 04:31:26 PM »
Thank you ChrisCarlson but i want to  increase the value of attribute block along a polyline clockwise  automaticaly all. Select only the first ,because i have a lot of points to rename...

pedroantonio

  • Guest
Re: increase number of attribute block along a polyline
« Reply #11 on: May 16, 2014, 01:28:37 AM »
is it possible to  increase the value of attribute block along a polyline clockwise  automaticaly. and how?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: increase number of attribute block along a polyline
« Reply #12 on: May 16, 2014, 08:56:53 AM »
is it possible to  increase the value of attribute block along a polyline clockwise  automaticaly. and how?

Perhaps a bit of searching will lead you in the right direction
http://goo.gl/M9O64C
http://goo.gl/GhIaYY

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

pedroantonio

  • Guest
Re: increase number of attribute block along a polyline
« Reply #13 on: May 16, 2014, 04:07:16 PM »
can anyone help with the code ?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: increase number of attribute block along a polyline
« Reply #14 on: May 16, 2014, 04:09:27 PM »
is it possible to  increase the value of attribute block along a polyline clockwise  automaticaly. and how?

Perhaps a bit of searching will lead you in the right direction
http://goo.gl/M9O64C
http://goo.gl/GhIaYY

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC