+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
  1. #1
    Junior Member
    Using
    AutoCAD 2016
    Join Date
    Oct 2017
    Posts
    23

    Default Distance between lines

    Registered forum members do not see this ad.

    Need a lisp that would calculate distance between lines in a map and place it at the center of each lines.

    I need to select all the lines at once instead of selecting each line one by one.

    Regards,
    lucky9

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

    Default

    Now where is the crystal ball so I can see what you want.


    Please post a dwg or image.
    A man who never made mistakes never made anything

  3. #3
    Junior Member
    Using
    AutoCAD 2016
    Join Date
    Oct 2017
    Posts
    23

    Default

    Sample Drawing is attached for your reference..
    it would be nice if the lengths are placed similar as it is shown in the drawing.


    thanks
    Attached Files

  4. #4
    Super Member hanhphuc's Avatar
    Using
    AutoCAD 2007
    Join Date
    Apr 2013
    Location
    Happy Garden
    Posts
    722

    Default

    hi you should ask lisp question in
    AutoLISP forum

    Code:
    (defun c:test (/ en d p p2 tx1 tx2)
      (setvar 'dimasz 15)
      (while (setq en (car (entsel "\nPick polyline.. ")))
        (and (wcmatch (cdr(assoc 0 (entget en))) "*LINE")
    	 (setq d   (vlax-curve-getdistatpoint en (vlax-curve-getendpoint en))
    	       p   (vlax-curve-getpointatdist en (* d 0.5))
    	       tx1 "100MM %%C" 
    	       tx2 (strcat "L=" (rtos d 2 0) "M")
    	       p2  (if (and pointer:marker msg:pointer) (msg:pointer (list (trans p 0 1)) 1 (strcat tx1 "\\P" tx2))
    		     (getpoint p "\nSpecific next point.. "))
    	       )
    	 
    	 (vl-cmdf "_leader" "_non" (trans p 0 1) "_non" p2 "" tx1 tx2 "")
    	)
        )
      (princ)
      )
    visual utility
    msg:pointer

    p/s: @BIGAL i noticed you were offline while the OP was online my quick reply didn't mean to hijack.
    Last edited by hanhphuc; 12th Jun 2018 at 08:46 am. Reason: (trans p 0 1)
    _$ ( apply 'equal "hp" "happy" "hạnh phúc" "ハッピー" "幸福" "행복" )
    ; error: too many arguments

  5. #5
    Junior Member
    Using
    AutoCAD 2016
    Join Date
    Oct 2017
    Posts
    23

    Default

    Hi there , I tried your solution when selecting the polyline it does nothing.

    here is a screen capture.




    Btw, I post the question in wrong section by mistake if any mod would move this post to the right section would be appreciated.

    Thanks

  6. #6
    Super Member hanhphuc's Avatar
    Using
    AutoCAD 2007
    Join Date
    Apr 2013
    Location
    Happy Garden
    Posts
    722

    Default

    Quote Originally Posted by lucky9 View Post
    Hi there , I tried your solution when selecting the polyline it does nothing.

    here is a screen capture.

    Btw, I post the question in wrong section by mistake if any mod would move this post to the right section would be appreciated.

    Thanks
    did you download the visual utility link provided ?
    missing routine?
    pointer:marker
    msg:pointer

    i edited previous post, try it still can run without these visual utilities.
    please retry


    _$ ( apply 'equal "hp" "happy" "hạnh phúc" "ハッピー" "幸福" "행복" )
    ; error: too many arguments

  7. #7
    Junior Member
    Using
    AutoCAD 2016
    Join Date
    Oct 2017
    Posts
    23

    Default

    Quote Originally Posted by hanhphuc View Post
    did you download the visual utility link provided ?
    missing routine?
    pointer:marker
    msg:pointer

    i edited previous post, try it still can run without these visual utilities.
    please retry


    I didn't download it ,

    are you referring to msg:pointer code?

    Awesome !
    Thanks

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

    Default

    Hanhphuc I would use the simple check for a library routine. I like the look of the pointer code will have a closer look.

    Code:
    (if (not msg:pointer)(Load "msg-pointer")) ; save lisp as say msg-pointer
    A man who never made mistakes never made anything

  9. #9
    Super Member hanhphuc's Avatar
    Using
    AutoCAD 2007
    Join Date
    Apr 2013
    Location
    Happy Garden
    Posts
    722

    Default

    Quote Originally Posted by BIGAL View Post
    Hanhphuc I would use the simple check for a library routine. I like the look of the pointer code will have a closer look.

    Code:
    (if (not msg:pointer)(Load "msg-pointer")) ; save lisp as say msg-pointer
    Thanks BIGAL it makes sense, if OP keeps this sub different file
    _$ ( apply 'equal "hp" "happy" "hạnh phúc" "ハッピー" "幸福" "행복" )
    ; error: too many arguments

  10. #10
    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,108

    Default

    Registered forum members do not see this ad.

    I have moved your thread to the AutoLISP, Visual LISP & DCL Forum. Please post in the most relevant Forum.
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



Similar Threads

  1. finding distance between offset lines
    By fisher22 in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 6th Jul 2011, 06:40 pm
  2. distance between points in lines ?
    By yajis_narif in forum AutoLISP, Visual LISP & DCL
    Replies: 22
    Last Post: 22nd May 2011, 09:20 pm
  3. [VBA/Autocad]The shortest distance between two lines
    By lubracali in forum .NET, ObjectARX & VBA
    Replies: 7
    Last Post: 8th Feb 2011, 03:29 am
  4. lines (bearing/distance)
    By cordgrass in forum AutoCAD Beginners' Area
    Replies: 11
    Last Post: 16th Jul 2009, 04:34 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