Phiphi Posted February 13, 2009 Share Posted February 13, 2009 Thank to JohnM's LISP I just create a 3D Polyline and 3D Spline, but I have no idea how to mark on 3D Polyline and 3D Spline with a specified distance (or varies) from point to point yet. May be a LISP routine will be needed to support solving this problem? Please see attached drawing for details but note that all points and dimensions are NOT correct, just for showing only. Please help, Thanks you. Marking_distances.dwg Quote Link to comment Share on other sites More sharing options...
lpseifert Posted February 13, 2009 Share Posted February 13, 2009 this will place a point a specified distance from the beginning point of a curve written for my personal use, no error checking.... ;places point at specified station along a polyline, measured from start LPS 2008 (defun c:pop () (vl-load-com) (setq oldosnap (getvar "osmode")) (setvar "osmode" 0) (command "ucs" "w") (if (/= (getvar "pdmode") 3)(setvar "pdmode" 3)) (setq ob (entsel "Select curve: ")) (setq p2 (getreal "\n Specify Distance : ")) (setq obj (vlax-ename->vla-object (car ob))) (setq pt1 (vlax-curve-getPointAtDist Obj p2)) (command "Point" pt1) (command "ucs" "p") (setvar "osmode" oldosnap) (princ) ) Quote Link to comment Share on other sites More sharing options...
Phiphi Posted February 13, 2009 Author Share Posted February 13, 2009 Thanks Lpsifert, but the specified distance must be aligned dimensions from Point to Point, not the length along curve. Quote Link to comment Share on other sites More sharing options...
lpseifert Posted February 13, 2009 Share Posted February 13, 2009 draw a circle centered at the begin point of the dimension with a radius of the required distance. Quote Link to comment Share on other sites More sharing options...
Phiphi Posted February 14, 2009 Author Share Posted February 14, 2009 draw a circle centered at the begin point of the dimension with a radius of the required distance. Hi Lpseifert, please note that they are 3D Polyline and 3D Spline, so which UCS will be used for drawing that circle? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 14, 2009 Share Posted February 14, 2009 Try this: (defun c:dimcurve (/ vLst oVar cEnt sDis pt cnt pt2 pt3) (setq vLst (list "PDMODE" "OSMODE" "CMDECHO") oVar (mapcar 'getvar vLst)) (mapcar 'setvar vLst (list 3 0 0)) (if (and (setq cEnt (car (entsel "\nSelect Curve > "))) (member (cdadr (entget cEnt)) '("LINE" "POLYLINE" "LWPOLYLINE" "SPLINE" "ARC" "CIRCLE" "ELLIPSE")) (not (initget 7)) (setq sDis (getreal "\nSpecify Spacing > "))) (progn (command "_ucs" "_w") (setq cnt 0) (while (>= (distance (setq pt (vlax-curve-GetPointAtDist cEnt (* sDis cnt))) (vlax-curve-GetEndPoint cEnt)) sDis) (command "_point" pt) (setq pt2 (polar pt (+ (/ pi 2) (angle '(0 0 0) (vlax-curve-getFirstDeriv cEnt (vlax-curve-GetParamAtPoint cEnt pt)))) 5.0)) (command "_dimaligned" pt (setq pt3 (vlax-curve-GetPointAtDist cEnt (* sDis (setq cnt (1+ cnt))))) pt2) (command "_point" pt3)) (command "_ucs" "_P")) (princ "\n<!> Nothing Selected <!>")) (mapcar 'setvar vLst oVar) (princ)) Due to the nature of what you are doing, the accuracy with DimAligned is only increased by using smaller increments on straighter lines. Quote Link to comment Share on other sites More sharing options...
CarlB Posted February 14, 2009 Share Posted February 14, 2009 Looks to me like Lee's code also measures distance along the curve, not a "point-to-point" distance. Manually, you would draw a sphere with radius of desired distance, center at point1, where curve intersects surface is the desired point2. My thought is the lisp would need to incrementally check distance between points, adjust location along curve until the point on curve was found at desired distance, within some tolerance. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 14, 2009 Share Posted February 14, 2009 Yes, I think tolerance is needed for this - as we are using "dimaligned" which is a linear dimension, when one uses the "GetPointatDist" function, the distance measured may differ somewhat from the straight line distance, for high curvature. Quote Link to comment Share on other sites More sharing options...
Phiphi Posted February 14, 2009 Author Share Posted February 14, 2009 ...draw a sphere with radius of desired distance, center at point1, where curve intersects surface is the desired point2... Yes, this is the main problem that needs to be solved. Then how to insert a Point to the intersection between a Line(or Pline or Spline) and a curved surface? We can use auto aligned dim to show these distances -> from point to point when we have inserted all the right points along Pline/Spline. Quote Link to comment Share on other sites More sharing options...
Phiphi Posted February 14, 2009 Author Share Posted February 14, 2009 Try this:... Due to the nature of what you are doing, the accuracy with DimAligned is only increased by using smaller increments on straighter lines. Thanks Lee Mac, but all aligned dims have to spot on (=15) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 14, 2009 Share Posted February 14, 2009 Thanks Lee Mac, but all aligned dims have to spot on (=15) Hmm... may have to go about a different method in that case (and go down Carl's route), GetPointAtDist is not feasible method for this I don't think. 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.