;;---------------------------------------------------- ;; Function to compute the bulge of a polyline segment ;; given the arguments: ;; p1 = 1st vertex of segment ;; midp = midpoint of segment ;; p2 = 2nd vertex of segment ;; (c)2002, John F. Uhden, Cadlantic (defun getbulge (p1 midp p2 / ang chord midc alt) (setq ang (angle p1 p2) chord (distance p1 p2) midc (polar p1 ang (* chord 0.5)) ; midpoint of chord alt (distance midp midc) ) (if (equal (angle midp midc)(rem (+ ang (* pi 0.5))(* pi 2)) 1e-4) (/ alt chord 0.5) (/ alt chord +0.5) ) ) ;;----------------------------------------------------------- ;; Function to return 2DPolyline data as a list in the format ;; (v1 bulge1 v2 bulge2 ... vn bulgen) ;; given one argument: ;; Object = either an Ename or VLA-Object that is any of the ;; following: ;; AcDb2dPolyline ("Heavy" POLYLINE) ;; AcDbPolyline (LWPOLYLINE) ;; AcDb2dVertex ("Heavy" POLYLINE VERTEX) ;; Coordinates are in WCS, or OCS if object is nested. ;; NOTE that if the polyline is closed, the last vertex ;; will equal the first vertex. ;; (c)2002, John F. Uhden, Cadlantic ;; Release 15.0 or higher (defun VListAX (Object / Name Ptype EndParam Param closed p1 p2 midp bulge vlist) (vl-load-com) (if (not *acad*)(setq *acad* (vlax-get-acad-object))) (and (cond ((= (type Object) 'VLA-Object)) ((= (type Object) 'ENAME) (setq Object (vlax-ename->vla-Object Object)) ) (T (setq Object nil)) ) (setq Name (vla-get-Objectname Object)) (cond ((= Name "AcDb2dPolyline") (setq Ptype (vla-get-type Object)) ) ((= Name "AcDbPolyline") (setq Ptype 0) ) ((= Name "AcDb2dVertex") (setq Object (vla-ObjectIDToObject (vla-get-activedocument *acad*) (vla-get-OwnerId Object) ) Ptype (vla-get-type Object) ) ) ) (setq closed (vla-get-closed Object)) (setq EndParam (vlax-curve-GetEndParam Object)) (setq Param EndParam) (setq p2 (vlax-curve-GetEndpoint Object)) (setq vlist (list p2)) (while (> Param 0) (if (= Ptype 0) ; acSimplePoly (setq Param (1- Param) p1 (vlax-curve-GetPointAtParam Object Param) bulge (vla-getbulge Object (fix Param)) ) (setq Param (- Param 0.5) midp (vlax-curve-GetPointAtParam Object Param) Param (- Param 0.5) p1 (vlax-curve-GetPointAtParam Object Param) bulge (getbulge p1 midp p2) ) ) (setq vlist (cons p1 (cons bulge vlist)) p2 p1 ) ) ) (cond ((not vlist) nil) ((= closed :vlax-true) (append vlist (list (cadr vlist))) ) ((= Ptype 0) (append vlist (list (vla-getbulge Object EndParam))) ) (T (append vlist '(0.0))) ) )