View Full Version : "Inters" of two construction lines
daniel_gh
2005-10-19, 05:43 PM
Help !
I need to get and use in lisp the intersection point of two construction lines which I did before in the lisp program.
One line is at a known angle to a known point, second line is a vertical to a known point.
Thanks in advance for any good tip.
Have you tried the inters function in autolisp?
daniel_gh
2005-10-19, 07:02 PM
Apparently not working. Documentation said that you need the coords of 4 points ( 2 for each line ).
I have tried to use it indicating the construction lines as entities but is not working
Apparently not working. Documentation said that you need the coords of 4 points ( 2 for each line ).
I have tried to use it indicating the construction lines as entities but is not working
Did you get the two points from each line?
(inters Line1-Start Line1-End Line2-Start Line2-End)
or if the lines referenced between the points do not physically intersect
(inters Line1-Start Line1-End Line2-Start Line2-End nil)
daniel_gh
2005-10-19, 07:39 PM
Richard,
I have two construction lines - I don't have start/end point...?.... or I don't understand your answer ....
Richard,
I have two construction lines - I don't have start/end point...?.... or I don't understand your answer ....
To use the inters function you will need to extract two points from each line. The entity data for construction lines contains two group codes commonly known for points on lines.
Use the help files to see which group codes would give you points for construction lines.
You appear to want to learn this, so I will help you work through this.
daniel_gh
2005-10-19, 08:12 PM
Thank you for your help.
Let me check the help files and i'll be back.
daniel_gh
2005-10-20, 07:30 AM
To use the inters function you will need to extract two points from each line. The entity data for construction lines contains two group codes commonly known for points on lines.
Use the help files to see which group codes would give you points for construction lines.
You appear to want to learn this, so I will help you work through this.
I tried to use (entget ).
Here is what I received :
((-1 . <Entity name: 7ef60d98>) (0 . "XLINE") (330 . <Entity name: 7ef60d18>)
(5 . "33") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "Offset") (100 .
"AcDbXline") (10 325.0 100.0 0.0) (11 0.997564 -0.0697565 0.0))
Where are the two points I need ? I built the construction line (xline) at an angle of "-4º" via point (325,100). Next step ?
kennet.sjoberg
2005-10-20, 08:16 AM
I tried to use (entget ).
Here is what I received :
((-1 . <Entity name: 7ef60d98>) (0 . "XLINE") (330 . <Entity name: 7ef60d18>)
(5 . "33") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "Offset") (100 .
"AcDbXline") (10 325.0 100.0 0.0) (11 0.997564 -0.0697565 0.0))
Where are the two points I need ? I built the construction line (xline) as a vertical via point (550,0) . Next step ?
assoc 10 is the Xlines InsertionPoint
assoc 11 is the direction vector
extrude the direction angle from Pkt00 = 0,0 and Pktd = assoc 11
extrude the InsertionPoint from assoc 10 = Pkt1
ang the DirectionAngle is (angle Pkt00 Pktd ) then you can fake a point on the Xline
Pkt1 = insertion point
Pkt2 = (polar InsertionPoint angle distance )
Pkt2 = (polar Pkt1 (angle Pkt00 Pktd ) 1 )
Do it once more for the second Xline, and then
(inters Pkt1 Pkt2 Pkt3 Pkt4 nil )
like this :
(setq Ent1 (entsel "Xline1" ) )
(setq Ent2 (entsel "Xline2" ) )
(setq EntDxf1 (entget (car Ent1 )) )
(setq EntDxf2 (entget (car Ent2 )) )
(setq Pkt2 (polar (cdr (assoc 10 EntDxf1 )) (angle (list 0 0 0 ) (cdr (assoc 11 EntDxf1 )) ) 1 ) )
(setq Pkt4 (polar (cdr (assoc 10 EntDxf2 )) (angle (list 0 0 0 ) (cdr (assoc 11 EntDxf2 )) ) 1 ) )
(setq Xpoint (inters (cdr (assoc 10 EntDxf1 )) Pkt2 (cdr (assoc 10 EntDxf2 )) Pkt4 nil ) )
: ) Happy Computing !
kennet
daniel_gh
2005-10-20, 08:34 AM
Thank you Kennet,
I involve the two xlines before ....the xline I showed you was not a vertical.
Anyway, I think now is clear and I can go further.
Thanks again for your help
kennet.sjoberg
2005-10-20, 10:00 AM
Thank you Kennet,
I involve the two xlines before ....the xline I showed you was not a vertical.
Anyway, I think now is clear and I can go further.
Thanks again for your help
Well, save your created xline names "<Entity name: xxxxxxx>)" in Ent1 and Ent2
the code works for any xline direction.
: ) Happy Computing !
kennet
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.