Author Topic: Pline endpoint/angle question  (Read 7632 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Pline endpoint/angle question
« Reply #15 on: December 05, 2006, 03:32:38 PM »
To get the angle of the polyline at each end perhaps this will do it.
This handles arc segments & can be used with splines.

Code: [Select]
  (vl-load-com)
  (setq curve (car (entsel "\nSelect polyline: ")))
  (setq end_param (vlax-curve-getendparam curve))
  (setq startang (angle '(0 0) (vlax-curve-getFirstDeriv curve 0.05)))
  (setq endang (angle '(0 0) (vlax-curve-getFirstDeriv curve (- end_param 0.05))))
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Guest

  • Guest
Re: Pline endpoint/angle question
« Reply #16 on: December 05, 2006, 04:12:12 PM »
Quote
Where reads the calls for insertblock, just replace the 1.0's with the return of LTSCALE and rock and roll:

You're making this WAAAAAY too easy for me.   And I thank you for that!

Who's #1?? YOU are!


LE

  • Guest
Re: Pline endpoint/angle question
« Reply #17 on: December 05, 2006, 05:18:37 PM »
!

 :oops:

Thanks.

I am playing (writing right now as part of my learning phase) with the routine, now with C#, as soon as I know how to use the insert method, I will post it, and see if runs faster....

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Pline endpoint/angle question
« Reply #18 on: December 05, 2006, 05:38:04 PM »
I am playing (writing right now as part of my learning phase) with the routine, now with C#, as soon as I know how to use the insert method, I will post it, and see if runs faster....
I think I remembering reading on one site that you have to create all the atrributes associated with the blocks definition when using C#.  FYI....
« Last Edit: December 05, 2006, 05:39:58 PM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: Pline endpoint/angle question
« Reply #19 on: December 05, 2006, 07:05:00 PM »
Thank you Tim;

Yes I am aware about that, have read a LOT... anyway this does not have attributes and I have open a new topic here:

http://www.theswamp.org/index.php?topic=13836.msg166838#msg166838

Just for fun.

sinc

  • Guest
Re: Pline endpoint/angle question
« Reply #20 on: December 06, 2006, 11:15:36 AM »
To get the angle of the polyline at each end perhaps this will do it.
This handles arc segments & can be used with splines.

Code: [Select]
  (vl-load-com)
  (setq curve (car (entsel "\nSelect polyline: ")))
  (setq end_param (vlax-curve-getendparam curve))
  (setq startang (angle '(0 0) (vlax-curve-getFirstDeriv curve 0.05)))
  (setq endang (angle '(0 0) (vlax-curve-getFirstDeriv curve (- end_param 0.05))))

The only thing that I might do differently is use the distance commands to get the end angle.  For example, you could get the parameter for the point that is 0.001 from the end of the line, then get the First Derivative of that.

The problem with subtracting parameters is that the size varies in polylines, depending on the length of the segment.  So it's possible that your .05 parameter might be 1, 10, or 20 feet from the end of the line.
« Last Edit: December 06, 2006, 11:16:50 AM by sinc »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Pline endpoint/angle question
« Reply #21 on: December 06, 2006, 12:07:45 PM »
I was perplexed as to how best to approach that aspect. I got the vlax-curve-getFirstDeriv idea from one of your
previous posts. The problem with distance is that the opposite may be true. There could be very little distance between
the two parameters. I suppose you would have to do some sort of distance checking to be sure of what you were dealing
with before settling on a value to use for the distance.

I was just being lazy with my 0.05 parameter & hoping it would be OK. :)
I did consider a check of the value but was holding off to see if anyone would actually use it.


Glad to see someone was paying attention.  8-)
« Last Edit: December 06, 2006, 12:08:48 PM by CAB »
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Guest

  • Guest
Re: Pline endpoint/angle question
« Reply #22 on: December 06, 2006, 01:31:11 PM »
Okay... I've got one other question...  How do you obtain the layer name of the pline??  Right now I'm using this:

Code: [Select]
(setq objLay (cdr (assoc 8 (entget curve))))
But what's the vlisp way?

Thanks again!

LE

  • Guest
Re: Pline endpoint/angle question
« Reply #23 on: December 06, 2006, 01:50:07 PM »
Glad to see someone was paying attention.  8-)

Alan;

I ALWAYS put attention, and will try to provide a solution, every time I can.

I will do your recommendation into the new C# routine approach I posted in the NET forum, once I get a chance.

Cheers.

LE

  • Guest
Re: Pline endpoint/angle question
« Reply #24 on: December 06, 2006, 01:51:47 PM »
Code: [Select]
(setq objLay (cdr (assoc 8 (entget curve))))
But what's the vlisp way?


Matt;

Look into VLA-GET-LAYER and VLA-PUT-LAYER functions.

Guest

  • Guest
Re: Pline endpoint/angle question
« Reply #25 on: December 06, 2006, 02:05:19 PM »
Quote
Matt;

Look into VLA-GET-LAYER and VLA-PUT-LAYER functions.

WHAT??!?!?!  You expect ME to do some work now??!?  Sheesh... the nerve of some people.  ;)


I'll look into that and thanks again.  (and if you post back with the solution, I'm NOT gonna read it).

LE

  • Guest
Re: Pline endpoint/angle question
« Reply #26 on: December 06, 2006, 02:08:25 PM »
(and if you post back with the solution, I'm NOT gonna read it).

OK.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Pline endpoint/angle question
« Reply #27 on: December 06, 2006, 02:23:53 PM »
Glad to see someone was paying attention.  8-)

Alan;

I ALWAYS put attention, and will try to provide a solution, every time I can.

I will do your recommendation into the new C# routine approach I posted in the NET forum, once I get a chance.

Cheers.
I know it would be hard to sneak anything past you Luis. :-)
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Guest

  • Guest
Re: Pline endpoint/angle question
« Reply #28 on: December 06, 2006, 02:24:05 PM »
[Quagmire - Family Guy]Heh heh.... Alright![/Quagmire]

(setq objLay (vla-get-layer (vlax-ename->vla-object curve)))

SWEEEET!!!

LE

  • Guest
Re: Pline endpoint/angle question
« Reply #29 on: December 06, 2006, 06:29:07 PM »
I know it would be hard to sneak anything past you Luis. :-)

I have attached the command ADDTICKS (just for A2007), if anyone would like to try it - for lwpolylines and splines.

HTH

http://www.theswamp.org/index.php?topic=13836.msg167054#msg167054