Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: distance and offset along a polyline

  1. #1
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default distance and offset along a polyline

    I am trying to create a routine that will allow the user to select a polyline, and its start point, then have the lisp routine automate creating text that specifies the distance from the beginning of the polyline and the offset from the polyline of a point that contains an attribute. This part of the routine is the step prior to my other post on replacing text in a drawing, it is the step that will create the text.

    If at all possible I would like to have the "X" coordinate of the text insert to be = to the distance from the start point, with a specific "y" coordinate and if the text will overlap, specify a minimum distance apart for the next text object.

    The main points that I need help with is getting the information, and then actually creating the text object. I am not sure how to create something from nothing, the only thing up to this point that I have ever been able to do is edit something that already exists.

    any help is greatly appreciated.

  2. #2
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: distance and offset along a polyline

    sounds like you are trying to do something like LDT does with alignments and station labels?

  3. #3
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: distance and offset along a polyline

    that is exactly what I am trying to do, except I am using vanilla AutoCAD, we dont have LDT and as far as I know my office has no plans to leave Eagle Point. we have a program that does this already, but it doesn't work the way I would like it to. and it is written very poorly so I dont want to use any of it, I figured it would be easier to start from scratch.

  4. #4
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: distance and offset along a polyline

    sounds like you could do a modified measure command that will use the spacing you define to measure at, the distance and incrementally add that to every block suscinctly

  5. #5
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: distance and offset along a polyline

    no, that wouldn't work, the points are already in the drawing and not specific distances from the start of the polyline, measure would be more for a set distance apart, as for the placement of the text, I will know the y coordinate, for x I would just use a logic test to determine if they are too close together

    Code:
     
    (if (< (- x1 x2) (* 0.5 Textheight))
     (setq x2 (+ (* 0.5 Textheight) x1))
    )

  6. #6
    I could stop if I wanted to Hammer.John.J's Avatar
    Join Date
    2015-09
    Location
    Springfield, MA
    Posts
    491
    Login to Give a bone
    0

    Default Re: distance and offset along a polyline

    sounds like after all the few posts i've read from ya that you need civil 3d or ldt because it does all of this stuff you are doing through customization.

    eagle point is ok for landscaping but thats about the only use i found for it.

  7. #7
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: distance and offset along a polyline

    well, my company has no plans to switch, I would prefer that they would, so I have to deal with what I have. The program can be written, I just need to know how to collect the data I need, and create a text object.

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

    Default Re: distance and offset along a polyline

    Quote Originally Posted by ccowgill
    well, my company has no plans to switch, I would prefer that they would, so I have to deal with what I have. The program can be written, I just need to know how to collect the data I need, and create a text object.
    Here's a couple of posts for creating the text object. One is for MTEXT and the other for TEXT.

    RE: Create MTEXT with Lisp

    RE: Help with an &quot;entmake&quot; routine

    Now all we need to do is collect the data.
    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

  9. #9
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: distance and offset along a polyline

    I think the one for single text will work, I just need to adjust it for what I want, It is a good starting off point, hopefully someone will help out with the collection of the data part today, so I can try to get a working program by Tuesday, or at least more questions

  10. #10
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: distance and offset along a polyline

    Chris,
    Do you have pseudo code?
    Do you have some code worked out?

    Show us what you have so far.

    In the learning stages you should, in my opinion, use this method.

    Create pseudo code and add ;; for each line.
    Then add the code segments to accomplish that task.
    As you develop the routine the code will evolve & may change location.
    That's ok, it's part of the process. Most of my first lisp were cut & paste of code I borrowed from other routines.
    That's ok too, it's a way to use a working piece of code to get you started.

    Turn your general request into pseudo code
    I am trying to create a routine that will allow the user to select a
    polyline, and its start point, then have the lisp routine automate creating text
    that specifies the distance from the beginning of the polyline and the offset
    from the polyline of a point that contains an attribute. This part of the
    routine is the step prior to my other post on replacing text in a drawing, it is
    the step that will create the text.
    Select a polyline
    Pick end point of ployline
    Get distance from select point to pick point


    Then be more specific about your goal

    Select ONLY polyline
    Pick end point of THE SELECTED ployline
    Get distance ALONG THE POLYLINE from select point to pick point


    These are important details that will clarify the goal of the routine.
    I assume they are implied but we all have a different perspective of the problem.

    Code:
    (defun c:MyRoutine ()
      ;; Select ONLY polyline
      ;;   Note, need to trap ENTER
      (prompt "\nSelect a polyline.")
      (setq ss (ssget "+.:E:S" '((0 . "LWPOLYLINE,POLYLINE"))))
      (setq ename (ssname ss 0)))
      ;; Pick end point of THE SELECTED ployline
      ;;   Note, need to trap ENTER and missed endpoint of matching pline
      (setq pt (getpoint "\nPick the endpoint of the polyline."))
      ;; Get distance ALONG THE POLYLINE from select point to pick point
      ;;  Note, use vlax-curve-getDistAtPoint but to use it we need to determine
      ;;  if the picked point is the END or START of the pline
      
      (princ)
    )
    Your turn.
    Last edited by CAB2k; 2006-05-26 at 02:32 PM.

Page 1 of 2 12 LastLast

Similar Threads

  1. Reset Offset Distance
    By Wish List System in forum AutoCAD Wish List
    Replies: 5
    Last Post: 2020-01-17, 04:50 PM
  2. LISP to offset polyline an increasing distance
    By dooley1971392018 in forum AutoLISP
    Replies: 0
    Last Post: 2015-03-25, 12:05 AM
  3. OFFSET WITH 20% OF MEASURED DISTANCE.
    By aijazahmed in forum AutoLISP
    Replies: 3
    Last Post: 2014-06-05, 04:12 PM
  4. 2010: Offset Distance
    By lswinea in forum AutoCAD General
    Replies: 2
    Last Post: 2011-10-18, 01:35 AM
  5. Replies: 0
    Last Post: 2011-10-11, 08:38 AM

Posting Permissions

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