Jump to content

retrieve vertices list out of a polyline (without vlisp)


samifox

Recommended Posts

  • Replies 38
  • Created
  • Last Reply

Top Posters In This Topic

  • samifox

    12

  • Tharwat

    8

  • martinle

    7

  • pBe

    5

Top Posters In This Topic

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 3 years later...

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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")

Link to comment
Share on other sites

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