prny90 Posted June 17, 2010 Share Posted June 17, 2010 hello, I am trying to write a lisp program to get the coordinates of the points on a parabolic profile at every one mm distance. this points must be stored in to a text file so that it can be given as input for my machine. please help me in this regard. Quote Link to comment Share on other sites More sharing options...
Tiger Posted June 17, 2010 Share Posted June 17, 2010 Take a look at Lee Mac's signature (if you are lucky, he'll come along and say hi) for the Point Manager - that might help you. Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 17, 2010 Share Posted June 17, 2010 http://www.cadtutor.net/forum/showthread.php?t=42954 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 17, 2010 Share Posted June 17, 2010 Thanks guys, but my Point Manager will only do Poyline vertices as far as curves are concerned and so I'm not sure it'll suit his needs Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 18, 2010 Share Posted June 18, 2010 Just use Measure, then export the points. Quote Link to comment Share on other sites More sharing options...
prny90 Posted June 24, 2010 Author Share Posted June 24, 2010 thanks guys the measure works :-) Quote Link to comment Share on other sites More sharing options...
fixo Posted June 24, 2010 Share Posted June 24, 2010 thanks guys the measure works :-) Using measure you will loose both end points Try this out: (vl-load-com) ;;==============================================;; (defun C:EXPOINTS (/ *error* cnt datafile dimz en end filename obj param pt ptlist sset start step) (defun *error* (msg) (if datafile (close datafile)) (if dimz (setvar "dimzin" dimz)) (if msg (princ (strcat "\nError! " msg))) (princ) ) (setq dimz (getvar "dimzin")) (setvar "dimzin" 2);<-- change to suit ;;==============================================;; (setq filename (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname"))".txt") ) (prompt "\n >> Select polyline >>") (if (setq sset (ssget "+.:S:E" (list (cons 0 "LWPOLYLINE,SPLINE")))) (progn (setq datafile (open filename "W")) (initget 6) (setq step (getreal "\n Enter step <10>: ")) (if (not step)(setq step 10)) (setq en (ssname sset 0) obj (vlax-ename->vla-object en) leng (vla-get-length obj) ) (setq cnt -1 start 0 ) (while (<= (setq dist (* (setq cnt (1+ cnt)) step)) leng) (setq param (vl-catch-all-apply (function (lambda() (vlax-curve-getparamatdist obj dist)) ) ) ) (setq pt (vlax-curve-getclosestpointto obj (vlax-curve-getpointatparam obj param) ) ) (setq ptlist (cons pt ptlist) ) ) (if (not (equal (car ptlist)(setq end (vlax-curve-getendpoint obj)) 0.00001)) (setq ptlist (cons end ptlist)) ) (setq ptlist (reverse ptlist ) ) (foreach p ptlist (write-line (strcat (rtos (car p)2 3);<--precision 3 decimals (chr 9) (rtos (cadr p) 2 3) (chr 9) (rtos (cadr p)2 3)) datafile) ) (close datafile) ) ) (princ) ) ;;==============================================;; (prompt "\nStart command with EXPOINTS") (prin1) ~'J'~ Quote Link to comment Share on other sites More sharing options...
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.