Jump to content

retrieve vertices list out of a polyline (without vlisp)


Recommended Posts

Posted

Without Vlisp . :)

 

(mapcar '(lambda (x)
          (if (eq (car x) 10)
            (setq l (cons (list (cadr x) (caddr x)) l))
          )
        )
       (entget s)
)

  • Replies 38
  • Created
  • Last Reply

Top Posters In This Topic

  • samifox

    12

  • Tharwat

    8

  • martinle

    7

  • pBe

    5

Top Posters In This Topic

Posted

What is the different between yr code and the code in the prevuos post?

Posted
What is the different between yr code and the code in the prevuos post?

Did not you try them each one alone ?

What did you find out ?

Posted

Im not in front of pc but by reading i guss that ur code in the other one is about the same

Posted
Im not in front of pc but by reading i guss that ur code in the other one is about the same

 

Yes , and as I said before it is without VLisp function(s) .

Posted

Another:

(apply 'append (mapcar '(lambda ( x ) (if (= 10 (car x)) (list (cdr x)))) (entget <lwpolyline-entity>)))

Posted (edited)
Yes , and as I said before it is without VLisp function(s) .

sorry my for old post VL, some vl- vlax- functions also not need (vl-load-com)

that's why i was confused :)

now i re-post this without VL.

 

(setq e (car(entsel))) ;select LWPOLYLINE

('((l / i j)
  (while
   l
   (if
    (setq i (assoc 10 l))
    (setq j (cons (cdr i) j))
    )
   (setq l (cdr l))
   )
  j
  )
 (entget e) ; <-- e= ename of LWPOLY
 )
;wrapped in lambda due to localize i & j variables

another

('((l / i)
  (cdr
   (foreach
    x
    (mapcar 'cdr l)
    (if
     (listp x)
     (setq i (cons x i))
     )
    )
   )
  )
 (entget e)
 )

as far i know (vl-load-com) for collections documents?

@David it was fun learning :) Thank you

Edited by hanhphuc
  • 3 years later...
Posted

Hello

 

I found these threads.

I have a job to do.

At the selected vertex of a closed polyline, I must place a vertical xline at both endpoints.

In the thread, I can only address all key points.

But I only need the selected vertex of the polyline.

 

Please help

 

Thank you

 

Martin

Posted
Hello

...

At the selected vertex of a closed polyline,

..

But I only need the selected vertex of the polyline.

 

 

I think you meant endpoints of a selected "segment"?

 

Is the no Vlisp rule applies to your request?

Posted
Hello pBe

 

Yes

 

Yes on both counts? "segment" and "No Vlisp rule"?

Posted

Hello pBe

 

I Click on a segment of the polyline and need the endpoints to the left and right of the click point.

 

Thank you

 

Martin

Posted (edited)

Quick Mod

 

(Defun c:demo (/ en param)
 (setq en (entsel))
 (setq param (vlax-curve-getParamAtPoint
		 (Car en)
		 (vlax-curve-getclosestpointto (Car en) [color="blue"](trans (cadr en) 1 0)[/color])
	    )
 )
 (foreach pt (mapcar '(lambda (p)
				[color="blue"](trans [/color](vlax-curve-getPointAtParam (Car en) p)[color="blue"]  1 0)[/color]
			   )
			  (list (fix param) (1+ (fix param)))
	    )
   

   (entmake (list '(0 . "XLINE")
		    '(100 . "AcDbEntity")
		    '(100 . "AcDbXline")
		    (cons 10 [color="blue"](trans pt  0 1)[/color])
		    (cons 11 (getvar "UCSYDIR"))
	   )
   )
 )
 (princ)
)

trans function is your friend

Edited by pBe
UCS Friendly
Posted

Hello pBe

Thanks for the quick help.

 

It does not always work.

If I work in the user UCS then only on one side an Xline is created.

 

 

 

Martin

Posted (edited)

I'll look into it later, stepped out for lunch :)

 

Code at post 33 updated

Edited by pBe
Posted

Hello pBe

 

it works.

Thank you very much for your help.

I have one more question: what should I change so that instead of vertical xlines horizontal xlines are set?

 

Thank you

 

Martin

Posted
Hello pBe

...Thank you very much for your help.

I have one more question: what should I change so that instead of vertical xlines horizontal xlines are set?..

 

 

Good for you

 

(getvar "UCSYDIR") -> (getvar "UCSXDIR")

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