CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 12931
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedDetermine Distance Between Points On An Entity

 Post Reply Post Reply
Author
utkub View Drop Down
Newbie
Newbie


Joined: 17.Aug.2017
Location: Turkey
Using: AutoCAD2016
Status: Offline
Points: 2
Direct Link To This Post Topic: Determine Distance Between Points On An Entity
    Posted: 18.Aug.2017 at 00:39
Hi everyone,

Attached lisp is writen by Alan Thompson and then modifed by another developer.

This lisp calculates the distance between two points along an object (line, circle, arc, polyline, spline, etc.) and writes the distance on second point.

But it takes too much time while using this lisp for 2 or more times on same object. Because you have to restart the procedure for each point pair.

Can this lisp upgradeable like this;
  1. first, we will choose a start point on an object,
  2. then lisp will write the distance which is between start point and n'th point, on n'th point.

So we will choose start point only once and then lisp will write the distance on all next points which we click on the object.

Thanks for help,

Back to Top
Kent Cooper View Drop Down
Senior Member
Senior Member


Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2020, 2023
Status: Offline
Points: 616
Direct Link To This Post Posted: 23.Aug.2017 at 18:01
Something like this, perhaps:

(vl-load-com)
(defun C:MDFR (/ esel path refdist pt); = Mark Distance(s) From Reference location
  (setq
    esel (entsel "\nSelect object at reference location: ")
    path (car esel)
    refdist (vlax-curve-getDistAtPoint path (vlax-curve-getClosestPointTo path (cadr esel)))
  ); setq
  (while
    (setq pt (getpoint "\nLocation to mark distance from reference: "))
    (command "_.text" ; current Layer & other properties -- could do Mtext instead
      "_mc" "_none" (vlax-curve-getClosestPointTo path pt); middle-center justification
      "" 0 ; current non-fixed-height Style, current height, 0 rotation
      (rtos (abs (- (vlax-curve-getDistAtPoint path ins) refdist))); in current units format & precision
    ); command
  ); while
);defun

It is minimally tested, and assumes certain things, which you can adjust for as you prefer.

It does not have the usual controls yet [error handling, verification that you picked an object that has distance along it, or that subsequent picks are along the same object, Undo start/end, etc.], but see what you think.


Edited by Kent Cooper - 23.Aug.2017 at 19:50
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,320 seconds.