1. Registered forum members do not see this ad.

Originally Posted by KRBeckman
I might be missing something here, but would it be possible to take the points taken from the polyline and save them as pt1, pt2, pt3.... so they can be used in another command?
Wow... this is an old thread - takes me back to when I started learning all this..

As for your question - all the point data is in the resulting list, so you could assign your variables from that.

But I would approach it differently and use vlax-curve-getPointatParam as you have much more control.

2. I tried to search Visual Lisp's help and google for this and I can only find examples of it being used that went way over my head... do you mind showing me an example of using this function and break it down step by step how it works?

3. Each curve object is 'divided' by a parameter, you can look at it as the parameter in a set of parametric equations that would describe the curve if you like, so for a circle:

Code:
```x = r cos(t)
y = r sin(t)```
Where, in this case, t is the parameter.

The curve functions allow you to get a point for a specific parameter value.

In the case of LWPolylines, each segment spans between two integer values of the parameter, hence each vertex is at an integer parameter value.

This gives you a lot of control when getting specific parameter values, as you can just 'count' the vertices.

Example:

Code:
```(defun c:test (/ ent i pt)
(setvar "PDMODE" 34)

(if (setq ent (car (entsel "\nSelect LWPolyline: ")))
(progn

(setq i (1- (vlax-curve-getStartParam ent)))

(while (setq pt (vlax-curve-getPointatParam ent (setq i (1+ i))))

(entmakex (list (cons 0 "POINT") (cons 10 pt))))))

(princ))```

4. A long winded example.
Code:
```(defun c:test (/ ent idx pt startParam endParam)
(setvar "PDMODE" 34)

(if (setq ent (car (entsel "\nSelect LWPolyline: ")))
(progn
(setq startParam (vlax-curve-getStartParam ent))  ; this is usually zero
(setq endParam (vlax-curve-getEndParam ent))
(setq idx startParam)
(while (<= idx endParam) ; loop until we get to the last param
(setq pt (vlax-curve-getPointatParam ent idx))
(entmakex (list (cons 0 "POINT") (cons 10 pt)))
(cond
((= idx endParam)
(setq idx (1+ idx)) ; force an exit of the loop
)

((> (setq idx (1+ idx)) ; next param
endParam) ; test to see of we are past the end Param
(setq idx endParam) ; in case the last param is a fraction
)
)
)
)
)
(princ)
)```

5. Wow, way over my head, I still have a lot to learn

6. Originally Posted by KRBeckman
Wow, way over my head, I still have a lot to learn
I would recommend persevering with the curve-functions, they are a handy (and quick!) asset in your toolbox

7. So, I've looked into this a bunch and I'm not getting anywhere... How would I use the vlax-curve-getPointatParam function to save the vertices as pt1, pt2, pt3....?

8. All you need is a LIST of points, correct?

This returns a list of points from the entity list of a LWPolyline.
Code:
`(mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) elst))`
Use it like this:
Code:
```(defun c:test()
(setq ent (car(entsel "\nSelect a polyline.")))
(setq elst (entget ent))
(setq PointList (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) elst)))
(princ)
)```
You don't need to assign each point to a variable.
Tell us what you want to do with these points.

9. Code:
(mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) elst))
Yeah, I've gotten this far...

Tell us what you want to do with these points.
I want to use these points in filling the Polyline with 3d-Faces

10. Registered forum members do not see this ad.