Jump to content

How to mark on 3D Pline/3D Spline with specified distance from point to point?


Phiphi

Recommended Posts

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.

 

makingdistanceseg5.jpg

w758.png

Marking_distances.dwg

Link to comment
Share on other sites

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)
)

Link to comment
Share on other sites

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?

 

3dplineqo0.jpg

w837.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

...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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...