1. ## Deviation arrow LISP

Registered forum members do not see this ad.

Hello,
I'm new to the forum,
I would like to ask you for help. I need a program / application (LISP) which will insert a deviation dart and a distance from a point to a straight line. More specifically, I would like to mark the point from the measurement and the designed line to indicate its deviation from the project. I tried to write something myself but it is too complicated for me.
The arrow should show the direction in which the execution deviates from the design and it is best if its length can be determined separately depending on the drawing.
In the picture I show what I mean.
Regards

2. 94 People have looked at this and like me do not quite understand what you want. Comparing design point to as built is common but your image gives no clues.

3. ## Explanation

I am sorry, maybe I did not precisely express my thought. I have a geodetic survey point and I would like to show its deviation from the projected line. that's why I'd like to use the arrow.
I have a program which, after selecting a measurement point and a point on a straight line inserts an arrow, the problem is when the point is close to a straight line then the arrow is very small, I would like the program to insert a fixed length arrow (defined earlier, for example 0.2 unit) and additionally give the distance from the point to straight line (mm) in the form of text in the drawing.

4. another
Code:
```
;with minimum size
(defun _arrow ( pt p1 h / d sz)
(setq sz (distance pt p1))
(vlax-ename->vla-object
'(100 . "AcDbEntity")
'(73 . 3)
'(8 . "ARROW")
(cons 10 p1)
(cons 10 (polar p1 (angle p1 pt) (setq sz (cond ((< sz h ) h) (sz)))))
)
)
)
(/ sz  3.0 )
)
)

Code:
```(defun c:test ( / p1 p2 )
(and
(setq p1 (getpoint "\nSpecify point 1: "))
(setq p2 (getpoint p1 "\nSpecify point 2: "))

(_arrow p1 p2 3.0) ; minimum size = 3.0
)
(princ)
)```

5. It may be usefull to use closestpointto battery just ran out, later. Charged up, when I started I knew it needs two answers a big and small so draws arrow inside or labels as a outside arrow for very small.

Code:
```(vl-load-com)
; code by BIGAL
(defun c:test ( / pt1 pt2  diff x1 x2 y1 y2 xdiff ydiff obj)
(setq obj (vlax-ename->vla-object (car (entsel "\nPick line pline or arc etc"))))
(setq pt1 (getpoint "pick point"))
(setq pt2 (vlax-curve-getclosestpointto obj pt1))
(setq  ang (angle pt1 pt2))
(setq diff (distance pt1 pt2))
(setq x1 (car pt1) y1 (cadr pt1))
(setq x2 (car pt2) y2 (cadr pt2))
(setq xdiff (- x1 x2))
(setq ydiff (- y1 y2))

(alert (strcat "Length is " (rtos diff 2 2) "\nX difference is " (rtos xdiff 2 2) "\nY difference is " (rtos ydiff 2 2)))
(if ( > diff 50)
(progn
(command  "dimaligned" pt2 pt1  pt1)
(setq obj (vlax-ename->vla-object (entlast)))
)
(progn
(setq pt2 (polar pt1 ang 65))
(command  "dimaligned" pt2 pt1  pt1)
(setq obj (vlax-ename->vla-object (entlast)))
(vla-put-TextOverride obj (rtos diff 2 2 ))
)
)
(princ)
)

(c:test)```

6. Originally Posted by BIGAL
when I started I knew it needs two answers a big and small so draws arrow inside or labels as a outside arrow for very small.
initially i was thinking same dimalign suppress one arrow but the problem if arrow size bigger than the deviations. IMO maybe OP needs picking 2 points

vlax-curve-xxx is nice idea, but not sure OP considers in distance in 2D or 3D ?

7. hanhphuc your right as I mentioned there are two situations one being a very small distance then arrow needs to be an outside like a radial answer. I just picked the easy one, version 2 would have 2 options. I will do tomorrow you know ask tomorrow when "tomorrow" .

8. Hey it was tomorrow ! updated code for small distances.

9. Originally Posted by BIGAL
Hey it was tomorrow ! updated code for small distances.
it was yesterday

10. Registered forum members do not see this ad.

Hey mat02 it’s your turn to play now ! Hanhphuc and I have had our turn.