ekko Posted March 18, 2022 Posted March 18, 2022 Hello everyone, how can I find the intersection of (spt-ept p1-p3) and (spt-ept-p2-p4), I use (inters spt ept p1 p3 nil) and (inters spt ept p2 p4 nil), when p1 ,2,3,4 points in order, the intersection point can be obtained, if the order is out of order, it will return nil, which seems to need to sort p1,2,3,4, how can I do this? Is there any other way? Quote
ekko Posted March 18, 2022 Author Posted March 18, 2022 1 hour ago, mhupp said: Have a look at this. Glad you can answer, it's not the object, Lee Mac's is for the object, and mine is the point table, there seems to be a difference Quote
BIGAL Posted March 18, 2022 Posted March 18, 2022 If you make dummy objects like line p1-p3 then can get the (setq intpt1 (vlax-invoke obj2 'intersectWith obj1 acExtendThisEntity)) will return the intersection point, then just delete dummy objects. Xline is useful. Quote
ekko Posted March 19, 2022 Author Posted March 19, 2022 (edited) 7 hours ago, BIGAL said: If you make dummy objects like line p1-p3 then can get the (setq intpt1 (vlax-invoke obj2 'intersectWith obj1 acExtendThisEntity)) will return the intersection point, then just delete dummy objects. Xline is useful. I tried it and found that this is a troublesome method. Looking at the picture, it currently has 3 point tables, and each point table has 4 diagonal points. Create a virtual line first. This is your suggestion. But the 4 points of 1 item in each table, with my current technical level, need to create 4 virtual lines (because I can't judge the direction in the table), to get the intersection point, and then delete the virtual line. These workloads are just to get two intersection points. Assuming that the amount of data in the table is too large, obviously this method is not the best choice. I think (inters spe ept pt1 p2 nil) This method is the easiest, the premise is that you must first judge and find two points in the point table that are perpendicular to spt ept, this is my knowledge blind spot, please help, or suggest better Methods. thanks Edited March 19, 2022 by ekko Quote
mhupp Posted March 19, 2022 Posted March 19, 2022 (edited) 15 hours ago, ekko said: if the order is out of order, it will return nil It should still return a point unless mixing up the order create parallel lines. granted its not the point your looking for. How are these points being defined? That's where the sorting should take place. so then you can use inters to get the correct point. If its always a rectangle that is horizontal use bounding box (setq rec (vlax-ename->vla-object (car (entsel "\nPick Rectangle")))) (vla-getboundingbox rec 'minpt 'maxpt) (setq P1 (vlax-safearray->list minpt) ;lower left P4 (vlax-safearray->list maxpt) ;upper right p3 (list (car LL)(cadr UR)) p2 (list (car UR)(cadr LL)) ) Edited March 19, 2022 by mhupp 1 Quote
lrm Posted March 19, 2022 Posted March 19, 2022 @ekko The use of inters is not sensitive to the order of the first two points or final two points for defining the two lines. Be sure to turn off object snap after getting the 4 points! If the lines are always horizontal and vertical then you do not need inters. Then, Intersection point x = p3x or p4x Intersection point y = SPTy or EPTy 1 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.