LISP from ofset line from point

LISP from ofset line from point

miroslav.pristov
Advocate Advocate
572 Views
3 Replies
Message 1 of 4

LISP from ofset line from point

miroslav.pristov
Advocate
Advocate

Hello all can someone help me with this to ofset new line from point

 

I need to create a LISP that will make me the yellow line like on picture bellow and i dont have a clue how to to that.

 

so my input data will be to pick point on drawing (point T1) , pick line on which is point (line A - blue one), side where i want new yelow line (in this case above the pick point T1), distance of new line from point T1 (dimension L) , and to pick 2 lines C and B (red ones) which will define the lenght of new yellow line. 

 

After all is choose the result will be yellow line like on picture, which is angled at 90 degrees to the blue line, and away from T1 for distance L, and with lenght from lines B to C.

 

Thank for help i really grateful

 

picture help.png

 

 

 

0 Likes
573 Views
3 Replies
Replies (3)
Message 2 of 4

hmsilva
Mentor
Mentor

Hello Miroslav,
you have said:

 

'I need to create a LISP that will make me the yellow line like on picture bellow and i dont have a clue how to do that.'

 

Well, you have asked various codes in this last days, here at the forums, and if you're trying to learn how to code, from the previous codes given to you, were used most of the functions you need to write this code.
You'll have to to study each function from the previous codes...

 

A starting point for this code:

To get the needed data from the user to write the code:

(if (and (setq pt (getpoint "\nPick point on the line: "))
         (setq sel (entsel "\nPick line on which is point, and in the side where you want the new yelow line: "))
         (progn (initget 5) (setq len (getdist "\Enter distance of new line: ")))
         (setq line1 (car (entsel "\nSelect first reference line: ")))
         (setq line2 (car (entsel "\nSelect second reference line: ")))
    )

In the variable 'pt' you'll have the point, in 'sel' a list, first element the line ename and the second a point, from the 'progn' we use initget 5 to force the user to enter a positive value and not just pressing enter to exit, will return from 'getdist' in the variable len a distance, in 'line1' the reference line ename, and in 'line2' the second reference line ename....

 

 

To ensure a point on the blue line, try to use the 'vlax-curve-getClosestPointTo' function in 'pt' and in the second element from 'sel'

Use the 'polar' function to get the point in the blue line with the distance from 'len' and the angle from the points returned from 'vlax-curve-getClosestPointTo' function.

To get a new point withe the correct angle from the new line, use the polar function and the angle from the previous one + (/ pi 2.) and a distance 1.0(just to define a vector)

To get the intersection point from the previous vector with the reference lines in 'line1' and 'line2', use the previous two points and the 'inters' function with the start and end points from 'line1' and again with start and end points from line2 ( cdr assoc 10 and 11 from the returned from 'entget' function from 'line1' and 'line2' enames....

To make the new line, use the 'entmake' function with the previous two points returned from 'inters' functions...

 

Try to write the code, and if you have some difficulties, post back the code you have already written and we'll try to help you...

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 3 of 4

miroslav.pristov
Advocate
Advocate

well thanks for your help and suggestions, but i dont really know how to make codes, i m still learning, and i know only the basics... I m trying to learn from the codes i read and sugestions you all gave me. 

 

but this one is still hard for me, i m the begginer. I assumed the working principle what you sugggested, but still dont know how to make that code works. 

 

Thank you for your help i ll try something to manage when i have time. Now i dont have. never mind i m needed this code fast for help in some works i m doing just now. 

 

0 Likes
Message 4 of 4

hmsilva
Mentor
Mentor

@miroslav.pristov wrote:

...

Thank you for your help i ll try something to manage when i have time. Now i dont have

....


You're welcome, miroslav.pristov!
When you have some time to try to write it, I'll be happy to try to help you.

Henrique

EESignature

0 Likes