Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using Polyline in LISP

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
674 Views, 5 Replies

Using Polyline in LISP

Hi All,

 

I have this routine to use "polyline" when I want to edit att blocks however I just can use it when I have blocks in line.

I need to change this routine to work when the blocks is not in line. Can you help me to modify this LISP?

 

(defun af_VERTEX_LIST (AN_ENTITY / e d p vertex_list)
  (setq e AN_ENTITY)
  (setq d (entget e))
  (if (= (cdr(assoc 0 d)) "LWPOLYLINE")
      (progn
       (foreach x d
        (if (= 10 (car x))
            (setq vertex_list (cons (append (cdr x)(list 0.0)) vertex_list))
        )
       )
      )
  )
  (if (= (cdr(assoc 0 d)) "POLYLINE")
      (progn
       (setq e (entnext e))
       (setq d (entget e))
       (while (= "VERTEX" (cdr(assoc 0 d)))
        (setq p (cdr(assoc 10 d)))
        (setq vertex_list (cons p vertex_list))
        (setq e (entnext e))
        (setq d (entget e))
       )             
      )
  )
  (setq vertex_list vertex_list)
)

 

Thank you.

 

5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

I have not used this command

Message 3 of 6
Kent1Cooper
in reply to: Anonymous

That code only makes a list of a Polyline's vertices, adding 0 as the Z coordinate for a LWPolyline [whose entity data stores only XY coordinates for each vertex].  I think we need to see whatever does something with the Blocks you mention.  Post more code, and/or a sample drawing with before and after conditions.

Kent Cooper, AIA
Message 4 of 6
Anonymous
in reply to: Kent1Cooper

fence.JPG

Message 5 of 6
Kent1Cooper
in reply to: Anonymous

So, what do you want to do with those things?  Select the stepping Polyline and the Blocks, and have them Moved to the perpendicular location on the Polyline?  If so, will they always be in a similar relationship, i.e. always with orthogonal Polyline line [only] segments, and always Moving the Blocks in the same orthogonal direction as each other?

 

You mention "edit att blocks" in Post 1.  Do you already have something that puts the number values in for the ?? Attributes, or are you looking for something to do that, in addition to Moving the Blocks?  If so, what are the criteria for the numbering?

 

I could probably think of more questions....  Be as specific and detailed as you can.

Kent Cooper, AIA
Message 6 of 6
Anonymous
in reply to: Kent1Cooper

With the code I have, I can edit a terminal fence (change the numbers) but only if the polyline is drawn horizontal. I am wondering if I can change the code so that I will be able to edit all the terminal on a page, from top to bottom, not just from side to side?

I've tried to edit all the terminals on one page with one polyline, which links the top row and the bottom row of terminals but this causes 'too many arguments' in autocad.

 

I hope this is more helpful.

 

Thank you.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report