Jump to content
MaT02

Deviation arrow LISP

Recommended Posts

MaT02

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.

Thank you in advance for all your help

Regards

Deviation arrow.jpg

Share this post


Link to post
Share on other sites
BIGAL

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.

Share this post


Link to post
Share on other sites
MaT02

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.:)

Arrow2.lsp

Deviation example.jpg

Share this post


Link to post
Share on other sites
hanhphuc
Posted (edited)

another

[color="green"]
;with minimum size [/color]
(defun _arrow ( pt p1 [color="red"]h[/color] / d sz)
 (setq sz (distance pt p1))
 (vla-put-ArrowheadSize
   (vlax-ename->vla-object
     (entmakex (list '(0 . "LEADER")
                     '(100 . "AcDbEntity")
                     '(100 . "AcDbLeader")
                     '(73 . 3)
                     '(8 . "ARROW")
                     (cons 10 p1)
                     (cons 10 (polar p1 (angle p1 pt) (setq sz (cond ((< sz h ) h) (sz)))))
                     )
               )
     )
   (/ sz  3.0 )
   )
 )
(vl-load-com)

 

 

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

(_arrow p1 p2 [b][color="red"]3.0[/color][/b]) [color="green"]; minimum size = 3.0 [/color]
)
(princ)
)

Edited by hanhphuc
minimum size

Share this post


Link to post
Share on other sites
BIGAL
Posted (edited)

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.

 


(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)))
(vla-put-arrowhead1block obj "none")
)
(progn
(setq pt2 (polar pt1 ang 65))
(command  "dimaligned" pt2 pt1  pt1)
(setq obj (vlax-ename->vla-object (entlast)))
(vla-put-arrowhead1block obj "none")
(vla-put-TextOverride obj (rtos diff 2 2 ))
)
)
(princ)
)

(c:test)

Edited by BIGAL

Share this post


Link to post
Share on other sites
hanhphuc
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 :ouch:

 

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

 

a bit similar old thread

Share this post


Link to post
Share on other sites
BIGAL

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).

Share this post


Link to post
Share on other sites
BIGAL

Hey it was tomorrow ! updated code for small distances.

Share this post


Link to post
Share on other sites
hanhphuc
Hey it was tomorrow ! updated code for small distances.

it was yesterday :P

does OP know your update?

Share this post


Link to post
Share on other sites
BIGAL

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×