Qonfire Posted May 22, 2012 Posted May 22, 2012 Hello CadTutorers:) My question of the day is described in pic attached. Things like, functions to use for such problem or links where this subject was covered will be appreciated Quote
Qonfire Posted May 22, 2012 Author Posted May 22, 2012 This helps. (defun get_all_inters_in_SS (SS / SSL ;length of SS PTS ;returning list aObj1 ;Object 1 aObj2 ;Object 2 N1 ;Loop counter N2 ;Loop counter iPts ;intersects ) (setq N1 0 ;index for outer loop SSL (sslength SS)) ; Outer loop, first through second to last (while (< N1 (1- SSL)) ; Get object 1, convert to VLA object type (setq aObj1 (ssname SS N1) aObj1 (vlax-ename->vla-object aObj1) N2 (1+ N1)) ;index for inner loop ; Inner loop, go through remaining objects (while (< N2 SSL) ; Get object 2, convert to VLA object (setq aObj2 (ssname SS N2) aObj2 (vlax-ename->vla-object aObj2) ; Find intersections of Objects iPts (vla-intersectwith aObj1 aObj2 0) ; variant result iPts (vlax-variant-value iPts)) ; Variant array has values? (if (> (vlax-safearray-get-u-bound iPts 1) 0) (progn ;array holds values, convert it (setq iPts ;to a list. (vlax-safearray->list iPts)) ;Loop through list constructing points (while (> (length iPts) 0) (setq Pts (cons (list (car iPts) (cadr iPts) (caddr iPts)) Pts) iPts (cdddr iPts))))) (setq N2 (1+ N2))) ;inner loop end (setq N1 (1+ N1))) ;outer loop end Pts) ;return list of points found Quote
Tharwat Posted May 22, 2012 Posted May 22, 2012 I think the following function will be of a help , read Help Documentation for more explanations vla-intersectwith Quote
Tharwat Posted May 22, 2012 Posted May 22, 2012 I guess this is enough as an example (defun c:Test (/ l b) (vl-load-com) (if (and (setq l (car (entsel "\n Select line :"))) (setq b (car (entsel "\n Select Block :"))) ) (if (vlax-invoke (vlax-ename->vla-object l) 'Intersectwith (vlax-ename->vla-object b) AcExtendNone ) (alert "Yes, The two objects are Intersected with each others") (alert "No, There are not Intersected at all ") ) ) (princ) ) Quote
Qonfire Posted May 22, 2012 Author Posted May 22, 2012 - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said Do you evaluate your aim while reaching it? (i mean continuing to analyze the importance of aim, effort to reward ratio? My opinion, is that you described a fanatical way of thinking. I did't say its bad. Sorry for getting of the topic, Quote
Tharwat Posted May 22, 2012 Posted May 22, 2012 - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said Do you evaluate your aim while reaching it? A very good question , Actually , I haven't got satisfied yet , so that makes me looking for more all the time . Quote
Qonfire Posted May 22, 2012 Author Posted May 22, 2012 Who knows the true and right aim, that people should try to reach(except GOD)? Me, i'm just gonna hope that I got the aim right. Quote
Tharwat Posted May 22, 2012 Posted May 22, 2012 Who knows the true and right aim, that people should try to reach(except GOD)? Me, i'm just gonna hope that I got the aim right. So , did you get the aim of the code right now or not yet ? Quote
Qonfire Posted May 22, 2012 Author Posted May 22, 2012 I didn't see it, you reply too fast:), no i didn't get it yet,but i like that simplified structure Quote
David Bethel Posted May 22, 2012 Posted May 22, 2012 A basic test could be: (equal (distance center_of_circle end_point_of_line ) radius_of_circle fuzz) -David Quote
Qonfire Posted May 22, 2012 Author Posted May 22, 2012 thank you for reply,i will check what is that line about. Quote
Qonfire Posted May 22, 2012 Author Posted May 22, 2012 (while (< N1 (1- SSL)) ; Get object 1, convert to VLA object type (setq aObj1 (ssname SS N1) aObj1 (vlax-ename->vla-object aObj1) N2 (1+ N1)) ;index for inner loop ; Inner loop, go through remaining objects (while (< N2 SSL) ; Get object 2, convert to VLA object (setq aObj2 (ssname SS N2) aObj2 (vlax-ename->vla-object aObj2) ; Find intersections of Objects iPts (vla-intersectwith aObj1 aObj2 0) We get first item inn selection set objet1 and than we are coparing to a NEXT objet2 in selection set.My question is, what if intersection occurs between objet1 and objet 4. Quote
Qonfire Posted May 23, 2012 Author Posted May 23, 2012 (defun c:Test (/ l b) (vl-load-com) (if (and (setq l (car (entsel "\n Select line :"))) (setq b (car (entsel "\n Select Block :"))) ) (if (vlax-invoke (vlax-ename->vla-object l) 'Intersectwith (vlax-ename->vla-object b) AcExtendNone ) (alert "Yes, The two objects are Intersected with each others") (alert "No, There are not Intersected at all ") ) ) (princ) ) You wrote a lisp on my question.its like coming to university first and obtaining phd on a same day.thanks. Quote
pBe Posted May 23, 2012 Posted May 23, 2012 Qonffire, Pardon my question but, you can see if the line intersects the blocks or not . and by the title of your thread If a line coordinate touches a circle entity of a block- say yes You mean either the startpoint or the endpoint but not in betweeen them? [from your attached image] does it mean that if its not endpoint/starpoint of line then the test result is nil? or you really menat to say Block intersects at any coordinate of the line? will there be another set of functions to follow if the test is T? i would guess there would be, right? so whats the main function of your routine? Quote
Qonfire Posted May 23, 2012 Author Posted May 23, 2012 outer loop...inner loop..duahhh, this was posted before i saw your last response,i should read the comments ,i was concentrated on data in watch. Its just my technical vocabulary is limited. I wanted to see how to find the "coordinates" of intersecting points. Quote
Qonfire Posted May 23, 2012 Author Posted May 23, 2012 block intersects at any point on line,I'm ok for now. Thanks a lot Qonffire, Pardon my question but, you can see if the line intersects the blocks or not . and by the title of your thread You mean either the startpoint or the endpoint but not in betweeen them? [from your attached image] does it mean that if its not endpoint/starpoint of line then the test result is nil? or you really menat to say Block intersects at any coordinate of the line? will there be another set of functions to follow if the test is T? i would guess there would be, right? so whats the main function of your routine? Quote
Tharwat Posted May 23, 2012 Posted May 23, 2012 You wrote a lisp on my question.its like coming to university first and obtaining phd on a same day.thanks. I did not get your point Quote
pBe Posted May 23, 2012 Posted May 23, 2012 block intersects at any point on line,I'm ok for now. Thanks a lot Thats good to know, But I know there's more to it that just T or nil, can you show or descrbe for us the whats going to happen next after the test? Quote
Qonfire Posted May 23, 2012 Author Posted May 23, 2012 I did not get your point It's ok.I was trying to joke. 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.