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

Thread: Autocad Lisp draw line from centre of circle to adjacent line

  1. #1
    Member
    Join Date
    2013-02
    Posts
    18
    Login to Give a bone
    0

    Default Autocad Lisp draw line from centre of circle to adjacent line

    Hi.
    I'm not too familiar with writing lisp routines and was wondering whether someone could help me.
    I have a drawing where i have put in multiple circles (to represent the lowest point of a house connection) and I have polylines to represent proposed pipe lines.
    Is there a way that I can automatically generate polylines from the centre of these circles to the adjacent polyline? (It should prompt for me to select the polyline).

    Thanks!

  2. #2
    Member
    Join Date
    2013-02
    Posts
    17
    Login to Give a bone
    0

    Default Re: Autocad Lisp draw line from centre of circle to adjacent line

    select circle with your order,then finish select,polyline can draw.
    (defun c:test()
    (command ".pline" )
    (while(setq e(entsel))
    (command (cdr(assoc 10 (entget(car e)))))
    )
    (command "")
    )
    Last edited by 742850517357521; 2013-02-25 at 03:51 AM.

  3. #3
    I could stop if I wanted to
    Join Date
    2015-10
    Location
    Colorado Springs, CO
    Posts
    369
    Login to Give a bone
    0

    Default Re: Autocad Lisp draw line from centre of circle to adjacent line

    Since it sounds like you would be selecting both objects, and you want a simple line, I would suggest simply turning on your center and perpendicular snaps...

  4. #4
    Member
    Join Date
    2013-02
    Posts
    18
    Login to Give a bone
    0

    Default Re: Autocad Lisp draw line from centre of circle to adjacent line

    Hi. Yes, that is what I am doing at the moment. But with 3000+ circles in the drawing, it becomes a tedious task.
    I thought that maybe there was a lisp available that could enable me to select the circles then the line that I want to connect to, then draw the polyline from the circle to the selected line.

  5. #5
    Member
    Join Date
    2013-02
    Posts
    18
    Login to Give a bone
    0

    Default Re: Autocad Lisp draw line from centre of circle to adjacent line

    Hi. I couldnt quite get this to work. Am I doing something wrong?

  6. #6
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,100
    Login to Give a bone
    0

    Default Re: Autocad Lisp draw line from centre of circle to adjacent line

    Quote Originally Posted by zaibaa.ali362058 View Post
    Hi. Yes, that is what I am doing at the moment. But with 3000+ circles in the drawing, it becomes a tedious task.
    I thought that maybe there was a lisp available that could enable me to select the circles then the line that I want to connect to, then draw the polyline from the circle to the selected line.
    Do you have a sample of what you are wanting it to look like?

    What about the steps and input prompts you think this routine should work through?
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  7. #7
    Member
    Join Date
    2013-02
    Posts
    18
    Login to Give a bone
    0

    Default Re: Autocad Lisp draw line from centre of circle to adjacent line

    Quote Originally Posted by Opie View Post
    Do you have a sample of what you are wanting it to look like?

    What about the steps and input prompts you think this routine should work through?
    How can I send you the AutoCad file?

  8. #8
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,100
    Login to Give a bone
    0

    Default Re: Autocad Lisp draw line from centre of circle to adjacent line

    Quote Originally Posted by zaibaa.ali362058 View Post
    How can I send you the AutoCad file?
    Attach it to your post. You can use the Go Advanced button when replying. From there, there is an Additional Options section below the message box which will allow you to Manage Attachments.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  9. #9
    Member
    Join Date
    2013-02
    Posts
    18
    Login to Give a bone
    0

    Default Re: Autocad Lisp draw line from centre of circle to adjacent line

    Quote Originally Posted by Opie View Post
    Attach it to your post. You can use the Go Advanced button when replying. From there, there is an Additional Options section below the message box which will allow you to Manage Attachments.
    I basically want to produce the yellow lines in the drawing automatically.
    I imagine i would have to first select the circle, then the line i would like to join to, and the lisp routine could create a line for me.
    Attached Files Attached Files

  10. #10
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,100
    Login to Give a bone
    0

    Default Re: Autocad Lisp draw line from centre of circle to adjacent line

    You can try this. It was written quick with not much error checking.

    To run, type "foo" at the command prompt. Select the circles along the line / polyline you wish to connect to. Then select the line / polyline.

    Before running the routine, make sure the correct layer is set as current.

    Code:
    (defun c:foo (/ selection pline sscount objpline inspoint intpoint entity)
      (if (not (setq selection (ssget "_I" '((0 . "CIRCLE")))))
        (progn
          (prompt "\nSelect circles: ")
          (setq selection (ssget '((0 . "CIRCLE"))))
        )
      )
      (setq pline (entsel "\nSelect polyline: "))
      (if (and
    	pline
    	(setq objpline (vlax-ename->vla-object (car pline)))
          )
        (repeat (setq sscount (sslength selection))
          (setq
    	entity	 (entget (ssname selection (setq sscount (1- sscount))))
    	inspoint (cdr (assoc 10 entity))
    	intpoint (vlax-curve-getclosestpointto objpline inspoint)
          )
          (if intpoint
    	(command "_.line" "non" inspoint "non" intpoint "")
          )
        )
      )
    )
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Page 1 of 2 12 LastLast

Similar Threads

  1. 2014: Draw a circle with diameter based on a line's length
    By terencelaspinas444385 in forum AutoCAD General
    Replies: 5
    Last Post: 2013-11-20, 04:21 PM
  2. Draw line lisp
    By rphillips.137763 in forum AutoLISP
    Replies: 3
    Last Post: 2012-06-21, 02:05 PM
  3. Replies: 2
    Last Post: 2009-10-20, 10:10 PM
  4. Replies: 10
    Last Post: 2007-03-23, 01:50 AM
  5. How to draw attributed line circle?
    By animkundu in forum AutoCAD General
    Replies: 3
    Last Post: 2005-02-23, 09:40 AM

Tags for this Thread

Posting Permissions

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