CIRCLE's Intersection point

Discussion in 'AutoCAD' started by Mac Lukas, May 20, 2004.

  1. Mac Lukas

    Mac Lukas Guest

    Hi,

    Is it a method or routine in AutoLISP to check
    if a CIRCLE is intersected of a line or even other object.
    The CIRCLE is known but what I want here is to check if
    it's intersected by any line and retrieve this point
    to further programming.

    Thank in advance
    Mac
     
    Mac Lukas, May 20, 2004
    #1
  2. Mac Lukas

    Jeff Guest

    Hi Mac,
    Using ActiveX methods with VLisp this is relatively simple.
    First get the boundingbox of the circle, create a 'fenced' selection set,
    using the boundingbox as the fence, step through the selection set and use
    the IntersectWith method.

    If you need more help than that just post what you do have and I'll try to
    help out.

    Jeff
     
    Jeff, May 22, 2004
    #2
  3. Mac Lukas

    DScott Guest

    Form the AutoCAD help files:

    Sub Example_IntersectWith()
    ' This example creates a line and circle and finds the points at
    ' which they intersect.

    ' Create the line
    Dim lineObj As AcadLine
    Dim startPt(0 To 2) As Double
    Dim endPt(0 To 2) As Double
    startPt(0) = 1: startPt(1) = 1: startPt(2) = 0
    endPt(0) = 5: endPt(1) = 5: endPt(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPt, endPt)

    ' Create the circle
    Dim circleObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 3: centerPt(1) = 3: centerPt(2) = 0
    radius = 1
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)
    ZoomAll

    ' Find the intersection points between the line and the circle
    Dim intPoints As Variant
    intPoints = lineObj.IntersectWith(circleObj, acExtendNone)

    ' Print all the intersection points
    Dim I As Integer, j As Integer, k As Integer
    Dim str As String
    If VarType(intPoints) <> vbEmpty Then
    For I = LBound(intPoints) To UBound(intPoints)
    str = "Intersection Point[" & k & "] is: " & intPoints(j)
    & "," & intPoints(j + 1) & "," & intPoints(j + 2)
    MsgBox str, , "IntersectWith Example"
    str = ""
    I = I + 2
    j = j + 3
    k = k + 1
    Next
    End If
    End Sub
     
    DScott, May 24, 2004
    #3
  4. Mac Lukas

    MacLukas Guest

    Hi Jeff & Scott!

    Thank you very much for your contribution.
    I'm wondering if you are satisfied with 20(!) years of AutoCAD's
    development on the market.
    Fence(?????????????????????????????),
    Boundingbox(??????????????????????????)
    it should be a 'CIRCLE' directly!!!!!!!!!
    I've got enough of 'Fence' thinking.
    My routines like ´Circle trimmer' are probably known.
    What I'm looking for here is a new technology.
    But everything seems to be out of date as usual at AutoDesk.
    In our time what many of older AutoLisp developers are looking for is not
    'Select first', 'Select second' ...bla, bla, bla, but full 'Automation' for
    whole drawing, because many drawings have already been created!
    I'm warning you DO NOT try to be a new AutoDesk Slave (like Microsoft
    Slaves).
    Think independently and claim 'value for money'.
    Basic AutoLISP & commands from 1986 has not been developed at all!
    Except of command 'COPY' f...... 'Multiple' is removed.
    In my opinion it's too weak for $3000:-

    Best regards
    Mac
     
    MacLukas, May 26, 2004
    #4
  5. Mac Lukas

    Jeff Guest

    Just out of shear curiosity, WTF are you rambling about?
    Do want help or not?
    If so, please state what you are looking for in a clear and concise manner.
    If not, please just go away.

    And FWIW, the $3000+ price tag for this is cheap, considering the
    alternatives. I came from hand drafting and design to using Autocad and
    LandDesktop over the years. I know that I can produce more than enough to
    pay for the software in less than a week!

    Jeff
     
    Jeff, May 27, 2004
    #5
  6. Mac Lukas

    MacLukas Guest

    OK!

    What I need is a lisp routine that will
    rotate all reference texts inside circles & 2 rectangle-lines
    from 90 grade to zero but all at once on each drawing.
    The method 'select first' & 'select second'
    is hopeless here because there is ca 1000 texts on each drawing.
    Some of the texts inside the circles or lines (together with them)
    have to be magnified to the height pre-definied by the user.
    All texts and references lines are simple drawing-entities(no blocks)
    First outline is as follows:
    - Open dialog for setup values: text height, rotation angle from and
    rotation angle to.
    - ssget procedure with filter
    - then I can imagine two procedures: one for the text inside a circle
    & second one for the text inside two rectangle lines.
    - the key of the first procedure is to find the intersection point
    between circle and arrow-line. Then probably this primitive
    ssget'fence' circumscribed about the circle to find all lines
    close to the circle. Then intercestWith to find intersection point
    with the arrow-line.
    From this point magnify the circle and reference text if needed.
    And finally rotate the text at the centerpoint of the circle.
    - the key of the second procedure is similar however the text is
    always positioned
    between two lines: one to the right of the text and second under the
    text.
    What has to be done here is to find the intersection point between
    these two
    lines and arrow-line and then rotate whole group at this point and
    'scale' if needed.

    Best regards
    Mac Lukas
     
    MacLukas, May 28, 2004
    #6
  7. Mac Lukas

    Jeff Guest

    Well, that was much better. Now, to make this a little more clear, would it
    be possible for you to place a copy of a sample drawing in R2002 or below
    format to a place I could download it? Or you could send it to me at
    miffATsonicDOTnet (replace the AT and DOT with the proper symbols).

    Is the text always contained entirely within the circle? Is the text always
    Text and not MText?

    The text edjacent to 2 perpendicular line will be a little more
    difficult......what is the arrow line? Is it a Leader object?

    Does this have to be done in Lisp? Can VBA be used instead? IMHO, dialogs
    are MUCH simpler in VBA than lisp.

    Jeff
     
    Jeff, May 28, 2004
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.