Strydaris Posted yesterday at 02:58 PM Posted yesterday at 02:58 PM Is there a way to extend a horizonal line or lines to the nearest vertical line? Basically here is my scenario in the image below. You start the lisp, click at the Green point 1 then click at the green point 2. The lisp then adds 2" to the length at pt2 then drops 4" then returns the length. This part I can code using polar and the angles / lengths to draw the pline. The part I dont know is how can I extend the pline at pt1 (in green) and the end of the pline to the closest vertical red line so it looks like the image below? The distance between pt1 (in green) and the vertical red line is an unknown variable distance. Any thoughts to help me out would be great, thanks, Quote
BlackBox Posted yesterday at 03:54 PM Posted yesterday at 03:54 PM Look into the IntersectWith method: https://help.autodesk.com/view/CIV3D/2026/ENU/?guid=GUID-1243A593-5DAE-4DC3-B539-59FDA990E687 Quote
Strydaris Posted yesterday at 04:20 PM Author Posted yesterday at 04:20 PM @BlackBox Thanks for the suggestion. To my understanding though, the IntersectWith method requires the user to select the line (in my case the red vertical line) to extend to. I would prefer this to be seamless and extend after all pick points are complete to the first available line without having to select it. Sort of like hitting enter twice after entering the extend command. Quote
BlackBox Posted yesterday at 04:54 PM Posted yesterday at 04:54 PM (edited) 33 minutes ago, Strydaris said: @BlackBox Thanks for the suggestion. To my understanding though, the IntersectWith method requires the user to select the line (in my case the red vertical line) to extend to. I would prefer this to be seamless and extend after all pick points are complete to the first available line without having to select it. Sort of like hitting enter twice after entering the extend command. To extend an existing line, you must obtain it's ename/vla-object... which means it must be selected. That said, consider (ssget "+.:E:S") or (ssget "_:E"), which will allow you to specify a point to select the line. Edited yesterday at 04:54 PM by BlackBox Quote
Strydaris Posted 23 hours ago Author Posted 23 hours ago Hi @BlackBox I am not looking to extend an existing line. I want to extend TO an existing line. Quote
BlackBox Posted 23 hours ago Posted 23 hours ago (edited) 20 hours ago, Strydaris said: The part I dont know is how can I extend the pline at pt1 (in green) and the end of the pline to the closest vertical red line so it looks like the image below? The distance between pt1 (in green) and the vertical red line is an unknown variable distance. 15 hours ago, Strydaris said: Hi @BlackBox I am not looking to extend an existing line. I want to extend TO an existing line. You cannot extend a line that doesn't exist - you can only create a new line and extend that, if needed. You've not posted any code, so hard to see where you're stuck. If P2 is on an existing vertical line, you can create a new line from P1 to P2 + 2" using polar and continue your routine. If P2 is on an existing vertical line, but not ortho-aligned with P1's Y, then after you prompt for P1, select the existing line using the above-mentioned ssget filters, calculate the point of intersection (P3) ** to create a line from P1 to P3 + 2" using polar and continue your routine. ** [Edit] - or just extract the P2 X and use the P1 Y to calculate P3 HTH Edited 7 hours ago by BlackBox Quote
BIGAL Posted 19 hours ago Posted 19 hours ago If I understand correct, like @BlackBoxas suggested, you can pick a line/pline near an end, this in turn can be used to determine a direction to extend in, ok it is not that straight forward, you would use say a dummy line and get objects that cross that say horizontal line, look for say closest using intersectwith, ask is this OK, then if you want a left and right repeat for other side. And draw your Red rectang. You would just limit the length of the dummy line so you don't get to many other objects. Ok for a line as it looks like you want a left and right easy draw a new line extending out from start and end points of the line picked. Then use (SSGET "F" pts... to get the other line/plines. You may get more than one but you can do a sort on the distance from a say end to the new points and use correct one. For a pline its a bit harder but you use get pline segment then again extend dummy line out from the two segment points. Again sort points. Yes it can be done, really need a real dwg to give more hints and maybe some code. MM or feet is important. Quote
Recommended Posts
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.