Results 1 to 10 of 10

Thread: Get minimum distance from a point to point along the polyline

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

    Default Get minimum distance from a point to point along the polyline

    Hi guys...
    How to write a lisp that can get minimum distance from a point to any point along the polyline? Thanks.

  2. #2
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Get minimum distance from a point to point along the polyline

    Like so....
    Code:
    (setq pt (getpoint "\nPoint: "))
    (setq crvobj (car (entsel "\nSelect object: ")));can be any line, arc, pline, ellipse, spline
    (setq closestpt (vlax-curve-getclosestpointto crvobj pt))
    HTH,
    Jeff

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

    Cool Re: Get minimum distance from a point to point along the polyline

    Thanks for the code.
    Actually I want to find the closest intersection point along the polyline to a point (this point not along the polyline). How to write this lisp?

  4. #4
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Get minimum distance from a point to point along the polyline

    ????
    You want the nearest VERTEX, perhaps?

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

    Default Re: Get minimum distance from a point to point along the polyline

    I'm not sure about that but if you refer to my attached drawing, I’ve a problem to draw the green lines which are from insertion point of small rectangle to unknown point. Unknown point here means the point that is near to the intersection of orange line with the datch polyline like in the C_01.dwg but not touch each other. How to write the code so that can produce the green line like in the attached drawing? Really hope that you can help me…
    Attached Files Attached Files

  6. #6
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Get minimum distance from a point to point along the polyline

    I'm sorry, but I'm not sure this can be done without more information or input from the user. If it can be done, I'm sure not seeing it.

    Jeff

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

    Default Re: Get minimum distance from a point to point along the polyline

    FYI
    The ltg.lsp is the program that can draw the orange line by reading the data from csv file, cotxt.zip (cotxt.csv). From cotxt.scv: column A - text number refer to small rectangle, clumn B- text number refer to yellow circle, column C and D- x and y coordinates refer to centre point of small rectangle. I only have this information to draw the green lines.
    Attached Files Attached Files
    Last edited by noadea; 2007-02-14 at 04:38 AM.

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

    Default Re: Get minimum distance from a point to point along the polyline

    Any help would be much appreciated..

  9. #9
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    487
    Login to Give a bone
    0

    Default Re: Get minimum distance from a point to point along the polyline

    Code:
    (vl-load-com)
    ;;This function loads the extended AutoLISP functions
    ;;provided with Visual LISP. The Visual LISP extensions
    ;;implement ActiveX and AutoCAD reactor support through
    ;;AutoLISP, and also provide ActiveX utility and data
    ;;conversion functions, dictionary handling functions,
    ;;and curve measurement functions.
     
    
    
    ;;Function jwaGetDis
    ;;Returns the Distamce of a point on a curve (myPline)
    ;;that is nearest to the specified point(myPoint need to be in WCS)
    ;;myPline is the entiyname of a line, arc, pline, ellipse, spline
    
    (defun jwaGetDis( myPline myPoint)
    (distance (vlax-curve-getclosestpointto myPline mypoint) myPoint)
      )
    
    ;;use to test the jwaGetDis function
    ;;use the command jwaTestGetDis
    ;;will ask for a point
    ;;and a curve object
    ;;then run the jwaGetDis funtion
    
    (defun c:jwaTestGetDis()
      (setq pt (getpoint "\nPoint: "))
      (setq pline (car (entsel "\nSelect object: ")));can be any line, arc, pline, ellipse, spline
      (jwaGetDis pline pt)
    )
    Here a list of the Curve Object that can be use with the jwaGetDis funtion
    Note: it List the ADT Object thaty can be use
    AcDbCurve
    AcDb2dPolyline
    AcDb3dPolyline
    AcDbArc
    AcDbCircle
    AcDbEllipse
    AcDbLeader
    AcDbLine
    AcDbCommonEdgeLine
    AcDbPolyline
    AcDbRay
    AcDbSpline
    AcDbHelix
    AcDbXline
    AecDbEntity
    AecDbAnnotationBase
    AecDbBreakMarkObject
    AecDbCalloutObject
    AecDbTitleMarkObject
    AecDbDebugEnt
    AecDbGeo
    AecDb2dSection
    AecDbBlockRef
    AecDbEntRef
    AecDbMaskBlockRef
    AecDbMvBlockRef
    AecDbCamera
    AecDbClipVolRes
    AecDbBdgSection
    AecDbDisplayTheme
    AecDbEditInPlaceProfile
    AecDbLayoutTool
    AecDbCellLayoutTool
    AecDbGridAssembly
    AecDbCurtainWallLayout
    AecDbCurtainWallUnit
    AecDbWindowAssembly
    AecDbLayoutGrid2d
    AecDbCeilingGrid
    AecDbColumnGrid
    AecDbPolygon
    AecDbVolumeLayoutTool
    AecDbLayoutGrid3d
    AecDbSpace
    AecDbClipVol
    AecDbBdgElevLine
    AecDbBdgSectionLine
    AecDbLayoutCurve
    AecDbSlice
    AecsDbMember
    AecDbPoint
    AecDbMassElem
    AecDbMassGroup
    AecDbScheduleTable
    AecDbAddZoneDefinition
    AecDbOpeningBase
    AecDbOpenFiller
    AecDbDoor
    AecDbWindow
    AecDbOpening
    AecDbRailing
    AecDbRoof
    AecDbSlabBase
    AecDbRoofSlab
    AecDbSlab
    AecDbSpaceBoundary
    AecDbStair
    AecDbWall
    AecDbZone
    AecDbAddAreaGroupDefinition
    AecDbArea
    AecDbAreaGroup
    AecDbDimensionGroup
    AecDbKeyNoteLegendObject
    AecDbKeyNoteObject
    AecDbScheduleTagObject

  10. #10
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Get minimum distance from a point to point along the polyline

    Quote Originally Posted by rohaya.shaffini
    Hi guys...
    I am just curios rohaya.shaffini, are you a student or an employer ?

    : ) Happy Computing !

    kennet

Similar Threads

  1. Break to a certain distance from point
    By mbrandt5 in forum AutoLISP
    Replies: 2
    Last Post: 2015-08-03, 04:53 PM
  2. CV104-1P: One Point, Two Point, Red Point, Blue Point
    By Autodesk University in forum Civil Infrastructure
    Replies: 0
    Last Post: 2013-05-05, 03:17 AM
  3. Place a point on an object at a specified distance from another point.
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 4
    Last Post: 2012-03-22, 12:20 PM
  4. Replies: 11
    Last Post: 2007-10-17, 06:55 AM
  5. Get Distance from a Point to a Line?
    By KHADREE_SHARIFF in forum AutoLISP
    Replies: 4
    Last Post: 2007-04-14, 11:29 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
  •