Jump to content

Lisp to dim tons of lines automatically


Martinho

Recommended Posts

Hi all....

 

i need some HELP....i've got the DIM arround 3000+ lines...basically its a road and i need to measure the distance of the natual ground and the distance from the natual ground to the road...its a road with arround 82Km...and i have sections of 25m...there 3000+ sections that i need to DIM...

 

is there any LIST that can do that automatically by just selecting the lines...

 

i put a example of what i need to DIM...

 

i hope some one knows a lisp to help me out....tks

example.zip

Link to comment
Share on other sites

HI....that is great tks alot....but i also need that but with something more...if possible...i need to get 2 DIMs from the line....not the total DIM....but the DIM of each intersection...

 

My english isnt the beast so im trying the explain the best i can....sorry

Link to comment
Share on other sites

Something like this ?

 

(defun c:Test (/ _pts ss ch i sn en p1 p2 sf n l 2p)
 ;;----------------------------------------------------;;
 ;;         Author: Tharwat Al Shoufi        ;;
 ;;        Date: 08. May. 2015            ;;
 ;;----------------------------------------------------;;
 (if (setq ss (ssget '((0 . "LINE"))))
   (progn
     (setq ch (getvar 'cmdecho))
     (setvar 'cmdecho 0)
     (defun _pts (lst)
   (if lst
     (cons (list (car lst) (cadr lst) (caddr lst))
           (_pts (cddddr lst))
     )
   )
 )
     (repeat (setq i (sslength ss))
       (setq sn (ssname ss (setq i (1- i)))
             en (entget sn)
             p1 (cdr (assoc 10 en))
             p2 (cdr (assoc 11 en))
             sf (ssget "_F" (list p1 p2) '((0 . "*POLYLINE")))
       )
       (repeat (setq n (sslength sf))
         (if
           (setq
             l (vlax-invoke
                 (vlax-ename->vla-object (ssname sf (setq n (1- n))))
                 'Intersectwith
                 (vlax-ename->vla-object sn)
                 AcExtendnone
               )
           )
            (progn
              (foreach p (_pts l)
                (if (not (equal (distance p p1) 0. 1e-)
                  (if (< (distance p p1) (distance p p2))
                    (setq 2p (list p p1))
                    (setq 2p (list p p2))
                  )
                )
              )
              (mapcar
                '(lambda (j k)
                   (command "_.dimlinear" "_non" j "_non" k "_non" j)
                 )
                (list p1 (car 2p))
                (list p2 (cadr 2p))
              )
            )
         )
       )
     )
     (setvar 'cmdecho ch)
   )
 )
 (princ)
)(vl-load-com)



Link to comment
Share on other sites

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