Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

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.:(

Posted
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?

Posted

Why wouldn't the lines be snapped to each other? Do you knowingly "eyeball" connections between lines (poor practice by the way)?

Posted

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

Posted

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))

Posted

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>")
       )
     )

Posted

he is using intellcad not autocad so the use of visual lisp will not work

Posted
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. :beer:

Posted

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)
)

Posted

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.:)

Posted

Nice code David.

 

That is what i am expecting.

 

Thanks for all to share ideas...............

 

 

Kumar.

Posted

That is what i am expecting.

 

 

Hmmm ... You don't have any relation to Balaji do you, 'Kumar'? :unsure:

Posted
Hmmm ... You don't have any relation to Balaji do you, 'Kumar'? :unsure:

 

You're getting paranoid now Renderman... :P

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...