Jump to content

DistanceInquiry.lsp (Dist replacement)


alanjt

Rate usefulness:  

15 members have voted

  1. 1. Rate usefulness:



Recommended Posts

Just as the title says. I hate the lack of functionality of Dist, so I decided the best thing was to roll my own.

 

The user also has the option to select certain objects, instead of just picking a point.

Current accepted objects: Civil 3D Points Land Desktop points, regular AutoCAD points, Circles, Arcs, Ellipses and Blocks. It will also allow elevation extraction from a selected Civil 3D surface. If you think of any additional objects that could/should be added, just say so.

 

Will work with all units.

 

See program header (below) for full information.

 

I think I have the units issue cleared up, but as I'm civil (don't use Arch. units) and American (we love our stupid Imperial) I can only give them limited testing.

 

Call with DistanceInquiry or D

 

Comments are welcome and greatly appreciated.

 

DistanceInquiry-02.16.10.PNG

 

DistanceInquiry2.1.gif

 

;;; ------------------------------------------------------------------------
;;;    DistanceInquiry.lsp v2.1
;;;
;;;    Copyright© 04.16.09
;;;    Alan J. Thompson (alanjt)
;;;
;;;    Contact: alanjt @ TheSwamp.org, CADTutor.net
;;;
;;;    Permission to use, copy, modify, and distribute this software
;;;    for any purpose and without fee is hereby granted, provided
;;;    that the above copyright notice appears in all copies and
;;;    that both that copyright notice and the limited warranty and
;;;    restricted rights notice below appear in all supporting
;;;    documentation.
;;;
;;;    The following program(s) are provided "as is" and with all faults.
;;;    Alan J. Thompson DOES NOT warrant that the operation of the program(s)
;;;    will be uninterrupted and/or error free.
;;;
;;;    Calculate horizontal & slope distance, bearing, delta X, Y & Z,
;;;    percent slope between two selected points and Northing & Easting
;;;    for picked points.
;;;
;;;    The following objects may be selected for X,Y,Z:
;;;    Arc, Block, Civil 3D Point, Civil 3D Surface, Circle, Ellipse,
;;;    Land Desktop Point, AutoCAD Point
;;;    * * If C3D surface is selected, user has option to pick point * *
;;;    * * within surface and the true elevation is extracted.       * *
;;;
;;;    Points and bearing are translated to World UCS.
;;;
;;;    * * * May be executed transparently * * *
;;;
;;;    Revision History:
;;;
;;;    v1.1 (04.23.09) 1. Added display of Delta X, Delta Z elevations, slope
;;;               distance and Northing & Easting for picked points.
;;;            2. Added subroutines: AT:Arrow and AT:Midpoint
;;;            3. If slope between points is found, direction of
;;;               flow is shown.
;;;
;;;    v1.2 (04.28.09) 1. Added display of points' elevations, if applicable.
;;;            2. Updated 'AT:Arrow' subroutine.
;;;            3. Added check for elevation calculations to see if
;;;               elevations for points are different.
;;;
;;;    v1.3 (05.04.09) 1. Added subroutine 'AT:PointSameXY' and check to see
;;;               if points are not at the same location, before
;;;               calculating any slope information.
;;;
;;;    v1.4 (05.12.09) 1. Added display of inquiry information with popup
;;;               window, using DosLib. If user has DosLib loaded,
;;;               information will display here aswell (must uncomment).
;;;
;;;    v1.5 (09.23.09) 1. Added display of inches for flat distance portion. *OMITTED v1.8a*
;;;
;;;    v1.6 (09.24.09) 1. Fixed issue with trying to set 'osnapz' on older versions.
;;;
;;;    v1.7 (09.24.09) 1. Added display of azimuth.
;;;
;;;    v1.8a(11.04.09) 1. Fixed (hopefully) coding to account for user units and luprec setttings.
;;;               Added subroutine _RToS to properly set Lunits and Luprec values.
;;;            2. Added subroutine AT:DrawX and will display red "X" at first picked point.
;;;            3. Updated *error* routine.
;;;            4. Removed v1.5 update (stupid idea).
;;;            5. Added subroutines _GetPoint and AT:Entsel, now user has option to select
;;;               an object in addition to picking a point.
;;;               Accepted objects: C3D points, Point, Circle, Block
;;;
;;;    v1.8b(11.17.09) 1. Added display of bearing in radians.
;;;
;;;    v1.8c(11.18.09) 1. Added option to select arcs (will use point at radius).
;;;
;;;    v1.9 (02.16.10) 1. Added Gradian display for angle between picked points.
;;;
;;;    v2.0 (04.04.10) 1. Updated AT:DrawX subroutine.
;;;            2. Added option to select an Ellipse (in addition to other objects).
;;;               Will use center point.
;;;            3. Fixed bug with running transparently.
;;;
;;;    v2.1 (05.24.10) 1. Added option to select Civil 3D surface and extract elevation.
;;;            2. Replaced subroutine AT:Entsel with _sel. Now connecting line
;;;               is drawn from first point to cursor (when in select mode).
;;;            3. When in select mode for second point, distance is dynamically
;;;               displayed at the status line.
;;;            4. Fixed bug with "X" at first point not being displayed when
;;;               in non-WCS.
;;;            5. Added option to select Land Desktop points.
;;;
;;; ------------------------------------------------------------------------

Also, for you DosLib users, if you uncomment this section, it will display a popup with the desired information at the bottom right of the screen.

 

dos_lib.PNG

 

     ;; print everything to commandline & user dos_lib if applicable
    (prompt #PromptString)

    [color=Red];;(and dos_traywnd (dos_traywnd "Distance Inquiry" #PromptString 360 100 "" 1500))[/color]

   )
 ) ;_ cond
 ;; reset everything
 (*error* nil)
 (princ)
) ;_ defun

Enjoy. :)

02.16.10: Updated to add Gradian display for angle.

04.04.10: See v2.0 revision notes.

05.24.10: See v2.1 revision notes.

 

DistanceInquiry.LSP

Edited by alanjt
Link to comment
Share on other sites

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    13

  • Brin

    2

  • noyjoreb

    2

  • stevesfr

    1

Top Posters In This Topic

Posted Images

Hi Alan,

Thanks for linking me to here, This gives what I was after in the other post and also other options I hadnt thought off!

 

How does it select the block? is it a case of having the Osnap to insertion?

 

Brin

Link to comment
Share on other sites

How can the slope be greater than 100%? (which is true vertical, one point above the other). Also probably should label distance as H-distance (true horizontal distance vs. slope distance).

Slope can be greater than 100%, what was I thinking of anyway ?? I guess I'm retarded now !

A.T. weren't you supposed to be working on something else while the young one was sleeping??

S

 

I'm almost finished with it, I have fixed/added a few options and added circles. I just need to fix the units. I forgot we were going to the zoo the next day, so I had to help load the car and get things ready. Kind of set me back. If you like, I'll email you what I have so far, but I don't want to post it just yet. You're Imperial, so it will be fine for you.

Link to comment
Share on other sites

Hi Alan,

Thanks for linking me to here, This gives what I was after in the other post and also other options I hadnt thought off!

 

How does it select the block? is it a case of having the Osnap to insertion?

 

Brin

:) Hope it helps. Are you going to attempt your own, or just use this one?

 

It extracts the X,Y,Z of the insertion point. For a circle, it take the center point.

Link to comment
Share on other sites

Slope can be greater than 100%, what was I thinking of anyway ?? I guess I'm retarded now !

 

Don't sweat it, you actually had me going back and checking all my stuff. I was sure I wasn't wrong. :)

Link to comment
Share on other sites

:) Hope it helps. Are you going to attempt your own, or just use this one?

 

hehe, Im going to attempt my own at some point, but as you have done all the hard work I will use this one for now ;o)

Link to comment
Share on other sites

I'm almost finished with it, I have fixed/added a few options and added circles. I just need to fix the units. I forgot we were going to the zoo the next day, so I had to help load the car and get things ready. Kind of set me back. If you like, I'll email you what I have so far, but I don't want to post it just yet. You're Imperial, so it will be fine for you.

 

 

I understand... I can wait for the post here.

Link to comment
Share on other sites

hehe, Im going to attempt my own at some point, but as you have done all the hard work I will use this one for now ;o)

:) I think it gives everything you were asking for. I'm not sure there's anything else I can add, but I'm sure I or someone else will come up with something.

Link to comment
Share on other sites

  • 2 months later...
:) I think it gives everything you were asking for. I'm not sure there's anything else I can add, but I'm sure I or someone else will come up with something.

 

Hi

Very useful lisp, great job you did, but I'm asking how can i change angle units into Grads ,and also the slope to be displayed in grads that 'll be very useful for me , if u are willing to help me with this, cause i don't have any lisp routine knowledge. thanks

Link to comment
Share on other sites

Hi

Very useful lisp, great job you did, but I'm asking how can i change angle units into Grads ,and also the slope to be displayed in grads that 'll be very useful for me , if u are willing to help me with this, cause i don't have any lisp routine knowledge. thanks

 

Been pretty busy this semester, but I'll do my best to do something this weekend. Not a complicated addition, so it shouldn't take me too terrible long.

Link to comment
Share on other sites

  • 1 month later...

Made a few updates and forgot to post...

 

;;;    v2.0 (04.04.10) 1. Updated AT:DrawX subroutine.
;;;            2. Added option to select an Ellipse (in addition to other objects).
;;;               Will use center point.
;;;            3. Fixed bug with running transparently.

Link to comment
Share on other sites

  • 2 weeks later...

i tried your lisp routine, Distance Inquiry, and I observe that the azimuth angle is from from east... If im not wrong, the azimuth of a line is always from south... sori if im wrong... tnx. and another suggestion. can u pls put the result in a table? separated in a column? tnx...

Link to comment
Share on other sites

i tried your lisp routine, Distance Inquiry, and I observe that the azimuth angle is from from east... If im not wrong, the azimuth of a line is always from south... sori if im wrong... tnx. and another suggestion.

I matched it to what AutoCAD returns. Many things are different between AutoCAD and Trigonometry, in respect to angles (eg. quadrants, direction).

 

Here's a comparison of the Dist command and DistanceInquiry:

Command: di
DIST Specify first point: _cen of  Specify second point: _cen of
Distance = 47.2687,  [color=Red]Angle in XY Plane = 19d40'56"[/color],  Angle from XY Plane = 
0d0'0"
Delta X = 44.5071,  Delta Y = 15.9202,   Delta Z = 0.0000

Command: d

Specify first point [select]: _cen of
Specify next point [select]: _cen of
-------------------------------------------------------
Delta X: 44.5071, Delta Y: 15.9202, Delta Z: 0
From: N=-288.4903, E=-551.2263 -> To: N=-272.5701, E=-506.7192
Rad: 0.343519, [color=Red]Azm: 19d40'56"[/color], Grad: 21.8691g, Bear: N 70d19'4" E, Dist: 47.2687

 

 

can u pls put the result in a table? separated in a column? tnx...

This is a replacement for the DIST command. It's an inquiry device. Results printed to anything other than the screen would hinder normal use (additional prompts) of the program. What you are asking is a completely is a completely different thing.

Link to comment
Share on other sites

  • 3 weeks later...
hi alanjt, is it posible that the result will be place inside the table with its own column? tnx...

 

..........

 

This is a replacement for the DIST command. It's an inquiry device. Results printed to anything other than the screen would hinder normal use (additional prompts) of the program. What you are asking is a completely is a completely different thing.

Link to comment
Share on other sites

Update with many new additions.

 

;;;    v2.1 (05.24.10) 1. Added option to select Civil 3D surface and extract elevation.
;;;            2. Replaced subroutine AT:Entsel with _sel. Now connecting line
;;;               is drawn from first point to cursor (when in select mode).
;;;            3. When in select mode for second point, distance is dynamically
;;;               displayed at the status line.
;;;            4. Fixed bug with "X" at first point not being displayed when
;;;               in non-WCS.
;;;            5. Added option to select Land Desktop points.

Link to comment
Share on other sites

  • 1 year later...
Just as the title says. I hate the lack of functionality of Dist, so I decided the best thing was to roll my own.

 

The user also has the option to select certain objects, instead of just picking a point.

Current accepted objects: Civil 3D Points Land Desktop points, regular AutoCAD points, Circles, Arcs, Ellipses and Blocks. It will also allow elevation extraction from a selected Civil 3D surface. If you think of any additional objects that could/should be added, just say so.

 

Will work with all units.

 

See program header (below) for full information.

 

I think I have the units issue cleared up, but as I'm civil (don't use Arch. units) and American (we love our stupid Imperial) I can only give them limited testing.

 

Call with DistanceInquiry or D

 

Comments are welcome and greatly appreciated.

 

[ATTACH]17392[/ATTACH]

 

DistanceInquiry2.1.gif

 

;;; ------------------------------------------------------------------------
;;;    DistanceInquiry.lsp v2.1
;;;
;;;    Copyright© 04.16.09
;;;    Alan J. Thompson (alanjt)
;;;
;;;    Contact: alanjt @ TheSwamp.org, CADTutor.net
;;;
;;;    Permission to use, copy, modify, and distribute this software
;;;    for any purpose and without fee is hereby granted, provided
;;;    that the above copyright notice appears in all copies and
;;;    that both that copyright notice and the limited warranty and
;;;    restricted rights notice below appear in all supporting
;;;    documentation.
;;;
;;;    The following program(s) are provided "as is" and with all faults.
;;;    Alan J. Thompson DOES NOT warrant that the operation of the program(s)
;;;    will be uninterrupted and/or error free.
;;;
;;;    Calculate horizontal & slope distance, bearing, delta X, Y & Z,
;;;    percent slope between two selected points and Northing & Easting
;;;    for picked points.
;;;
;;;    The following objects may be selected for X,Y,Z:
;;;    Arc, Block, Civil 3D Point, Civil 3D Surface, Circle, Ellipse,
;;;    Land Desktop Point, AutoCAD Point
;;;    * * If C3D surface is selected, user has option to pick point * *
;;;    * * within surface and the true elevation is extracted.       * *
;;;
;;;    Points and bearing are translated to World UCS.
;;;
;;;    * * * May be executed transparently * * *
;;;
;;;    Revision History:
;;;
;;;    v1.1 (04.23.09) 1. Added display of Delta X, Delta Z elevations, slope
;;;               distance and Northing & Easting for picked points.
;;;            2. Added subroutines: AT:Arrow and AT:Midpoint
;;;            3. If slope between points is found, direction of
;;;               flow is shown.
;;;
;;;    v1.2 (04.28.09) 1. Added display of points' elevations, if applicable.
;;;            2. Updated 'AT:Arrow' subroutine.
;;;            3. Added check for elevation calculations to see if
;;;               elevations for points are different.
;;;
;;;    v1.3 (05.04.09) 1. Added subroutine 'AT:PointSameXY' and check to see
;;;               if points are not at the same location, before
;;;               calculating any slope information.
;;;
;;;    v1.4 (05.12.09) 1. Added display of inquiry information with popup
;;;               window, using DosLib. If user has DosLib loaded,
;;;               information will display here aswell (must uncomment).
;;;
;;;    v1.5 (09.23.09) 1. Added display of inches for flat distance portion. *OMITTED v1.8a*
;;;
;;;    v1.6 (09.24.09) 1. Fixed issue with trying to set 'osnapz' on older versions.
;;;
;;;    v1.7 (09.24.09) 1. Added display of azimuth.
;;;
;;;    v1.8a(11.04.09) 1. Fixed (hopefully) coding to account for user units and luprec setttings.
;;;               Added subroutine _RToS to properly set Lunits and Luprec values.
;;;            2. Added subroutine AT:DrawX and will display red "X" at first picked point.
;;;            3. Updated *error* routine.
;;;            4. Removed v1.5 update (stupid idea).
;;;            5. Added subroutines _GetPoint and AT:Entsel, now user has option to select
;;;               an object in addition to picking a point.
;;;               Accepted objects: C3D points, Point, Circle, Block
;;;
;;;    v1.8b(11.17.09) 1. Added display of bearing in radians.
;;;
;;;    v1.8c(11.18.09) 1. Added option to select arcs (will use point at radius).
;;;
;;;    v1.9 (02.16.10) 1. Added Gradian display for angle between picked points.
;;;
;;;    v2.0 (04.04.10) 1. Updated AT:DrawX subroutine.
;;;            2. Added option to select an Ellipse (in addition to other objects).
;;;               Will use center point.
;;;            3. Fixed bug with running transparently.
;;;
;;;    v2.1 (05.24.10) 1. Added option to select Civil 3D surface and extract elevation.
;;;            2. Replaced subroutine AT:Entsel with _sel. Now connecting line
;;;               is drawn from first point to cursor (when in select mode).
;;;            3. When in select mode for second point, distance is dynamically
;;;               displayed at the status line.
;;;            4. Fixed bug with "X" at first point not being displayed when
;;;               in non-WCS.
;;;            5. Added option to select Land Desktop points.
;;;
;;; ------------------------------------------------------------------------

Also, for you DosLib users, if you uncomment this section, it will display a popup with the desired information at the bottom right of the screen.

 

[ATTACH]15654[/ATTACH]

 

     ;; print everything to commandline & user dos_lib if applicable
    (prompt #PromptString)

    [color=Red];;(and dos_traywnd (dos_traywnd "Distance Inquiry" #PromptString 360 100 "" 1500))[/color]

   )
 ) ;_ cond
 ;; reset everything
 (*error* nil)
 (princ)
) ;_ defun

Enjoy. :)

02.16.10: Updated to add Gradian display for angle.

04.04.10: See v2.0 revision notes.

05.24.10: See v2.1 revision notes.

 

 

Please forgive my ignorance. Is v2.1 still available? It appears the code is only comments, and I see no attachment.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...