symoin Posted Tuesday at 09:28 PM Posted Tuesday at 09:28 PM Dear All. I am looking for a lisp code that will give a station and the coordinates of selected polyline at the required locations. Something like I select a polyline and then I pick at the required location at the polyline and then pick the location where the station and coordinates are placed and it will have a arrow from the first location to the second. and then I continue to pick and place the station and coordinates multiple times without selecting the polyline again. St. 01+234.567 E 100000.000 N 50000.000 I googled a lot and I could get only coordinate lisps. Thanks in advance. Quote
BIGAL Posted Tuesday at 10:41 PM Posted Tuesday at 10:41 PM Did you post this question elsewhere? There is a CIV3D request for this task over at forums/autodesk in the Lisp section. The answer for a pline is in using these two VL functions. vlax-curve-getclosestpointto and vlax-curve-getdistatpoint. These will return offset and distance along the pline. Quote
symoin Posted Wednesday at 04:33 PM Author Posted Wednesday at 04:33 PM No I haven't posted any thing in civil3d, though I have made a different request I have made request in autodesk in lisp section. Quote
Isaac26a Posted 15 hours ago Posted 15 hours ago This will get you what you needed, if you want something fancy, it will cost you a cup of coffee. ;;; Program 'sap' Station At Point ;;; By Isaac A 20241226 ;;; https://www.cadtutor.net/forum/topic/95474-lisp-to-get-the-station-and-coordinates-of-a-polyline-at-pick-location/ (vl-load-com) (defun c:sap (/ a b c d dw o oe s) (setq oe (getvar 'cmdecho) o (getvar 'osmode) ) (setvar 'cmdecho 0) (vla-startundomark (setq dw (vla-get-activedocument (vlax-get-acad-object)))) (setvar 'osmode 0) (alert "Program to put a text containing the distance (Station) in a polyline. ") (princ "\nSelect a polyline. ") (setq s (ssget ":S:E" '((0 . "LWPOLYLINE")))) (while (= s nil) (princ "\nSelect a polyline. ") (setq s (ssget ":S:E" '((0 . "LWPOLYLINE")))) ) (setq a (ssname s 0)) (setq b (vlax-ename->vla-object a) c (list 0 0 0) ) (setvar 'osmode 545) (setvar 'pdmode 35) (setvar 'pdsize 0.6) (setq c (vlax-curve-getClosestPointTo b (getpoint "\nSelect a point on the polyline: ")) d (vlax-curve-getDistAtPoint b c) ) (entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") '(100 . "AcDbText") (cons 8 "Stations") (cons 10 c) (cons 40 1.) (cons 1 (strcat "St." (rtos d 2 2))) ) ) (entmake (list (cons 0 "point") (cons 100 "AcDBpoint") (cons 8 "Stations") (cons 62 1) (cons 10 c) ) ) (setvar 'cmdecho oe) (setvar 'osmode o) (vla-endundomark dw) (princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; End of file ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Quote
Recommended Posts
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.