gS7 Posted April 12, 2013 Share Posted April 12, 2013 Hello CadTutor Friends , Check Example Code (Defun c:Test(/ pline int in pt ppt mspace thepoint) (if (and (setq pline (car (entsel "\nSelect Polyline:"))) (setq int (getdist "\nEnter Interval:")) (setq in int) ) (progn (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object) ) ) ) (while (Setq pt (vlax-curve-getPointAtDist pline int)) (setq thepoint (vlax-invoke mspace 'addcircle pt 0.1)) (setq int (+ int in)) ) ) )(princ) ) Here i want to find curve point Also Please Check Attachment Curve Point.dwg Quote Link to comment Share on other sites More sharing options...
pBe Posted April 12, 2013 Share Posted April 12, 2013 And every subsequent point? For what purpose? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted April 12, 2013 Share Posted April 12, 2013 Read about the function vlax-curve-getpointatparam Quote Link to comment Share on other sites More sharing options...
gS7 Posted April 12, 2013 Author Share Posted April 12, 2013 Pbe I am Trying to Write Codes for My Project Purpose Check Codes (defun c:Rail (/ *error* osm cmh adoc space s ename int l width d sp spp pt fd ang ) (vl-load-com) (defun *error* (s) (if osm (setvar 'osmode osm)) (and cmh (setvar 'cmdecho cmh)) (and adoc (vla-endundomark adoc)) (cond ((not s)) ((member s '("Function cancelled" "quit / exit abort"))) ((princ (strcat "\n--->Error:" s))) ) (princ)) (setq adoc(vlax-get (vlax-get-acad-object) 'ActiveDocument)) (setq space(vlax-get adoc 'ModelSpace)) (setq osm (getvar 'osmode) cmh (getvar 'cmdecho) ) (setvar 'cmdecho 0) (setvar 'osmode 0) (if (setq s (car (entsel "\nSelect Alignment:"))) (progn (setq ename(vlax-ename->vla-object s)) (if (or (or (eq (vla-get-ObjectName ename) "AcDbPolyline") (eq (vla-get-ObjectName ename) "AcDb3dPolyline") (eq (vla-get-ObjectName ename) "AcDbLine") ) ) (progn (vla-startundomark adoc) (if (and (and (setq Int (getreal "\nIncrement Distace:")) (setq L (getreal "\nLength:")) (setq width (getreal "\nWidth:")) ) ) (progn (setq d (vlax-curve-getdistatparam s (vlax-curve-getendparam s))) (setq sp (vlax-curve-getstartpoint s)) (setq spp(vlax-curve-getpointatdist s l)) (Gs:Apply_Hatch s width sp spp space (angle sp spp)) (setq i int) (vla-offset ename (- (/ width 2))) (vla-offset ename (/ width 2)) (repeat (fix (/ d int)) (setq pt (vlax-curve-getpointatdist s int)) (setq fd(vlax-curve-getFirstDeriv s (vlax-curve-getparamatdist s int))) (setq ang (angle '(0.0 0.0 0.0) fd)) (if (setq npt(vlax-curve-getpointatdist s (+ (vlax-curve-getdistatpoint s pt) l))) (progn (Gs:Apply_Hatch s width pt npt space ang) ) ) (setq int (+ i int)) );repeat );progn (*error* "Values Must be Enter!") );if );progn (*error* "Invalid Object !") );if );progn (*error* "Nothing Selected !") );if (*error* nil) (vla-endundomark adoc) (vlax-release-object adoc) (princ) );end defun (prompt "\n*** Enter \"Rail\" to execute Command ***") (defun Gs:Apply_Hatch (ss w p np spc a / fd ang a1 a2 a3 a4 pline h) (setq a1 (polar p (- a (/ pi 2.0)) (/ w 2.0)) a2 (polar np (- a (/ pi 2.0)) (/ w 2.0)) a3 (polar np (+ a (/ pi 2.0)) (/ w 2.0)) a4 (polar p (+ a (/ pi 2.0)) (/ w 2.0)) ) (vl-cmdf "_.PLINE" a1 a2 a3 a4 "c") (setq pline (vlax-ename->vla-object (entlast))) (setq h (vla-addhatch spc acHatchPatternTypePredefined "SOLID" :vlax-true ) ) (vlax-invoke h 'AppendOuterLoop (list pline)) (vlax-invoke h 'Evaluate) ) Here i got One Problem which is I Cannot Make Hatch Object in Curve Points Please Check Attachment for your Reference Rail Track.dwg Quote Link to comment Share on other sites More sharing options...
pBe Posted April 12, 2013 Share Posted April 12, 2013 What value do you supply for INT , L , Width to get the result on your example drawing? Quote Link to comment Share on other sites More sharing options...
gS7 Posted April 12, 2013 Author Share Posted April 12, 2013 What value do you supply for INT , L , Width to get the result on your example drawing? = 2.0 = 1 = 0.5 Quote Link to comment Share on other sites More sharing options...
fixo Posted April 12, 2013 Share Posted April 12, 2013 Another hint instead of (Setq pt (vlax-curve-getPointAtDist pline int)) use this one (Setq pt (vlax-Curve-GetClosestPointTo pline (vlax-curve-getPointAtDist pline int))) from my oldie experience on the quick glance Quote Link to comment Share on other sites More sharing options...
pBe Posted April 12, 2013 Share Posted April 12, 2013 In the future. are you planing to use this on plines with arcs? that will be a little complicated Quote Link to comment Share on other sites More sharing options...
gS7 Posted April 12, 2013 Author Share Posted April 12, 2013 In the future. are you planing to use this on plines with arcs? that will be a little complicated Yes pbe but i Have another Plan , i.e. in that pline if i found curve point i want to skip my next point to 0.5 m from the curve point and tel me How to find those curve points first Quote Link to comment Share on other sites More sharing options...
gS7 Posted April 12, 2013 Author Share Posted April 12, 2013 Another hintinstead of (Setq pt (vlax-curve-getPointAtDist pline int)) use this one (Setq pt (vlax-Curve-GetClosestPointTo pline (vlax-curve-getPointAtDist pline int))) from my oldie experience on the quick glance Fixo i did not get Your Point please me clearly Quote Link to comment Share on other sites More sharing options...
pBe Posted April 12, 2013 Share Posted April 12, 2013 and tel me How to find those curve points first (if (setq pline (car (entsel "\nSelect Polyline:"))) (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget pline)) ) ) (if (setq pline (car (entsel "\nSelect Polyline:"))) (repeat (setq n (cdr (assoc 90 (entget pline)))) (setq pts (cons (vlax-curve-getpointatparam pline (setq n (1- n))) pts ))) ) (if (setq pline (car (entsel "\nSelect Polyline:"))) (if (eq (setq p (vlax-curve-getEndParam pline)) (fix p)) (repeat (setq p (1+ (fix p))) (setq l (cons (vlax-curve-getPointAtParam pline (setq p (1- p))) l)) ) ) ) (if (setq pline (car (entsel "\nSelect Polyline:"))) (vlax-get (vlax-ename->vla-object pline) 'coordinates)) Pick your poison Quote Link to comment Share on other sites More sharing options...
gS7 Posted April 12, 2013 Author Share Posted April 12, 2013 (if (setq pline (car (entsel "\nSelect Polyline:"))) (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget pline)) ) ) (if (setq pline (car (entsel "\nSelect Polyline:"))) (repeat (setq n (cdr (assoc 90 (entget pline)))) (setq pts (cons (vlax-curve-getpointatparam pline (setq n (1- n))) pts ))) ) (if (setq pline (car (entsel "\nSelect Polyline:"))) (if (eq (setq p (vlax-curve-getEndParam pline)) (fix p)) (repeat (setq p (1+ (fix p))) (setq l (cons (vlax-curve-getPointAtParam pline (setq p (1- p))) l)) ) ) ) (if (setq pline (car (entsel "\nSelect Polyline:"))) (vlax-get (vlax-ename->vla-object pline) 'coordinates)) Pick your poison Quote Link to comment Share on other sites More sharing options...
pBe Posted April 12, 2013 Share Posted April 12, 2013 You can use any of those snippets to retrieve the points gS7. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 12, 2013 Share Posted April 12, 2013 Here is another set of functions to choose from: www.cadtutor.net/forum/showthread.php?70541&p=483278&viewfull=1#post483278 Quote Link to comment Share on other sites More sharing options...
gS7 Posted April 12, 2013 Author Share Posted April 12, 2013 You can use any of those snippets to retrieve the points gS7. Yes I got it Pbe Nice collection for retrieve Vertex of Plines and That was Great !! Thank You So Much and one more Question Pbe how do i Check Curve Points with Give Interval Distance Point Quote Link to comment Share on other sites More sharing options...
gS7 Posted April 12, 2013 Author Share Posted April 12, 2013 Here is another set of functions to choose from: www.cadtutor.net/forum/showthread.php?70541&p=483278&viewfull=1#post483278 Thank You Lee Nice programs u Have to Quote Link to comment Share on other sites More sharing options...
pBe Posted April 12, 2013 Share Posted April 12, 2013 .....and one more Question Pbe how do i Check Curve Points with Give Interval Distance Point vlax-curve-getPointAtDist or is it vlax-curve-getDistAtPoint Holler if you need help finishing your program gS7 Quote Link to comment Share on other sites More sharing options...
gS7 Posted April 13, 2013 Author Share Posted April 13, 2013 Holler if you need help finishing your program gS7 Yes sure i will post if i had any doubts Thank You again pbe 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.