Radu Iordache Posted March 10, 2023 Share Posted March 10, 2023 Hello, can someone help with a simple lisp to get the coordinates of the start point of a lwpolyline in the form Y,X (north,east) and store them in a variable? Thanks a lot! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 10, 2023 Share Posted March 10, 2023 You can use the vlax-curve-getstartpoint or the first DXF 10 if you entget the entity. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted March 10, 2023 Share Posted March 10, 2023 Following on from Tharwat suggestion. (setq ent (entsel "\nPick a pline ")) ; pick pline (setq entg (entget (car ent))) ; get entity values (setq pt (cdr (assoc 10 entg))) ; get 1st point or (setq obj (vlax-ename->vla-object (car (entsel "\nPick a pline ")))) ; pick pline (setq start (vlax-curve-getstartPoint obj)) ; get 1st point Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 11, 2023 Share Posted March 11, 2023 It is not necessarily / required to convert an entity to vla-object when using it with any of vlax-curve* functions. 1 Quote Link to comment Share on other sites More sharing options...
ronjonp Posted March 15, 2023 Share Posted March 15, 2023 On 3/11/2023 at 7:13 AM, Tharwat said: It is not necessarily / required to convert an entity to vla-object when using it with any of vlax-curve* functions. Converting to vla-object then using curve functions is also quite a bit slower. (setq e (car (entsel))) (setq o (vlax-ename->vla-object e)) (benchmark '((vlax-curve-getStartPoint e)(vlax-curve-getStartPoint o))) ;;;<Entity name: 1e9f2363150> ;;;#<VLA-OBJECT IAcadLWPolyline 000001e9df9c2dc8> Benchmarking ..................Elapsed milliseconds / relative speed for 32768 iteration(s): ;;; ;;; (vlax-curve-getStartPoint E).....1781 / 1.71 <fastest> ;;; (vlax-curve-getStartPoint O).....3047 / 1.00 <slowest> ;;; ;;;---- Benchmark Utility: In memory of Michael Puckett ---- ;;; ;;;; 3 forms loaded from #<editor "<Untitled-0> loading..."> 1 Quote Link to comment Share on other sites More sharing options...
Steven P Posted March 15, 2023 Share Posted March 15, 2023 Depends on the function of course, if you are processing a lot of lines then program speed can be an issue, only a few lines and the slowest thing is the user and their mouse. I'd go first off with what I know works, and then speed it up if necessary Quote Link to comment Share on other sites More sharing options...
mhupp Posted March 16, 2023 Share Posted March 16, 2023 (edited) 11 hours ago, ronjonp said: Converting to vla-object then using curve functions is also quite a bit slower. Even tho the documentation says vlax-curve-getstartPoint works with vla-objects you can feed it entity names as well. i think this works with all vlax-curve functions. -edit Tharwat-ed (setq SPT (vlax-curve-getstartPoint (car (entsel "\nPick a pline ")))) ; get 1st point (vl-cmdf "_.Circle" "_non" SPT "0.25") Edited March 16, 2023 by mhupp Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.