Jump to content

Deviation arrow LISP


MaT02
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...