Author Topic: How to Make PI (Point of Intersection) on Pline Arc  (Read 7718 times)

0 Members and 1 Guest are viewing this topic.

rashidaziz

  • Mosquito
  • Posts: 11
How to Make PI (Point of Intersection) on Pline Arc
« on: July 30, 2015, 09:22:36 AM »
I need Lisp for Draw or Make PI (point of intersection) Points on Centerline (PLINE with Arcs and Spline).
Draw only on ARC (not on Spline)
Please HELP me.

Thanks so much.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #1 on: July 30, 2015, 09:32:19 AM »
Perhaps use the vector returned by vlax-curve-getfirstderiv at the end point of the surrounding splines in conjunction with the spline end points and the inters function (with the onseg argument set to nil), i.e.:
Code: [Select]
(inters
    <spline 1 end point>
    (mapcar '+ <spline 1 end point> (vlax-curve-getfirstderiv <spline 1> (vlax-curve-getparamatpoint <spline 1> <spline 1 end point>)))
    <spline 2 end point>
    (mapcar '+ <spline 2 end point> (vlax-curve-getfirstderiv <spline 2> (vlax-curve-getparamatpoint <spline 2> <spline 2 end point>)))
    nil
)

rashidaziz

  • Mosquito
  • Posts: 11
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #2 on: July 30, 2015, 09:58:54 AM »
Thanks Lee Mac

I am very new on AutoLISP. Please make LISP Program for me to Make PI Point on All Pline Arcs

Thanks and i appreciate for Helping and very quick reply.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #3 on: July 30, 2015, 01:43:22 PM »
The section indicated as 'spline' is in fact a series of very small straight segments belonging to the same polyline as the arc segment. The curve consists of a single polyline and not 3 or more elements.

Why not do it 'manually'?:
  • Create a copy of the polyline on a dedicated layer.
  • Change the linetype of the new polyline to continuous.
  • Explode it.
  • Change the colour of the arcs to make them stand out.
  • Use the FILLET command with R=0 on the facets bordering the arcs.
  • Use the TRIM command to trim the lengthened facets using the arcs as the cutting edges.
  • Erase all redundant facets.
  • Done!
BTW:
The texts in the dwg have a rotation of 0.355561 degrees.
I get worried when I see something like that...

tombu

  • Bull Frog
  • Posts: 288
  • ByLayer=>Not0
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #4 on: July 30, 2015, 02:01:22 PM »
Or
1. line endp osnap PC
2. int osnap each tangent for PI
3. endp osnap PT

When using fillet to add an arc I use [No trim] when those lines might come in handy later on.
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

ronjonp

  • Needs a day job
  • Posts: 7526
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #5 on: July 30, 2015, 02:37:17 PM »
Code - Auto/Visual Lisp: [Select]
  1. (defun c:welcometotheswamp (/ _angle _line e ep p sp tmp)
  2.   (defun _angle (ename pt / ang clpt e param)
  3.     (if (and (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getendparam (list ename))))
  4.              (setq clpt (vlax-curve-getclosestpointto ename pt))
  5.              (setq param (vlax-curve-getparamatpoint ename clpt))
  6.              (setq ang (angle '(0 0) (vlax-curve-getfirstderiv ename param)))
  7.         )
  8.       ang
  9.     )
  10.   )
  11.   (defun _line (p1 p2 layer)
  12.     (entmakex (list '(0 . "LINE")
  13.                     '(100 . "AcDbEntity")
  14.                     (cons 8 layer)
  15.                     (cons 10 p1)
  16.                     (cons 11 p2)
  17.               )
  18.     )
  19.   )
  20.   (if (and (setq e (car (entsel))) (setq tmp (vlax-invoke (vlax-ename->vla-object e) 'explode)))
  21.     (foreach o tmp
  22.       (if (= "AcDbArc" (vla-get-objectname o))
  23.         (progn (setq sp (vlax-curve-getstartpoint o))
  24.                (setq ep (vlax-curve-getendpoint o))
  25.                (setq p (inters sp (polar sp (_angle o sp) 1) ep (polar ep (_angle o ep) 1) nil))
  26.                (_line sp p "Intersection")
  27.                (_line ep p "Intersection")
  28.                (vla-delete o)
  29.         )
  30.         (vla-delete o)
  31.       )
  32.     )
  33.   )
  34.   (princ)
  35. )
« Last Edit: July 30, 2015, 03:25:33 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

tombu

  • Bull Frog
  • Posts: 288
  • ByLayer=>Not0
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

ronjonp

  • Needs a day job
  • Posts: 7526
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #7 on: July 30, 2015, 03:11:01 PM »

Nice!
Thanks!  :)


Although it may not be what the OP wanted  :|

« Last Edit: July 30, 2015, 03:27:22 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #8 on: July 30, 2015, 04:42:08 PM »
Or
1. line endp osnap PC
2. int osnap each tangent for PI
3. endp osnap PT

When using fillet to add an arc I use [No trim] when those lines might come in handy later on.
Can you explain this in more detail. What are PC, PI and PT?

ymg

  • Guest
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #9 on: July 30, 2015, 09:44:52 PM »
Roy,

In surveyor parlance, Tangent are straight line segment along an alignment.

PC stands for point of curvature, (beginning of Arc) although nowadays we use TC for Tangent to Curve.

PT is point of tangency that is end of the arc, nowadays CT for Curve to Tangent.

PI stand for point of intersection of two tangent.

Similarly you also have

TS  Tangent to Spiral
SC  Spiral to Curve
CS  Curve to Spiral
ST  Spiral to Tangent

ymg

« Last Edit: July 30, 2015, 10:02:03 PM by ymg »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #10 on: July 31, 2015, 03:32:27 AM »
Thanks you ymg.
But can the second step in tombu's procedure be accomplished without creating temporary tangent lines?

rashidaziz

  • Mosquito
  • Posts: 11
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #11 on: July 31, 2015, 04:00:58 AM »
Thanks so much all of you.

My problem solved with " ronjonp" post and special thanks to " ronjonp"

I really appreciate for solving my problem.

ronjonp

  • Needs a day job
  • Posts: 7526
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #12 on: July 31, 2015, 08:40:28 AM »
Thanks so much all of you.

My problem solved with " ronjonp" post and special thanks to " ronjonp"

I really appreciate for solving my problem.
Glad to help out :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ymg

  • Guest
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #13 on: July 31, 2015, 09:47:26 AM »
Here is another way:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:calcpi (/ bulge ptcp pct delta/2 ang chord radius tangent enpi pilst)
  2.    
  3.    (setq  en (car (entsel "Select Alignment: "))
  4.          lst (listpolb en)
  5.        pilst nil         
  6.    )     
  7.    (while (> (length lst) 1)
  8.       (if (not (zerop (setq bulge (cadar lst))))
  9.          (setq     ptc (caar lst)
  10.                    pct (caadr lst)
  11.                delta/2 (* (atan bulge) 2.0)
  12.                    ang (- (angle ptc pct) delta/2)     
  13.                  chord (distance ptc pct)
  14.                 radius (/ chord (* 2 (sin delta/2)))
  15.                tangent (* radius (tan delta/2))
  16.                  pilst (cons (polar ptc ang tangent) pilst)
  17.                   enpi (entmakex (list (cons 0 "POINT") (cons 10 (car pilst))))
  18.          )
  19.       )
  20.       (setq lst (cdr lst))
  21.    )
  22.    (print pilst)
  23.    (princ)
  24. )
  25.  
  26. ;; tan   From std-lib                                                         ;
  27. (defun tan (z / cosz)
  28.   (cond ((zerop (rem z pi)) 0.0)       
  29.         ((zerop (rem z (/ pi 2))) 1.7e308)
  30.         ((zerop (setq cosz (cos z))) 1.7e308)  
  31.         (t (/ (sin z) cosz))))
  32.  
  33.  
  34. ;;                                                                            ;
  35. ;; listpolb     by ymg    (Simplified a Routine by Gile Chanteau              ;
  36. ;;                                                                            ;
  37. ;; Parameter:  en,  Entity Name or Object Name of Any Type of Polyline        ;
  38. ;;                                                                            ;
  39. ;; Returns:   List of Points and Bulge in Current UCS                         ;
  40. ;;                                                                            ;
  41. ;; Notes:      On Closed Polyline the Last Vertex is Same as First)           ;
  42. ;;                                                                            ;
  43.  
  44. (defun listpolb (en / i p l)  
  45.    (repeat (setq i (fix (1+ (vlax-curve-getEndParam en))))           
  46.       (setq l (cons (list (trans (vlax-curve-getPointAtParam en (setq i (1- i))) 0 1)
  47.                              (vla-getbulge (vlax-ename->vla-object en) i)
  48.                     )
  49.                     l
  50.               )    
  51.       )
  52.    )
  53. )
  54.  
« Last Edit: July 31, 2015, 02:13:45 PM by ymg »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to Make PI (Point of Intersection) on Pline Arc
« Reply #14 on: August 01, 2015, 05:20:17 AM »
@ ymg:
Nice to see some 'old school' trigonometry.
Three things to have another look at:
The (listpolb) function cannot handle closed polylines and does not translate from WCS to OCS.
The PI points should be translated from OCS to WCS.
Perhaps exclude bulge=1/-1.