Jump to content

measure distance between polylines


phoenix2009

Recommended Posts

  • 5 months later...
  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • phoenix2009

    10

  • Lee Mac

    7

  • irneb

    5

  • zamri_uut

    3

Top Posters In This Topic

Posted Images

Try this modification:

([color=BLUE]defun[/color] c:test ( [color=BLUE]/[/color] a1 d1 d2 d3 e1 e2 p1 p2 sp xl zv )
   ([color=BLUE]if[/color]
       ([color=BLUE]and[/color]
           ([color=BLUE]setq[/color] e1 (LM:ssget [color=MAROON]"\nSelect 1st Polyline: "[/color] '([color=MAROON]"_+.:E:S"[/color] ((0 . [color=MAROON]"LWPOLYLINE"[/color])))))
           ([color=BLUE]setq[/color] e2 (LM:ssget [color=MAROON]"\nSelect 2nd Polyline: "[/color] '([color=MAROON]"_+.:E:S"[/color] ((0 . [color=MAROON]"LWPOLYLINE"[/color])))))
           ([color=BLUE]progn[/color]
               ([color=BLUE]initget[/color] 6)
               ([color=BLUE]setq[/color] d1 ([color=BLUE]getdist[/color]  [color=MAROON]"\nSpecify Step Distance: "[/color]))
           )
       )
       ([color=BLUE]progn[/color]
           ([color=BLUE]setq[/color] d3 ([color=BLUE]-[/color] d1)
                 e1 ([color=BLUE]ssname[/color] e1 0)
                 e2 ([color=BLUE]vlax-ename->vla-object[/color] ([color=BLUE]ssname[/color] e2 0))
                 d2 ([color=BLUE]vlax-curve-getdistatparam[/color] e1 ([color=BLUE]vlax-curve-getendparam[/color] e1))
                 zv ([color=BLUE]trans[/color] '(0.0 0.0 1.0) 1 0 [color=BLUE]t[/color])
                 sp ([color=BLUE]vlax-get-property[/color] ([color=BLUE]vla-get-activedocument[/color] ([color=BLUE]vlax-get-acad-object[/color]))
                        ([color=BLUE]if[/color] ([color=BLUE]=[/color] 1 ([color=BLUE]getvar[/color] 'cvport)) 'paperspace 'modelspace)
                    )
           )
           ([color=BLUE]while[/color] ([color=BLUE]<=[/color] ([color=BLUE]setq[/color] d3 ([color=BLUE]+[/color] d3 d1)) d2)
               ([color=BLUE]setq[/color] p1 ([color=BLUE]vlax-curve-getpointatdist[/color] e1 d3)
                     a1 ([color=BLUE]-[/color] ([color=BLUE]angle[/color] '(0.0 0.0) ([color=BLUE]trans[/color] ([color=BLUE]vlax-curve-getfirstderiv[/color] e1 ([color=BLUE]vlax-curve-getparamatpoint[/color] e1 p1)) 0 1)) ([color=BLUE]/[/color] [color=BLUE]pi[/color] 2.0))
                     xl ([color=BLUE]vlax-invoke[/color] sp 'addxline p1 ([color=BLUE]trans[/color] ([color=BLUE]polar[/color] ([color=BLUE]trans[/color] p1 0 1) a1 1.0) 1 0))
               )
               ([color=BLUE]if[/color]
                   ([color=BLUE]setq[/color] p2
                       ([color=BLUE]car[/color]
                           ([color=BLUE]vl-sort[/color] (LM:group3 ([color=BLUE]vlax-invoke[/color] xl 'intersectwith e2 [color=BLUE]acextendthisentity[/color]))
                              '([color=BLUE]lambda[/color] ( a b ) ([color=BLUE]<[/color] ([color=BLUE]distance[/color] a p1) ([color=BLUE]distance[/color] b p1)))
                           )
                       )
                   )
                   ([color=BLUE]progn[/color]
                       ([color=BLUE]entmake[/color] ([color=BLUE]list[/color] '(0 . [color=MAROON]"LINE"[/color]) ([color=BLUE]cons[/color] 10 p1) ([color=BLUE]cons[/color] 11 p2)))
                       ([color=BLUE]entmake[/color]
                           ([color=BLUE]list[/color]
                              '(0 . [color=MAROON]"TEXT"[/color])
                               ([color=BLUE]cons[/color] 10 ([color=BLUE]trans[/color] p1 0 zv))
                               ([color=BLUE]cons[/color] 11 ([color=BLUE]trans[/color] p1 0 zv))
                               ([color=BLUE]cons[/color] 50 ([color=BLUE]+[/color] a1 ([color=BLUE]angle[/color] '(0.0 0.0) ([color=BLUE]trans[/color] ([color=BLUE]getvar[/color] 'ucsxdir) 0 zv [color=BLUE]t[/color]))))
                               ([color=BLUE]cons[/color] 40 ([color=BLUE]getvar[/color] 'textsize))
                               ([color=BLUE]cons[/color] 07 ([color=BLUE]getvar[/color] 'textstyle))
                               ([color=BLUE]cons[/color] 01 ([color=BLUE]strcat[/color] [color=MAROON]"L="[/color] ([color=BLUE]rtos[/color] ([color=BLUE]distance[/color] p1 p2) 2) [color=MAROON]"m"[/color]))
                              '(72 . 0)
                              '(73 . 2)
                               ([color=BLUE]cons[/color] 210 zv)
                           )
                       )
                   )                                
               )
               ([color=BLUE]vla-delete[/color] xl)
           )
       )
   )
   ([color=BLUE]princ[/color])
)

([color=BLUE]defun[/color] LM:group3 ( lst [color=BLUE]/[/color] rtn )
   ([color=BLUE]repeat[/color] ([color=BLUE]/[/color] ([color=BLUE]length[/color] lst) 3)
       ([color=BLUE]setq[/color] rtn ([color=BLUE]cons[/color] ([color=BLUE]list[/color] ([color=BLUE]car[/color] lst) ([color=BLUE]cadr[/color] lst) ([color=BLUE]caddr[/color] lst)) rtn)
             lst ([color=BLUE]cdddr[/color] lst)
       )
   )
   ([color=BLUE]reverse[/color] rtn)
)

[color=GREEN];; ssget  -  Lee Mac[/color]
[color=GREEN];; A wrapper for the ssget function to permit the use of a custom selection prompt[/color]

([color=BLUE]defun[/color] LM:ssget ( msg params [color=BLUE]/[/color] sel )
   ([color=BLUE]princ[/color] msg)
   ([color=BLUE]setvar[/color] 'nomutt 1)
   ([color=BLUE]setq[/color] sel ([color=BLUE]vl-catch-all-apply[/color] '[color=BLUE]ssget[/color] params))
   ([color=BLUE]setvar[/color] 'nomutt 0)
   ([color=BLUE]if[/color] ([color=BLUE]not[/color] ([color=BLUE]vl-catch-all-error-p[/color] sel)) sel)
)
([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color])

Link to comment
Share on other sites

  • 10 months later...

Thanks for your lisp in Post #26.But in this lisp the dimension is not written at the start and the end of the polyline.First dimension is written after the specified step distance.Is it possible to add dimensions to start and the end of the polyline?

 

Thanks

Umit

Link to comment
Share on other sites

Thanks for your lisp in Post #26.But in this lisp the dimension is not written at the start and the end of the polyline.First dimension is written after the specified step distance.Is it possible to add dimensions to start and the end of the polyline?

 

The dimensions will start at the startpoint of the first polyline selected, and will continue until the step distance exceeds the length of this first polyline.

Link to comment
Share on other sites

  • 9 months later...

Hi,

I have many longitudinal profile (hundreds).

This Longitudinal Profile is made using the program URBANO-Canalis.

What should I do is to extract the depth of excavation.

If trim the line the text change of field line length (blue color).

I am attaching an sample.

Depth Category 1.jpg

All the best.

Best Regards,

Doru

 

Depth Category.dwg

02 Long Profile.jpg

Edited by doru10
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...