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

Thread: Draw line from rectangle centre point to circle center point

  1. #1
    Active Member
    Join Date
    2006-10
    Posts
    80
    Login to Give a bone
    0

    Default Draw line from rectangle centre point to circle center point

    I am using Autocad2004. I am trying to write the routine that can draw the line from rectangle centre point to circle centre point according to the data in excel file. I've a bunch of rectangles and circles with the text number themselves. The details of excel data are:
    column A : the text number of rectangle
    column B : the text number of circle
    column C : x-coordinate for rectangle centre point
    column D : y-coordinate for rectangle centre point

    As example:
    column A , column B, column C, column D
    1, 2, 0.123, 0.223
    2, 3, 0.123, 0.321
    3, 5, 0.123, 0.400

    How to draw line from rectangle to circle accordingly by row that is rectangle no 1 to cirle no 2, rectangle no 2 to circle no 3, rectangle no 3 to circle no 5 etc...

    Additional information: The layer names of rectangle, rectangle number, circle and circle number are different.
    Last edited by noadea; 2007-01-11 at 12:57 AM.

  2. #2
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Chelan WA
    Posts
    1,060
    Login to Give a bone
    0

    Default Re: Draw line from rectangle centre point to circle center point

    Yes you can,

    I am still a little unclear on what you want but that sort of routine is relatively straight forward to code.

    Can you share a simple example in a dwg file showing before and after?

    Are they squares and circles with text

    or

    Blocks of a square and circle with attributes. The attributes make it easier.

    Peter

  3. #3
    Active Member
    Join Date
    2006-10
    Posts
    80
    Login to Give a bone
    0

    Default Re: Draw line from rectangle centre point to circle center point

    Attached files are the example of my drawing before(A_01.dwg) and after(A_02.dwg).
    The cotxt.zip file actually the excel data that i've saved as .csv file.
    column A : the text number of rectangle
    column B : the text number of circle
    column C : x-coordinate for rectangle centre point
    column D : y-coordinate for rectangle centre point
    The line should be connected from rectangle to circle or vise versa according to data by row. Means rectangle A1 to circle B1, rectangle A2 to circle B2... or vice versa.
    Thanks in advance.
    Last edited by noadea; 2007-03-23 at 12:59 AM.

  4. #4
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Chelan WA
    Posts
    1,060
    Login to Give a bone
    0

    Default Re: Draw line from rectangle centre point to circle center point

    As long as there are only one of these diagrams in a drawing.

    Also the point information in the csv is not necesary.

    Just the link between the numbers is sufficient.

    Bon apetite

    Also you should not use the # symbol in layer names. The lisp selection set ssget expression thinks that the # represents a wildcard number, so I had to use the ? wildcard letter to get the layer names. Also there are some square regions (not inserts) in this drawing. I ignored them.

    It is automatic.

    Peter
    Attached Files Attached Files

  5. #5
    Active Member
    Join Date
    2006-10
    Posts
    80
    Login to Give a bone
    0

    Question Re: Draw line from rectangle centre point to circle center point

    Thanks for your routine.
    I've tried it out but nothing come out.
    I've no idea which part got an error.
    Please help me find the solution. Thanks.

  6. #6
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Draw line from rectangle centre point to circle center point

    Dear Rohaya
    Try this instead

    ~'J'~
    Attached Files Attached Files

  7. #7
    Active Member
    Join Date
    2006-10
    Posts
    80
    Login to Give a bone
    0

    Default Re: Draw line from rectangle centre point to circle center point

    Thanks Oleg
    Great... It works pretty good.

  8. #8
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Draw line from rectangle centre point to circle center point

    Glad to help, Rohaya


    ~'J'~

  9. #9
    Active Member
    Join Date
    2006-10
    Posts
    80
    Login to Give a bone
    0

    Default Re: Draw line from rectangle centre point to circle center point

    Quote Originally Posted by peter
    As long as there are only one of these diagrams in a drawing.

    Also the point information in the csv is not necesary.

    Just the link between the numbers is sufficient.

    Bon apetite

    Also you should not use the # symbol in layer names. The lisp selection set ssget expression thinks that the # represents a wildcard number, so I had to use the ? wildcard letter to get the layer names. Also there are some square regions (not inserts) in this drawing. I ignored them.

    It is automatic.

    Peter
    Peter, how if my csv data has three type of value (integer, string, char) in certain row?
    Example:
    As example:
    column A , column B, column C, column D
    1, 1, 0.123, 0.223
    2, G, 0.123, 0.321
    3, G, 0.123, 0.400
    4, 3, 0.123, 0.450
    5, 4, 0.123, 0.505
    6, G, 0.123, 0.600
    7, 6, 0.123, 0.650
    8, -, 0.123, 0.700
    9, -, 0.123, 0.770

    After read csv file:
    if value in column B equal to "-" I wanna remove from list.
    if value in column B equal to "G" I wanna get the previous integer and next integer.
    (if after read next line still get "G", skip then get the next integer value).
    Refer to data example: B2 and B3 equal to "G", means get the integer in column B1 and B4. Same with B6 equal to "G", means get the integer in column B5 and B7.
    How to write the lisp that can manage the list to do all my needs? Thanks.

  10. #10
    Certifiable AUGI Addict robert.1.hall72202's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    Login to Give a bone
    0

    Default Re: Draw line from rectangle centre point to circle center point

    I was reading this post and I am wondering what you do with routine.
    What is your line of work?

Page 1 of 2 12 LastLast

Similar Threads

  1. Center Point Sketch Rectangle
    By inventor.wishlist1738 in forum Inventor Wish List
    Replies: 1
    Last Post: 2015-10-12, 03:53 PM
  2. Center Point Rectangle
    By inventor.wishlist1738 in forum Inventor Wish List
    Replies: 3
    Last Post: 2015-10-12, 03:29 PM
  3. Replies: 13
    Last Post: 2014-07-01, 02:23 PM
  4. Draw 2 rectangle / Square from Center Point
    By Orzabal in forum AutoLISP
    Replies: 5
    Last Post: 2012-09-24, 02:01 AM
  5. centre point of a rectangle/box
    By jesse.86737 in forum AutoCAD Wish List
    Replies: 3
    Last Post: 2005-05-13, 08:25 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
  •