Jump to content

Recommended Posts

Posted

Hi guys,

I need a little help to debug this:

 

(setq	ent     (car (entsel "\nselect poly:"))
vla-ent (vlax-ename->vla-object ent)
vertexs (vlax-get vla-ent 'coordinates)
n (/ (length vertexs) 2)
 ) 


 
(repeat	n
       (setq pn (list (car vertexs) (cadr vertexs)))
      vertexs (cdr (cdr vertexs))
      n (- n 1)
      lpoldata(cons pn lpoldata)
)
	     

 

I want to make a list with polyline vertices.

 

Thanks!

Posted

One way .... :)

 

 

(setq i 0)
(repeat n
 (setq pt (cons (list (nth i vertexs) (nth (setq i (1+ i)) vertexs)) pt))
 (setq i (1+ i))
 )

Posted

This should be much better , I guess :D

 

(setq ent (car (entsel "\nselect poly:")))

(mapcar (function
         (lambda (x)
           (if (eq (car x) 10)
             (setq lst (cons (list (cadr x) (caddr x)) lst))
           )
         )
       )
       (entget ent)
)

ONE MORE OPTION

 

(setq ent (car (entsel "\nselect poly:")))

(foreach point (entget ent)
 (if (eq (car point) 10)
   (setq lst (cons (list (cadr point) (caddr point)) lst))
 )
)

Posted

(setq    ent     (car (entsel "\nselect poly:"))
           vla-ent (vlax-ename->vla-object ent)
           vertexs (vlax-get vla-ent 'coordinates)
           n (/ (length vertexs) 2)
) 


(repeat    n
       (setq pn (list (car vertexs) (cadr vertexs))[b][color=red];  delete ->   [/color][/b])
                    vertexs (cdr (cdr vertexs))
                n (- n 1)
                    lpoldata(cons pn lpoldata)
       [b][color=red])[/color][/b]
)

 

 

 

Note:

n (/ (length vertexs) 2) -> Only polyline2D created with PLINETYPE = 1

Posted

Another:

 

(   (lambda ( f / e )
       (if (setq e (car (entsel)))
           (f (vlax-get (vlax-ename->vla-object e) 'coordinates))
       )
   )
   (lambda ( l )
       (if l (cons (list (car l) (cadr l)) (f (cddr l))))
   )
)

Posted

Another, update LM code (for all polylines).

 

 


(   (lambda ( f / e )
       (if (setq e (vlax-ename->vla-object (car (entsel)))
                 poly (vl-position (vlax-get e 'ObjectName)
                          '("AcDbPolyline" "AcDb2dPolyline" "AcDb3dPolyline"))
           )
           (f (vlax-get e 'coordinates))
       )
   )
   (lambda ( l )
       (cond
           ((and l (= poly 0)) (cons (list (car l) (cadr l)) (f (cddr l))))
           ((and l (= poly 1)) (cons (list (car l) (cadr l)) (f (cdddr l))))
           ((and l (= poly 2)) (cons (list (car l) (cadr l) (caddr l)) (f (cdddr l))))
       )
   )
)

Posted

 

Select object:

; error: bad argument type: lentityp nil

 

I can not replicate the error... :?

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