Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Line on curved pline

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
antonijo
941 Views, 7 Replies

Line on curved pline

Hy,

 

I have three offset curved pline. On one mid pline need to drawing all line that can be put on curved pline, and satisfy the following conditions:
- lenght of line is 10 (units)
- line must be without intersection, tangent of any other offset pline.

7 REPLIES 7
Message 2 of 8
Kent1Cooper
in reply to: antonijo


@antonijo wrote:

Hy,

 

I have three offset curved pline. On one mid pline need to drawing all line that can be put on curved pline, and satisfy the following conditions:
- lenght of line is 10 (units)
- line must be without intersection, tangent of any other offset pline.



@antonijo wrote:

Hy,

 

I have three offset curved pline. On one mid pline need to drawing all line that can be put on curved pline, and satisfy the following conditions:
- lenght of line is 10 (units)
- line must be without intersection, tangent of any other offset pline.


An illustration would be helpful.

 

How precise does the 10-unit Line length need to be?  It would be easy to build something that would draw Lines between points that are 10 units apart along the path of the Polyline, but in areas of curvature, the resulting Lines would be shorter than 10 units -- how much shorter depends on the radius of the curvature.  To make the Lines themselves exactly 10 units long would, I think, be much more difficult.

 

Also, as with the locations of Points drawn by the Measure command, the space at the end will almost always be shorter than the rest.  It would be easy to have it draw Lines likewise [again, based on 10 unit spacings along the Polyline], but if the 10-unit length is a maximum, and you want them all the same length as close to 10 units as fills the overall length, I already have a routine that will do that as a line-segmented Polyline [which you can then Explode], if you're interested.

Kent Cooper, AIA
Message 3 of 8
antonijo
in reply to: Kent1Cooper

Of course it can examine the conditions every 5 or 10 units on pline. 

Precision can be run at the first decimal place (10.0 - 10.1).

 

An illustration is in attachment.

Message 4 of 8
CADaSchtroumpf
in reply to: antonijo

I don't known if I have understand very well, but I have make this for trace working drawing of clearing of lateral visibility of one way.

If can help you or inspired you...

 

(vl-load-com)
(defun c:clearing-lateral-visibility ( / js ldat vlaobj perim_obj pt_start pt_end d_x lst_pt pt_last inc vref rad pt pt_int e_last env_mask)
 (princ (strcat"\nSelect the object representing the edge of the way."))
 (while
  (not
   (setq js
    (ssget "_+.:E:S" 
     (list
      (cons 0 "*POLYLINE,ARC,SPLINE")
      (cons 67 (if (eq (getvar "CVPORT") 2) 0 1))
      (cons 410 (if (eq (getvar "CVPORT") 2) "Model" (getvar "CTAB")))
      (cons -4 "<NOT")
       (cons -4 "&") (cons 70 113) ;(70 . 121)
      (cons -4 "NOT>")
     )
    )
   )
  )
 )
 (setq
  ldat '((20 . 15.5)(30 . 26.5)(40 . 40.0)(50 . 55.0)(60 . 72.0)(70 . 95.0)(80 . 121.0)(90 . 151.0)(100 . 187.0))
  vlaobj (vlax-ename->vla-object (ssname js 0))
  perim_obj (vlax-curve-getDistAtParam vlaobj (vlax-curve-getEndParam vlaobj))
  pt_start (vlax-curve-getStartPoint vlaobj)
  pt_end (vlax-curve-getEndPoint vlaobj)
  d_x 0.0
  lst_pt nil
  pt_last nil
  env_mask (list pt_end)
  inc perim_obj
 )
 (initget "20 30 40 50 60 70 80 90 100")
 (setq vref (getkword "\nReference speed in Km / h of the way? [20/30/40/50/60/70/80/90/100]<90>: "))
 (if (not vref) (setq vref "90"))
 (setq rad (cdr (assoc (read vref) ldat)))
 (if (>= rad perim_obj) (progn (princ "\nThe distance of visibility exceeds the length of the band of the way!") (exit)))
 (while (>= inc perim_obj)
   (initget 6)
   (setq inc (getdist (strcat "\nEquidistance of resolution? <" (rtos (/ rad 10.0)) ">: ")))
   (if (not inc) (setq inc (/ rad 10.0)))
   (if (>= inc perim_obj) (princ "\nThe distance of visibility exceeds the length of the band of the way!"))
 )
 (while (< d_x perim_obj)
  (setq
   lst_pt (cons (vlax-curve-getPointAtDist vlaobj d_x) lst_pt)
   d_x (+ d_x inc)
  )
 )
 (while lst_pt
  (entmake
   (append
    '(
      (0 . "CIRCLE")
      (100 . "AcDbEntity")
      (67 . 0)
      (410 . "Model")
      (8 . "clearing-lateral-visibility")
      (60 . 1)
      (62 . 256)
      (6 . "ByLayer")
      (370 . -2)
      (100 . "AcDbCircle")
    )
    (list (cons 40 rad))
    (list (cons 10 (car lst_pt)))
    '((210 0.0 0.0 1.0))
   )
  )
  (setq pt (vlax-invoke vlaobj 'IntersectWith (vlax-ename->vla-object (entlast)) acExtendNone))
  (if (and pt pt_last (> (length pt) 3))
   (if (> (distance (list (car pt) (cadr pt) (caddr pt)) pt_last) (distance (list (cadddr pt) (car (cddddr pt)) (last pt)) pt_last))
    (setq pt (list (cadddr pt) (car (cddddr pt)) (last pt)))
    (setq pt (list (car pt) (cadr pt) (caddr pt)))
   )
  )
  (entdel (entlast))
  (if (and pt (<(length pt) 4))
   (progn
    (entmake
     (append
      '(
        (0 . "LINE")
        (100 . "AcDbEntity")
        (67 . 0)
        (410 . "Model")
        (8 . "clearing-lateral-visibility")
        (62 . 9)
        (6 . "ByLayer")
        (370 . -2)
        (100 . "AcDbLine")
      )
      (list (cons 10 (car lst_pt)))
      (list (cons 11 pt))
      '((210 0.0 0.0 1.0))
     )
    )
    (if e_last
     (progn
      (setq pt_int (vlax-invoke (vlax-ename->vla-object e_last) 'IntersectWith (vlax-ename->vla-object (entlast)) acExtendNone))
      (if pt_int (setq env_mask (cons pt_int env_mask)))
     )
    )
    (setq e_last (entlast))
   )
   (setq pt nil)
  )
  (setq lst_pt (cdr lst_pt) pt_last pt)
 )
 (setq env_mask (mapcar '(lambda (x) (list 10 (car x) (cadr x))) (reverse (cons pt_start env_mask))))
 (entmake
  (append
   '(
    (0 . "LWPOLYLINE")
    (100 . "AcDbEntity")
    (67 . 0)
    (410 . "Model")
    (8 . "clearing-lateral-visibility")
    (62 . 3)
    (6 . "ByLayer")
    (370 . -2)
    (100 . "AcDbPolyline")
   )
   (list (cons 90 (length env_mask)))
   '((70 . 0))
   (apply 'append (mapcar '(lambda (x10) (append (list x10 '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)))) env_mask))
   '((210 0.0 0.0 1.0))
  )
 ) 
 (prin1)
)

 

Message 5 of 8
antonijo
in reply to: CADaSchtroumpf

Very interesting, but it's good when you need to at all distances provide visibility with precisely defined length.

What I need is to establish only the parts where the visibility conditions are met (see in attachment - only blue line).

Message 6 of 8
Kent1Cooper
in reply to: antonijo


@antonijo wrote:

 

I have three offset curved pline. On one mid pline need to drawing all line that can be put on curved pline, and satisfy the following conditions:
- lenght of line is 10 (units)
- line must be without intersection, tangent of any other offset pline.


This seems to work, in limited testing.  It could use the usual additions [error handler, undo begin/end, command-echo suppression, blipmode suppression if needed], and could also be made to prompt the User for the Line length and/or stepping increment along the center-line Polyline, if either of those could vary.  But before adding those refinements, see whether it does what you're looking for.

Kent Cooper, AIA
Message 7 of 8
antonijo
in reply to: Kent1Cooper

Yes, this is that which I searched. 

It would be great if you could finalized.

Message 8 of 8
Kent1Cooper
in reply to: antonijo


@antonijo wrote:

Yes, this is that which I searched. 

It would be great if you could finalized.


All right -- I worked those refinements and some others in.  See the attached file.

 

It shows you the settings for View distance [sight-line length], Stepping [how often along the center-line Polyline to test], and Treatment of blocked sight-lines [whether to Delete them or Mark them with a different color and linetype], with initial defaults -- you can change any or all of those settings as desired, and it remembers your choices while you have the drawing open.  It asks you to select a center-line Polyline, and then as many potential view-blocking edge Polylines as you want.

 

See remarks in the code where you might want to change things such as the initial defaults, or the color and/or linetype it applies to blocked sight-lines if you choose to Mark them rather than Delete them.

 

I may later alter it so that it doesn't give up if you miss when picking the center-line Polyline, but asks you to pick again.  It could also be made to use a specific Layer for the Lines, rather than the current Layer, and/or to Mark blocked sightlines by putting them on a different Layer, rather than changing their color and linetype.

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost