+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17
  1. #1
    Forum Newbie
    Computer Details
    s1222s's Computer Details
    Operating System:
    Windows
    Discipline
    Construction
    Using
    AutoCAD 2007
    Join Date
    Sep 2012
    Location
    Sofia
    Posts
    8

    Default How to draw breaking on 2 parallel lines

    Registered forum members do not see this ad.

    I am trying to break 2 parallel lines and draw closing lines and intersections.
    I try to use getpoint to make a point somewhere at the line but it is not working.
    does somebody has a solution?

    and following insert of an object.
    parlinesbreak.dwg
    Attached Files
    Last edited by s1222s; 16th Sep 2012 at 10:13 am.

  2. #2
    Senior Member
    Using
    AutoCAD 2006
    Join Date
    Aug 2009
    Posts
    109

    Default

    Hi,

    Try this.

    Code:
     
    (defun c:BRK()
      (setq snp (getvar "OSMODE"))
      (setvar "OSMODE" 0)
      (setq ent (entsel "\nSelect line to break"))
      (setq po (cadr ent))
      (setq ent (car ent))
      (setq vlent (vlax-ename->vla-object ent))
      (setq po (vlax-curve-getclosestpointto vlent po))
      
      (setq po1 (getpoint po "\nSelect next point to break"))
      (setq po1 (vlax-curve-getclosestpointto vlent po1))
      (setq ent1 (car (entsel "\nSelect parallen entity")))
      (setq vlent1 (vlax-ename->vla-object ent1))
      (setq po2 (vlax-curve-getclosestpointto vlent1 po))
      (setq po3 (vlax-curve-getclosestpointto vlent1 po1))
      (command "Break" ent po po1)
      (command "Break" ent1 po2 po3)
      (command "line" po po2 "")
      (command "line" po1 po3 "")
      (setvar "OSMODE" snp)
      )

  3. #3
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Another:

    Code:
    (defun c:br2 (/ lines pt1 pt2 ol plst)
    ;;;	pBe Sep 2012	;;;
    (vl-load-com)
      (prompt "\nSelect Objects to Break:")
      (cond
        ((and
           (setq plst  nil
    	     lines (ssget ":L" '((0 . "LINE")))
           )
           (= (sslength lines) 2)
           (setq pt1 (getpoint "\nPick first point:"))
           (setq pt2 (getpoint pt1 "\nPick second point:"))
           (repeat (sslength lines)
    	 (setq ol (ssname lines 0))
    	 (setq plst (cons (vlax-curve-getclosestpointto ol pt1) plst)
    	       plst (cons (vlax-curve-getclosestpointto ol pt2) plst)
    	 )
    	 (command "_break" ol "_non" pt1 "_non" pt2)
    	 (ssdel ol lines)
           )
           (mapcar '(lambda	(j)
    		  (entmakex (list (cons 0 "LINE")
    				  (cons 10 (nth (Car j) plst))
    				  (cons 11 (nth (Cadr j) plst))
    			    )
    		  )
    		)
    	       '((0 2) (1 3))
           )
         )
        )
      )
      (princ)
    )
    HTH

  4. #4
    Forum Newbie
    Computer Details
    s1222s's Computer Details
    Operating System:
    Windows
    Discipline
    Construction
    Using
    AutoCAD 2007
    Join Date
    Sep 2012
    Location
    Sofia
    Posts
    8

    Default Re:

    Thanks. Its working but not at all.
    That is I am trying to do:
    brklns.dwg


    Part of my code:
    Code:
    (defun c:WR1 ( / aa b c c5 c6 c7 c8 cc3 d l la lb dr wbl)
    
      (setq bl (getvar "BLIPMODE"))
      (setq cm (getvar "CMDECHO"))
      (setvar "CMDECHO" 0)
    
      (if (not doorw)
        (setq doorw 0.9)
      )
      (initget 2)
      (setq dr (getdist (strcat "Door with: <" (rtos doorw 2 2) ">")))
      (if dr
        (setq doorw dr)
      )
    
      ;(setq a1 (cdr (assoc 10 (entget (car (entsel))))))
      
      (setq aobject (cdr (entget (car (entsel "\nSelect first line: ")))))
      (setq a1 (cdr (assoc 10 (cdr aobject))))
      (setq a2 (cdr (assoc 11 (cdr aobject))))
      (setq bobject (cdr (entget (car (entsel "\nSelect second line: ")))))
      (setq b1 (cdr (assoc 10 (cdr bobject))))
      (setq b2 (cdr (assoc 11 (cdr bobject))))
    
      (setq _c (getpoint "\nBase point: "))
      (initget 1 "Left Right:")
      (setq d (getkword "\nLeft or Right?"))
    
    
    (setq _la (angle a1 a2))
      (setq _lb (angle b1 b2))
      (setq lac (angle a1 _c))
      
      (setq c1 (polar a1 _la (* (cos (- _la lac)) (distance a1 _c))))
      (setq cd (distance a1 b1))
      (setq lbc (angle b1 (polar _c (+ _lb (* 0.5 pi)) (* (cos (- _lb lbc)) cd)))) 
      (setq c2 (polar b1 (+ _lb (* 0.5 pi)) (* (cos (- _lb lbc)) cd)))
    ..........................
    That "_c" point is not on the place where I've picked it (base point).
    Last edited by s1222s; 16th Sep 2012 at 04:57 pm.

  5. #5
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    With prompt for Door Width:

    Code:
    (defun c:br2 (/ lines pt1 pt2 ol  plst)
    ;;;	pBe Sep 2012	;;;
    (vl-load-com)
      (prompt "\nSelect Objects to Break:")
      (cond
        ((and
           (setq plst  nil
    	     lines (ssget ":L" '((0 . "LINE")))
           )
           (= (sslength lines) 2)
           (setq dr (cond
    	((getdist (strcat "\nEnter Window width"
                     (if dr (strcat " <" (rtos dr) ">: ") ": ")
                                )))(dr))
                    )
           (setq pt1 (getpoint "\nPick first point:"))
           (setq pt2 (getpoint pt1 "\nPick second point for direction:"))
           (setq pt2 (polar pt1 (angle pt1 pt2) dr))
           (repeat (sslength lines)
    	 (setq ol (ssname lines 0))
    	 (setq plst (cons (vlax-curve-getclosestpointto ol pt1) plst)
    	       plst (cons (vlax-curve-getclosestpointto ol pt2) plst)
    	 )
    	 (command "_break" ol "_non" pt1 "_non" pt2)
    	 (ssdel ol lines)
           )
           (mapcar '(lambda	(j)
    		  (entmakex (list (cons 0 "LINE")
    				  (cons 10 (nth (Car j) plst))
    				  (cons 11 (nth (Cadr j) plst))
    			    )
    		  )
    		)
    	       '((0 2)
    		 (1 3))
           )
         )
        )
      )
      (princ)
    )
    BTW: Welcome to the Forum
    Please do read this Code Posting Guidelines
    Last edited by pBe; 16th Sep 2012 at 12:16 pm.

  6. #6
    Forum Newbie
    Computer Details
    s1222s's Computer Details
    Operating System:
    Windows
    Discipline
    Construction
    Using
    AutoCAD 2007
    Join Date
    Sep 2012
    Location
    Sofia
    Posts
    8

    Default

    Great thanks. Its working.
    I see a lot of thinks need to be clarified in autolisp
    But with getpoint is possible to get a point because I thought it was wrong, right.

  7. #7
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Quote Originally Posted by s1222s View Post
    Great thanks. Its working.
    You are welcome, Glad to help.
    Hope you'll learn from it.

    Please update your post after reading Code Posting Guidelines <---- Linky

    Cheers

  8. #8
    Forum Newbie
    Computer Details
    s1222s's Computer Details
    Operating System:
    Windows
    Discipline
    Construction
    Using
    AutoCAD 2007
    Join Date
    Sep 2012
    Location
    Sofia
    Posts
    8

    Default

    Ok. Why do I really need "vlax-curve-getClosestPoint" in that lisp?!

  9. #9
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,786

    Default

    Is this what your trying to do, plus lots more if so private email me the add on to do simple house designs is still avaialble can supply details

    door.jpg
    A man who never made mistakes never made anything

  10. #10
    Forum Newbie
    Computer Details
    s1222s's Computer Details
    Operating System:
    Windows
    Discipline
    Construction
    Using
    AutoCAD 2007
    Join Date
    Sep 2012
    Location
    Sofia
    Posts
    8

    Default

    Registered forum members do not see this ad.

    Yes right that I try to do but main thing I try is to learn autolisp.
    stefan_ss@abv.bg

Similar Threads

  1. Breaking a whole lot of lines
    By Silvercloak in forum AutoLISP, Visual LISP & DCL
    Replies: 13
    Last Post: 2nd Apr 2012, 02:45 pm
  2. Lines at same angles but not parallel?
    By bobsy852 in forum AutoCAD Beginners' Area
    Replies: 3
    Last Post: 20th May 2010, 10:25 am
  3. rotating two parallel lines
    By James123 in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 4
    Last Post: 17th Feb 2010, 12:18 pm
  4. Parallel Lines
    By irwin5338 in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 2
    Last Post: 14th Aug 2008, 09:39 pm
  5. breaking the lines
    By vivekgrs in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 20th Jul 2006, 06:04 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts