+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Forum Newbie
    Using
    AutoCAD 2011
    Join Date
    Jan 2011
    Posts
    9

    Default [VBA/Autocad]The shortest distance between two lines

    Registered forum members do not see this ad.

    I'm trying to figure out how to find the nearest point of a line to another line, but I can not find the right approach.

    The lines do not intersect, but at a point are very close.
    I should write something to tell me the coordinates of this point.

    The two lines are drawn in 3D and are skew.

    I need some ideas on how to tackle the problem.

  2. #2
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2017
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,225

    Default

    Hope this help you out with what you looking forward .

    Code:
    (vl-load-com)
    (setq ss (vlax-ename->vla-object (setq e (car (entsel "\n Select First Line :")))))
    (setq ss1 (vlax-ename->vla-object (setq e1 (car (entsel "\n Select Second Line :")))))
    (setq pt (vlax-curve-getClosestPointTo ss (cdr (assoc 10 (entget e1)))))
    Tharwat

  3. #3
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,199
    DropBox
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  4. #4
    Super Member
    Computer Details
    designerstuart's Computer Details
    Operating System:
    xp
    Computer:
    various
    Discipline
    Architectural
    designerstuart's Discipline Details
    Occupation
    architect
    Discipline
    Architectural
    Using
    ADT 2009
    Join Date
    Jun 2010
    Location
    near london, near europe
    Posts
    867

    Default

    was this post an accident? see here....
    http://www.cadtutor.net/forum/showth...ween-two-lines

  5. #5
    Forum Newbie
    Using
    AutoCAD 2011
    Join Date
    Jan 2011
    Posts
    9

    Default

    I think I had two windows open on the forum I posted by mistake on both, this is the right place, my request is for vba and not for lisp.
    I apologize now in the other post.

    We can continue here.

  6. #6
    Forum Newbie
    Using
    AutoCAD 2011
    Join Date
    Jan 2011
    Posts
    9

    Default

    I apologize for posting in wrong section.

    My question is about VBA and do not lisp.

    I thank those who answered me, I will try also to learn lisp.

    Maybe a moderator can close?

    I apologize again.

  7. #7
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2018
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    12,097

    Default

    I merged the threads. The responses involving LISP my help others so I will leave that.
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  8. #8
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,585

    Default

    Registered forum members do not see this ad.

    Maybe a help drew an arc that crosses a pline and work out its intersection point

    ThisDrawing.Utility.GetEntity oPoly, snapPt, vbCr & "Select polyline :"
    Set arcobj = ThisDrawing.ModelSpace.AddArc(vertPt, cRad, endang, startang)
    retval2 = arcobj.IntersectWith(oPoly, acExtendOtherEntity)

    there is 4 different intersectwith options check help

Similar Threads

  1. Draw line in the mid distance of 2 existing lines
    By motee-z in forum AutoLISP, Visual LISP & DCL
    Replies: 29
    Last Post: 21st Jul 2016, 10:02 am
  2. Shortest path trace
    By felixsauve in forum Map 3D
    Replies: 0
    Last Post: 17th Jun 2010, 04:20 pm
  3. lines (bearing/distance)
    By cordgrass in forum AutoCAD Beginners' Area
    Replies: 11
    Last Post: 16th Jul 2009, 04:34 pm
  4. calculate distance between two lines thru lisp
    By vivekgrs in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 19th Jul 2006, 12:18 pm
  5. Distance between two lines
    By undoman in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 22nd Jun 2006, 06:58 am

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