Results 1 to 3 of 3

Thread: Show Distance between two lines at fixed intervals

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2015-09
    Posts
    1
    Login to Give a bone
    0

    Default Show Distance between two lines at fixed intervals

    Hi,

    I have a project where a cable is laid along a road. I need to show the perpendicular distance of the cable from the road centerline at every 10m interval. I cannot do it manually as the cable length is in 100s of kms. I have been using autocad for a long time but am new to LISP.

    Is there a LISP code that can do this?

    Please help.

    Thanks

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: Show Distance between two lines at fixed intervals

    Are you using standard AutoCAD? Or are you using any verticals, such as Civil 3D?
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    555
    Login to Give a bone
    0

    Default Re: Show Distance between two lines at fixed intervals

    This is something I just did similar
    Code:
    (defun c:pegsh ( / obj obj2 inc olen num lstch newpt pt len len2)
    (setq obj (vlax-ename->vla-object (car (entsel "Pick peg line"))))
    (setq obj2 (vlax-ename->vla-object (car (entsel "pick offset line"))))
    
    (setq olen (vla-get-length obj2))
    
    (setq inc (getreal "Enter your increment"))
    (setq num (fix (/ olen inc)))
    (setq lstch (list 0.0)) ; accept 1st pointc
    (setq ch 0.0)
    (repeat num
    (setq lstch (cons (setq ch (+ ch inc)) lstch))
    )
    (setq lstch (cons olen lstch))
    ; add later vertice points to lstch then sort ch's
    
    (repeat (setq x (length lstch))
    (setq pt (vlax-curve-getpointatdist obj2 (nth (setq x (- x 1)) lstch)))
    (setq newPt (vlax-curve-getClosestPointTo Obj Pt))
    (setq len (vlax-curve-getdistatpoint obj newpt))
    (setq len2 (distance newpt pt))
    (command "line" newpt pt "") ; dummy to see something
    (alert (strcat "The ch is " (rtos len 2 2) "\n\nOffset is " (rtos len2 2 2))) ; dummy to see something
    )
    )
    Last edited by BIG-AL; 2016-05-09 at 05:54 AM. Reason: code updated now works

Similar Threads

  1. 2013: Ceiling-Based Hanging Fixtures, Fixed Distance From Floor Without Adjusting Each Fixture - Possible?
    By architecture381746 in forum Revit Architecture - Families
    Replies: 4
    Last Post: 2013-05-22, 05:00 PM
  2. Curtain wall with fixed vertical distance
    By nextvkin in forum Revit Architecture - General
    Replies: 5
    Last Post: 2011-08-29, 11:24 PM
  3. Distance between Dim Lines?
    By Dave Jones in forum Revit Architecture - General
    Replies: 15
    Last Post: 2010-07-07, 11:00 PM
  4. Distance between lines
    By climber65 in forum AutoCAD General
    Replies: 7
    Last Post: 2008-03-06, 04:25 PM
  5. Ceiling light fixtures a fixed distance above the floor
    By sven.129574 in forum Revit Architecture - General
    Replies: 0
    Last Post: 2006-12-19, 06:11 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •