Lisp for dimension break in lines intersection point

Lisp for dimension break in lines intersection point

miroslav.pristov
Advocate Advocate
1,704 Views
7 Replies
Message 1 of 8

Lisp for dimension break in lines intersection point

miroslav.pristov
Advocate
Advocate

Hello all, 

 

I will be very grateful if someone can help me in making this lisp because doing this manually i loose to much time in my drawings.

 

This lisp command will choose two lines that cross each other and divide selected dimension line in their intersection points. One line is always fixed and other slope line is not and depends of my drawing state. Also it can happen that I have more than one sloped line that intersect fixed line and it would be very good if the program could process multiple dimensional lines depending on selected sloped lines.

 

If you dont understand exatly what i want, in example file i give detail information with two ways how to enter input data for lisp command

 

which is very important to me is that dimensional lines that i select for dividing dont change their position on drawing

 

Thank you for your time, patience and help

0 Likes
1,705 Views
7 Replies
Replies (7)
Message 2 of 8

miroslav.pristov
Advocate
Advocate

I forgot to say that if I have more than one sloped lines, it doesn't mean me anything on my drawing to have one dimensional line that is divided into more parts in each point of intersection. I really need it done in this way i explained before. One dimensional line for one intersection points.

0 Likes
Message 3 of 8

miroslav.pristov
Advocate
Advocate

Hello and thanks for your answer and help.

 

I try your lisp and it do exactly what i want in example file but when i try it on my drawing i have a problem and bellow is explanation.

 

Your code treat line 1 as vertical line. I never said that line 1 needs to be vertical. i said that it is fixed line and all dimension dividing needs to be where other lines intercepts her. When i said fixed for that line i mean that there is no need to select that line more than 1 time when starting lisp command. So when i have fixed line non vertical the code has a error.

 

I hope you understand me. in case you dont, i added another exampe in my previous file when you can try your code and see where is a problem. 

 

Thank you

 

 

0 Likes
Message 4 of 8

ВeekeeCZ
Consultant
Consultant

Ok, then just remove that line that tests the verticality.

0 Likes
Message 5 of 8

miroslav.pristov
Advocate
Advocate

If i know what line test the verticality i probably dont need the help in making lisp commands. Can you tel me please what is that line

0 Likes
Message 6 of 8

miroslav.pristov
Advocate
Advocate

Can someone pls help me to remove the line that tests the verticality in code. 

0 Likes
Message 7 of 8

calderg1000
Mentor
Mentor

Regards @miroslav.pristov 

Try this code. I hope I have understood your request correctly.

 

(defun c:divD (/ sx sl psx1 pex2 psl1 psl2 pins sd sdn psd ped)
  (while
    (setq sx (car (entsel "\nSelect Fixed Line: ")))
     (setq sl   (car (entsel "\nSelect Slope Line: "))
           psx1 (cdr (assoc 10 (entget sx)))
           pex2 (cdr (assoc 11 (entget sx)))
           psl1 (cdr (assoc 10 (entget sl)))
           pel2 (cdr (assoc 11 (entget sl)))
           pins (inters psx1 pex2 psl1 pel2)
     )
     (princ "\nSelect Dimension:")
     (setq sd  (ssget "_+.:E:S" '((0 . "dimension")))
           sdn (vlax-ename->vla-object (ssname sd 0))
           sdd (vlax-vla-object->ename (vla-copy sdn))
           psd (cdr (assoc 13 (entget (ssname sd 0))))
           ped (cdr (assoc 14 (entget (ssname sd 0))))
     )
     (entmod (subst (cons 14 (list (car ped) (cadr pins)))
                    (assoc 14 (entget (ssname sd 0)))
                    (entget (ssname sd 0))
             )
     )
     (entmod (subst (cons 13 (list (car ped) (cadr pins)))
                    (assoc 13 (entget sdd))
                    (entget sdd)
             )
     )
     (princ)
  )
)

 

 


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

0 Likes
Message 8 of 8

miroslav.pristov
Advocate
Advocate

Thank you that is doing exactly what i want.

Just one question more, in some cases i have more than one dimension and slope line (let it be n) and only one fixed line . I dont know if this is possible at all to make, but can You change code that i can choose fixed line only at start of code and after that to choose slope line 1, dimension line 1, slope line 2, dimension line 2 etc. to n slope line and n dimension line. There is no need to define number n in code. After chossing last n dimension line, and press enter the code will execute command on all dimension lines.

0 Likes