debug help :bad argument type:
Hithis code is trying to distribute points along a polyline.
(Defun c:demo (/ pline int in pt ppt mspace thepoint) (if (and (setq pline (car (entsel "\nSelect Polyline:"))) (eq (cdr (assoc 0 (entget pline))) "LWPOLYLINE") (setq int (getdist "\nEnter Interval:")) (setq in int) ) (while (Setq pt (vlax-curve-getPointAtDist pline int)) (setq ppt (vlax-curve-getparamatpoint pline pt)) (vlax-invoke (vlax-ename->vla-object pline) (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object) ) ) ) (princ ppt) (setq thepoint (vla-AddPoint mspace (vlax-3d-point pt))) (1+ (fix ppt)) (list (car pt) (Cadr pt)) ) (setq int (+ int in)) ) ))why its yell an error?
Thanks
Shay I believe that you don't need that VLAX-INVOKE(-METHOD); also is better to don't create the space object at each parse:
(Defun c:demo (/ pline int in pt ppt mspace thepoint) (if (and (setq pline (car (entsel "\nSelect Polyline:"))) (eq (cdr (assoc 0 (entget pline))) "LWPOLYLINE") (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 ppt (vlax-curve-getparamatpoint pline pt)) ;(vlax-invoke (vlax-ename->vla-object pline) ) (princ ppt) (setq thepoint (vla-AddPoint mspace (vlax-3d-point pt))) (1+ (fix ppt)) (list (car pt) (Cadr pt)) (setq int (+ int in)) )) ))
The use of Vlax-invoke doesnt require you to "convert" the point coordinate to a variant 3D point. . so it wouldn't hurt to use it at all.
Also, on what your wanting to do, no need for vlax-curve-getparamatpoint
(Defun c:demo (/ pline int in pt ppt mspace thepoint) (if (and (setq pline (car (entsel "\nSelect Polyline:"))) (eq (cdr (assoc 0 (entget pline))) "LWPOLYLINE") (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 'AddPoint pt))(setq int (+ int in)) ) ) )(princ))
But then again. why not use _measure command.
i thought that using command line is slower than programming it, am i mistaken? how can i store all the coordinates of the distributed points than?
Thanks
Shay
(Setq lst nil)(setq lst (cons pt lst))
页:
[1]