;; | ---------------------------------------------------------------------------- ;; | PL_GetSlope@Point ;; | ---------------------------------------------------------------------------- ;; | Function : Find the slope of the curve object at a given point ;; | Arguments: ;; | 'ename' - Name of the line, polyline, arc or spline object ;; | Action : Returns the slope in radians at a given point along the curve ;; | Returns 'nil' if the slope cannot be determined at that point ;; | Updated : June 5, 2004 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun PL_GetSlope@Point ( ename pt / oname param ang fd pt1 d vlist Vx en entl ) (setq ang nil) (if (and ename pt) (progn (setq oname (vlax-ename->vla-object ename) param (vlax-curve-getParamAtPoint oname pt) ) (if param (progn (setq fd (vlax-curve-getFirstDeriv oname param) pt1 (MI_Shift pt (car fd) (cadr fd) (caddr fd)) ang (angle pt pt1) ) (vlax-release-object oname) ) (progn ; This part is to fix a bug in the vlax-curve-getFirstDeriv... function (vlax-release-object oname) (setq entl (entget ename) en (LI_item 0 entl) ) (cond ((member en (list "POLYLINE" "LWPOLYLINE")) (setq vlist (PL_plist ename) Vx (GE_LocateVx pt vlist) ) (if Vx (setq ang (angle (nth (1- Vx) vlist) (nth Vx vlist))) (setq ang 0.0) ) ) ((= en "LINE") (setq ang (angle (LI_item 10 entl) (LI_item 11 entl))) ) (T (setq ang 0.0) ) ) )) )) ang )