### Author Topic: Distance or Length Point of Polyline  (Read 964 times)

0 Members and 1 Guest are viewing this topic.

#### FELIX

• Bull Frog
• Posts: 215
##### Distance or Length Point of Polyline
« 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))`
OK.

#### ronjonp

• Needs a day job
• Posts: 7327
##### Re: Distance or Length Point of Polyline
« Reply #1 on: January 28, 2016, 03:54:31 PM »
Look into vlax-curve-getDistAtPoint.

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

#### Lee Mac

• Seagull
• Posts: 12514
• London, England
##### Re: Distance or Length Point of Polyline
« Reply #2 on: January 28, 2016, 04:38:00 PM »

#### FELIX

• Bull Frog
• Posts: 215
##### Re: Distance or Length Point of Polyline
« Reply #3 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.
OK.

#### FELIX

• Bull Frog
• Posts: 215
##### Re: Distance or Length Point of Polyline
« Reply #4 on: January 28, 2016, 05:48:30 PM »
Another problem: the polylines are with quota "z" different!
OK.