TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: FELIX on January 28, 2016, 03:26:09 PM

Title: Distance or Length Point of Polyline
Post by: FELIX on January 28, 2016, 03:26:09 PM
How to get the distance or length of a point of intersection between two objects (polylines) from the origin of the first selected polilnha?
The polyline may contain segments in an arc.
The origin is the nearest end point used to select the selected object.

Code: [Select]
(DEFUN C:TESTE ()
(VL-LOAD-COM)
 
(SETQ ENTS1    (ENTSEL "\nSELECT POLYLINE 1: " ))
(SETQ ENTPS1   (CAR  ENTS1))
(SETQ PTS      (CADR ENTS1))
(SETQ LISTAPS  (ENTGET ENTPS1))
 
(SETQ ENTS2    (ENTSEL "\nSELECT POLYLINE 2: " ))
(SETQ ENTPS2   (CAR  ENTS2))
 
(SETQ LPTINT   (vlax-invoke (vlax-ename->vla-object ENTPS1) 'IntersectWith (vlax-ename->vla-object ENTPS2) acExtendNone))
 
(SETVAR "PDMODE"   35)
(SETVAR "PDSIZE"   -5)
 
(IF LPTINT
   (PROGN
   (SETQ II 0)
   (SETQ KK 0)
   (REPEAT (/ (LENGTH LPTINT) 3)
      (SETQ PX (NTH (+ KK 0) LPTINT))
      (SETQ PY (NTH (+ KK 1) LPTINT))
      (SETQ PTINT   (LIST PX PY))
      (SETQ II (+ II 1))
      (PRINT II)
      (PRINT PTINT)
      ;
      (SETQ DIST ????) ;<<<<<<<<<<<<<<<<<<<<<<
      (PRINT (RTOS DIST 2 3)) ;<<<<<<<<<<<<<<<
      ;
      (COMMAND "_POINT" PTINT)
      (SETQ KK (+ KK 3))
   )
   )
)
(PRINC)
)
(http://)
Title: Re: Distance or Length Point of Polyline
Post by: ronjonp on January 28, 2016, 03:54:31 PM
Look into vlax-curve-getDistAtPoint.
Title: Re: Distance or Length Point of Polyline
Post by: Lee Mac on January 28, 2016, 04:38:00 PM
Length Between Intersections (http://lee-mac.com/intersectionslength.html)
Title: Re: Distance or Length Point of Polyline
Post by: FELIX on January 28, 2016, 04:47:01 PM
Very good.
I need distance caused the end of the nearest polyline the selected point.
It may need to turn the polyline or calculate other distance.
Title: Re: Distance or Length Point of Polyline
Post by: FELIX on January 28, 2016, 05:48:30 PM
Another problem: the polylines are with quota "z" different!