giskumar Posted November 3, 2010 Share Posted November 3, 2010 Hi all I want to make snap check on my polyline data. I achieved this by selecting the entities at each end of polyline using ssget "_cp" option. For this i have to zoom screen to every end of line to make selection which will taking much time. Is there a process that i can check the snap errors with out using ssget. Thanks, Kumar. Quote Link to comment Share on other sites More sharing options...
JohnM Posted November 4, 2010 Share Posted November 4, 2010 what do you mean by snap errors? Quote Link to comment Share on other sites More sharing options...
BlackBox Posted November 4, 2010 Share Posted November 4, 2010 Look into the vlax-curve-getStartPoint, and vlax-curve-getEndPoint functions in the developer documentation. ***They will both accept eNames in lieu of vla-Objects. Quote Link to comment Share on other sites More sharing options...
giskumar Posted November 4, 2010 Author Share Posted November 4, 2010 I want to make sure that all polylines are snapped to each other at their end points. In Autocad map versions we can make sure by using topology checks. But right now i have a situation to on Intelli cad in which no map commands available. Hence i want to make a lisp routine with out using visual lisp functions for checking the polyline snapping at ends. If the end is not snapped to other end need to mark an error. Thanks, Kumar. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted November 4, 2010 Share Posted November 4, 2010 I want to make sure that all polylines are snapped to each other at their end points. In Autocad map versions we can make sure by using topology checks. But right now i have a situation to on Intelli cad in which no map commands available. Hence i want to make a lisp routine with out using visual lisp functions for checking the polyline snapping at ends. If the end is not snapped to other end need to mark an error. What is the reason to discard Visual LISP? Quote Link to comment Share on other sites More sharing options...
ReMark Posted November 4, 2010 Share Posted November 4, 2010 Why wouldn't the lines be snapped to each other? Do you knowingly "eyeball" connections between lines (poor practice by the way)? Quote Link to comment Share on other sites More sharing options...
JohnM Posted November 4, 2010 Share Posted November 4, 2010 If you are just checking 2 polylines use you ssget _cp then get each entity and list the vertices then compare the first and last vertices of the two list If you are selecting more than two there will be issues because ssget cp might not return a correct order so you might use ssadd then parse through the vertices checking then Quote Link to comment Share on other sites More sharing options...
BlackBox Posted November 4, 2010 Share Posted November 4, 2010 Perhaps this will provide a starting point: (defun c:FOO (/ ss) (vl-load-com) (if (setq ss (ssget '((0 . "LINE,*POLYLINE")))) ((lambda (i / e l) (while (setq e (ssname ss (setq i (1+ i)))) (setq l (cons (cons e (list (vlax-curve-getstartpoint e) (vlax-curve-getendpoint e))) l))) (foreach a l [color=red];; ... Rest of code goes here [/color] )) -1)) (princ)) Quote Link to comment Share on other sites More sharing options...
David Bethel Posted November 4, 2010 Share Posted November 4, 2010 For lines, From John Uhden ;;----------------------------------------------- ;; SSGETENDS.LSP (c)2002, John F. Uhden, Cadlantic ;; Function to create a selection set of Lines ;; within a fuzz distance of either end of a Line ;; given the 'ENAME of the selected line and the ;; fuzz distance as a real or integer. ;; Dedicated to Bill Zondlo c.02-04-02 ;; (defun ssgetends (e fuzz / ent p10 p11 ss) (and (= (type e) 'ENAME) (numberp fuzz) (>= fuzz 0) (setq ent (entget e)) (= (cdr (assoc 0 ent)) "LINE") (setq p10 (cdr (assoc 10 ent))) (setq p11 (cdr (assoc 11 ent))) (setq fuzz (list fuzz fuzz fuzz)) (setq ss (ssget "X" (list '(0 . "LINE") '(-4 . "<OR") '(-4 . "<AND") '(-4 . ">=,>=,>=") (cons 10 (mapcar '- p10 fuzz)) '(-4 . "<=,<=,<=") (cons 10 (mapcar '+ p10 fuzz)) '(-4 . "AND>") '(-4 . "<AND") '(-4 . ">=,>=,>=") (cons 10 (mapcar '- p11 fuzz)) '(-4 . "<=,<=,<=") (cons 10 (mapcar '+ p11 fuzz)) '(-4 . "AND>") '(-4 . "<AND") '(-4 . ">=,>=,>=") (cons 11 (mapcar '- p10 fuzz)) '(-4 . "<=,<=,<=") (cons 11 (mapcar '+ p10 fuzz)) '(-4 . "AND>") '(-4 . "<AND") '(-4 . ">=,>=,>=") (cons 11 (mapcar '- p11 fuzz)) '(-4 . "<=,<=,<=") (cons 11 (mapcar '+ p11 fuzz)) '(-4 . "AND>") '(-4 . "OR>") ) ) Quote Link to comment Share on other sites More sharing options...
JohnM Posted November 4, 2010 Share Posted November 4, 2010 he is using intellcad not autocad so the use of visual lisp will not work Quote Link to comment Share on other sites More sharing options...
BlackBox Posted November 4, 2010 Share Posted November 4, 2010 What is the reason to discard Visual LISP? he is using intellcad not autocad so the use of visual lisp will not work That is what I was not understanding, thanks for the clarification. Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 4, 2010 Share Posted November 4, 2010 Just playing around... (defun c:SN (/ e1 e2) (if (and (setq e1 (entsel "\nSelect first object: ")) (setq e2 (entsel "\nSelect second object: ")) ) (if (apply (function (lambda (a b) (equal a b 0.))) (mapcar (function (lambda (e) (cond ((osnap (cadr e) "_END")) ((cdr (assoc 10 (entget (car e))))) ) ) ) (list e1 e2) ) ) (alert "Objects snap.") (alert "Objects do not snap!") ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
giskumar Posted November 5, 2010 Author Share Posted November 5, 2010 Nice code David, That is what i am expecting. I am working on Polylines, Hence i am changing code as follows. (setq p10 (cdr (assoc 10 ent))) (setq p11 (cdr (assoc 10 (reverse ent)))) Thanks for all to share ideas..... Kumar. Quote Link to comment Share on other sites More sharing options...
giskumar Posted November 5, 2010 Author Share Posted November 5, 2010 Nice code David. That is what i am expecting. Thanks for all to share ideas............... Kumar. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted November 5, 2010 Share Posted November 5, 2010 That is what i am expecting. Hmmm ... You don't have any relation to Balaji do you, 'Kumar'? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 5, 2010 Share Posted November 5, 2010 Hmmm ... You don't have any relation to Balaji do you, 'Kumar'? You're getting paranoid now Renderman... Quote Link to comment Share on other sites More sharing options...
giskumar Posted November 6, 2010 Author Share Posted November 6, 2010 May i know why did you asked like that RenderMan? Any way i dont know balaji. I already mentioned in earlier post that i want to do with out using "_cp" option in ssget. Using "_cp" i have to zoom to the location every time at each end of line which is taking lot of time on bulk data. but i did't got an idea of filtering points by ssget with in a range as i am not expert in lisp. David's reply is matching to my requirement. Any suggestions always welcome........ Kumar. Quote Link to comment Share on other sites More sharing options...
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.