# Thread: Measure...vlax-curve-getPointAtDist...how to do this?

1. ## Measure...vlax-curve-getPointAtDist...how to do this?

Registered forum members do not see this ad.

Good morning,
I want to put a "gradation" on a curve (pline, spline, line) - see the attached drawing. And i have no idea how to do it, or if it's possible to do it. "Gradation" is always perpendicular on the curve.L1, L2, D - given values. Any idea? Measure? Vlax-curve-getPointAtDist?

2. Regarding the programmatically approach, for sure it can be done. Along the function that you already proposed you will need to look also for the second derivative on insertion point in order to get the local tangent, and therefore the perpendicular on curve.

Regards,
Mircea

3. For the second derivative, which function to use?

4. To list the second derivative on a curve at a given location should use vlax-curve-getSecondDeriv.

I suggest you to check in help the vlax-curve-* functions family.

Regards,
Mircea

5. Sorry Mircea, I don't think the SecondDeriv is needed. This may help::
(setq tg (vlax-curve-getFirstDeriv entity param)) will give you the direction of the tangent to curve at param. So the perpendicular direction is (atan (cadr tg) (car tg)) + or - pi/2.

6. Stefan, you are entirely right; I stand corrected. Sorry for inconvenience.

Regards,
Mircea

7. This may get you started , although that I did not get what you wanted specifically .

Consider this just as an example .

Code:
```(defun c:TesT (/ ss p2 l d n)
;;; Tharwat 21. Feb. 2012 ;;;
(if (and
(setq ss (entsel "\n Select a Poly :"))
(member (cdr (assoc 0 (entget (car ss))))
'("LINE" "SPLINE" "LWPOLYLINE" "POLYLINE")
)
(setq p2 (1+ (fix (vlax-curve-getendparam (car ss)))))
(setq l (vlax-curve-getdistatparam (car ss) (- p2 1)))
(setq d (getdist "\n Specify the distance between points :"))
(setq n d)
)
(progn
(entmake
(list '(0 . "POINT")
(cons 10 (vlax-curve-getpointatparam (car ss) 0))
)
)
(repeat
(fix (/ l d))
(setq pt (vlax-curve-getpointatdist (car ss) d))
(entmake (list '(0 . "POINT") (cons 10 pt)))
(setq d (+ n d))
)
)
(princ)
)
(princ)
)```

8. I want to compare 2 strings, what function to use?
(= (cdr (assoc 0 (entget (car(entsel))))) "line") , i select a line and is not working... shoul i use equal, or eq...?

9. You should use it like this ..

and = and eq functions are the same in this case .
Code:
`(eq (cdr (assoc 0 (entget (car(entsel))))) "LINE")`
Or this ...
Code:
`(= (cdr (assoc 0 (entget (car(entsel))))) "LINE")`
But all of these are not a good way of programming .

because if you selected nothing , error would take a place .

10. Registered forum members do not see this ad.

how to determine start point and endpoint for a spline?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts