Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Automatic drawing arc with trimed line at intersection of two lines

  1. #1
    Member
    Join Date
    2010-03
    Posts
    8

    Default Automatic drawing arc with trimed line at intersection of two lines

    How can I do it? Like in AutoCAD electrical, when I drawing wire? Please see attach.


    Thanks
    Attached Images Attached Images

  2. #2
    Member
    Join Date
    2010-03
    Posts
    8

    Default Re: Automatic drawing arc with trimed line at intersection of two lines

    I find LISP, but doesn't work, I have error no finstion definition: dxf

    Code:
    (defun C:arcc ( / head hdata bulge en ed)
    (if (and
    (setq en (entsel "\nselect polyline: "))
    (= (dxf 0 (setq hdata
    (entget (car en)))) "POLYLINE")
    )
    (progn
    (entmod (subst '(70 . 1) '(70 . 0) hdata))
    (setq bulge (list (cons 42 0.5)))
    (setq en (dxf -1 hdata))
    (while (and (setq en (entnext en))
    (setq ed (entget en))
    (/= "SEQEND" (dxf 0 ed))
    )
    (setq ed (append ed bulge))
    (entmod ed)
    )
    (entupd en)
    ) )
    (princ)
    )
    (princ)
    Last edited by Opie; 2010-03-12 at 02:59 PM. Reason: [code] tags added

  3. #3
    Member
    Join Date
    2004-12
    Posts
    3

    Default Re: Automatic drawing arc with trimed line at intersection of two lines

    b.ssss.12 (Are you a robot like C-3PO and R2-D2 ?)

    Well let's go to the facts.

    The error No function definition DXF is dued that you must have a function named DXF.

    See the example following:

    (defun dxf (num x)
    (cdr(assoc num (entget x)))
    )

    See in AutoCAD Help:

    DXF Reference --> DXF Format --> Group Codes in Numerical Order

    And here try the new code:

    Code:
    (princ Type ARCC to Start !")
    ;; --------------------------
    (defun dxf (num x) ; The DXF function that was missing.
      (cdr(assoc num (entget x)))
    )
    ;; --------------------------------------
    (defun C:arcc ( / head hdata bulge en ed)
    (if (and
    (setq en (entsel "\nselect polyline: "))
    (= (dxf 0 (setq hdata
    (entget (car en)))) "POLYLINE")
    )
    (progn
    (entmod (subst '(70 . 1) '(70 . 0) hdata))
    (setq bulge (list (cons 42 0.5)))
    (setq en (dxf -1 hdata))
    (while (and (setq en (entnext en))
    (setq ed (entget en))
    (/= "SEQEND" (dxf 0 ed))
    )
    (setq ed (append ed bulge))
    (entmod ed)
    )
    (entupd en)
    ) )
    (princ)
    )
    (princ)
    I hope that helps you.

    Enjoy and improve the code. Ah! You must extract ename.

    (setq c (car (entsel)))
    (setq b (entget c))
    (setq a (cdr (assoc '0 b))) ; a will get the name of entity.


    hugopaulo

  4. #4
    Member
    Join Date
    2010-03
    Posts
    8

    Default Re: Automatic drawing arc with trimed line at intersection of two lines

    I have new error

    Code:
    error: bad argument type: lentityp ((-1 . <Entity name: 
    7ffffb08020>) (0 . "LWPOLYLINE") (330 . <Entity name: 7ffffb039f0>) (5 . "3F2") 
    (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbPolyline") 
    (90 . 2) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 35.2926 24.9918) (40 . 
    0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 41.4498 24.9918) (40 . 0.0) (41 . 0.0) 
    (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0))

  5. #5
    Member
    Join Date
    2010-07
    Posts
    29

    Default Re: Automatic drawing arc with trimed line at intersection of two lines

    I need this.. ..is there any complete lisp for this?

  6. #6
    I could stop if I wanted to pbejse's Avatar
    Join Date
    2010-10
    Posts
    397

    Default Re: Automatic drawing arc with trimed line at intersection of two lines

    Are you wanting it to work on Lines/Lwpolylines/Polylines?
    Waht is the size for the break?

  7. #7
    Member
    Join Date
    2010-07
    Posts
    29

    Default Re: Automatic drawing arc with trimed line at intersection of two lines

    i want it both...lets say the break around 500mm distance.

  8. #8
    I could stop if I wanted to pbejse's Avatar
    Join Date
    2010-10
    Posts
    397

    Default Re: Automatic drawing arc with trimed line at intersection of two lines

    A quick one, no error trap, no defaults.. none of the essentials ... WYSIWYG

    Code:
    (defun c:brc (/ obj rad e pt rf pt1 pt2 arc gr mode data)
      (vl-load-com)
      (setq osm (getvar 'osmode))
      (setvar 'osmode 32)
      (setq obj (car (entsel "\nSelect Object to break:")))
      (Setq rf (getpoint "\nPick center point of arc:"))
      (setq rad (getdist "\nEnter Radius value/Pick two points: "))
      (setq	pt (vlax-curve-getClosestPointTo (setq e obj) rf)
    	rf (+ (vlax-curve-getdistatPoint e pt) rad)
      )
      (command "_arc" "_non"
    	   (setq pt1 (vlax-curve-getPointAtDist e rf))
    	   "_e" "_non"
    	   (setq pt2 (vlax-curve-getPointAtDist e (- rf (* rad 2))))
    	   "_r" rad
      )
      (setq	arc (entlast)
    	tr  0
      )
      (prompt "\nMove Mouse up and down to flip")
      (while
        (progn
          (setq gr	 (grread t 15 0)
    	    mode (car gr)
    	    data (cadr gr)
          )
    
          (cond ((= 5 mode)
    	     (if ((if (zerop tr)  < >  )  pi
    		   (angle pt data)
    		 )
    	       (setq tr	(boole 6 1 tr)
    		     ro
    			(vlax-invoke
    			  (vlax-ename->vla-object arc)
    			  'rotate
    			  pt pi
    			)
    	       )
    	     )
    	     T
    	    )
    	    ((member mode '(2 3)) nil)
          )
        )
      )
      (command "_break" obj pt1 pt2)
      (setvar 'osmode osm)
      (princ)
    )
    Last edited by pbejse; 2012-10-12 at 07:58 AM. Reason: Add pi for missing variable ang

  9. #9
    I could stop if I wanted to marko_ribar's Avatar
    Join Date
    2004-06
    Location
    Belgrade, Serbia, Europe
    Posts
    414

    Default Re: Automatic drawing arc with trimed line at intersection of two lines

    One mistake :
    replace ang with PI
    Code:
    ((if (zerop tr) < >) pi (angle pt data))
    M.R.
    Marko Ribar, d.i.a. (graduated engineer of architecture)

    M.R. on Youtube


  10. #10
    I could stop if I wanted to pbejse's Avatar
    Join Date
    2010-10
    Posts
    397

    Default Re: Automatic drawing arc with trimed line at intersection of two lines

    Quote Originally Posted by marko_ribar View Post
    .....
    replace ang with PI....
    M.R.
    By george you are right. [code update]
    Good catch.

    Thank you Marko.
    Last edited by pbejse; 2012-10-12 at 07:59 AM.

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 2010-04-22, 08:07 PM
  2. intersection of line and polygon
    By MikeJarosz in forum VBA/COM Interop
    Replies: 14
    Last Post: 2009-05-15, 05:35 PM
  3. Replies: 7
    Last Post: 2007-01-25, 05:18 PM
  4. Drawing Section Lines/Section Line Style
    By Mike Y in forum Inventor - General
    Replies: 0
    Last Post: 2007-01-12, 07:47 PM

Posting Permissions

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