Jump to content

Recommended Posts

Posted

Change start point on polyline with lisp

Posted
(vla-put-coordinate
 (vlax-ename->vla-object (setq enm (car (entsel))))
 0
 (trans (getpoint "\nNew point: ") 1 enm)
)

Posted
Change start point on polyline with lisp

 

Are you looking to change the position of the start vertex (i.e. changing the appearance of the polyline), or relocate the start vertex to one of the other vertices for a closed polyline?

Posted

I want to change the entry point of the closed polyline . Thank you

Posted

You probably need to use vlax-3d-point (AutoCAD is less forgiving than BricsCAD):

(vla-put-coordinate
 (vlax-ename->vla-object (setq enm (car (entsel))))
 0
 (vlax-3d-point (trans (getpoint "\nNew point: ") 1 enm))
)

Posted (edited)
francesc said:
I want to change the entry point of the closed polyline . Thank you

 

Here, try this from my library...

 

(defun c:CHIV ( / osm ss e f ed edd eddd eddd1 eddd2 eddd3 newed p m n i )

 (vl-load-com)

 (setq osm (getvar 'osmode))
 (setvar 'osmode 1)
 (prompt "\nPick closed 2d polyline with or without arcs")
 (setq ss (ssget "_+.:E:S:L" '((0 . "*POLYLINE") (-4 . "<or") (70 . 1) (70 . 129) (-4 . "or>"))))
 (if ss
   (setq e (ssname ss 0))
   (progn
     (setvar 'osmode osm)
     (alert "Picked wrong entity... Please pick normal closed 2d polyline next time-quitting...")
     (exit)
   )
 )
 (if (eq (cdr (assoc 0 (entget e))) "POLYLINE")
   (progn
     (setq f t)
     (command "_.convertpoly" "_l" e "")
   )
 )
 (setq ed (entget e))
 (setq edd nil)
 (foreach ec ed 
   (if (not 
         (or (eq (car ec) 10) (eq (car ec) 40) (eq (car ec) 41) (eq (car ec) 42) (eq (car ec) 91) (eq (car ec) 210))
       )
       (setq edd (cons ec edd))
   )
 )
 (setq edd (reverse edd))
 (setq eddd nil)
 (setq eddd1 nil)
 (setq eddd2 nil)
 (setq eddd (member (assoc 10 ed) ed))
 (setq p (getpoint "\nPick vertex you want to become initial"))
 (setq m (vlax-curve-getparamatpoint e (vlax-curve-getclosestpointto e p)))
 (if (assoc 91 ed) (setq n (* m 5)) (setq n (* m 4)))
 (setq i 0)
 (foreach ec eddd
   (progn
     (setq i (+ i 1))
     (if (<= i n)
       (setq eddd1 (cons ec eddd1))
     )
     (if (> i n)
       (setq eddd2 (cons ec eddd2))
     )
   )
 )
 (setq eddd1 (reverse eddd1))
 (setq eddd3 (list (assoc 210 eddd2)))
 (setq eddd2 (cdr eddd2))
 (setq eddd2 (reverse eddd2))
 (setq newed (append edd eddd2 eddd1 eddd3))
 (entmod newed)
 (entupd e)
 (setvar 'osmode osm)
 (if f
   (command "_.convertpoly" "_h" e "")
 )
 (alert "After CHIV, run PEDIT->Edit Vertex to see change")
 (princ)
)
 

 

HTH, M.R.

 

[EDIT : Newer version here : https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/get-all-lines-and-trace-them-all/m-p/11329901/highlight/true#M434369 ]

Edited by marko_ribar
  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...