Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
108 Posts
3 Kudos
Registered: ‎10-02-2007
Post 1 of 5
Accepted Solution

pline start and end angles

168 Views, 4 Replies
12-03-2012 08:17 AM

is there a function to obtain the start angle and end angle of a pline,i know arcs do

thanks


markruys wrote:

is there a function to obtain the start angle and end angle of a pline....


If 'ent' is the entity name of the Polyline, and you have (vl-load-com) loaded:

 

(angle '(0 0 0) (vlax-curve-getFirstDeriv ent (vlax-curve-getStartParam ent)))

(angle '(0 0 0) (vlax-curve-getFirstDeriv ent (vlax-curve-getEndParam ent)))

 

Returned values will be in radians.

*Expert Elite*
6,025 Posts
669 Kudos
Registered: ‎09-13-2004
Post 2 of 5

Re: pline start and end angles

12-03-2012 08:50 AM in reply to: markruys

markruys wrote:

is there a function to obtain the start angle and end angle of a pline....


If 'ent' is the entity name of the Polyline, and you have (vl-load-com) loaded:

 

(angle '(0 0 0) (vlax-curve-getFirstDeriv ent (vlax-curve-getStartParam ent)))

(angle '(0 0 0) (vlax-curve-getFirstDeriv ent (vlax-curve-getEndParam ent)))

 

Returned values will be in radians.

Kent Cooper
*Expert Elite*
1,660 Posts
190 Kudos
Registered: ‎08-16-2007
Post 3 of 5

Re: pline start and end angles

12-03-2012 08:55 AM in reply to: Kent1Cooper

Kent,

 

Are you sure about the ename?  I believe it is the vla-object:

 

;;for end angle (in radians)

(setq obj (vlax-ename->vla-object(car(entsel))))
(angle '(0 0 0) (vlax-curve-getFirstDeriv obj (vlax-curve-getEndParam obj)))

*Expert Elite*
6,025 Posts
669 Kudos
Registered: ‎09-13-2004
Post 4 of 5

Re: pline start and end angles

12-03-2012 09:25 AM in reply to: dbroad

dbroad wrote:

... 

Are you sure about the ename?  I believe it is the vla-object:

....


Doug:

 

This question comes up now and then.  The (vlax-curve-...) functions at least, though certainly not all (vla...) functions, work with entity names just as well as with VLA objects.  It spares the need to make the conversion, unless that is also needed to do other things with the same entity, that do require it.  I have loads of routines that do these kinds of things using entity names, and they all work fine.

Kent Cooper
*Expert Elite*
1,660 Posts
190 Kudos
Registered: ‎08-16-2007
Post 5 of 5

Re: pline start and end angles

12-03-2012 09:32 AM in reply to: Kent1Cooper

Thanks.  

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!