Jump to content

Stationing


student21

Recommended Posts

I found a routine that I would like to use that does what I need it to do except that it puts numbers at vertices but I need it to give civil engineering stations instead starting with 0+00. Can anyone figure out how to code it?

(Please see attached)

Thanks

TEST-12.lsp

Link to comment
Share on other sites

Since you're not using Civil 3D (which does all of this for you), why not just setup a typical "Station" block, and insert using the Measure Command, and be sure to select 'Yes' for 'Align to Object' prompt? :unsure:

Link to comment
Share on other sites

I checked all of the "chainage" routines and they only do the stationing at specified lengths. I am looking for a routine that will place "text" stations at the vertices and end points.

Link to comment
Share on other sites

Try this quickly written program:

[color=GREEN];; Station  -  Lee Mac[/color]
[color=GREEN];; Generates station labels at every vertex of selected LWPolylines.[/color]

([color=BLUE]defun[/color] c:station ( [color=BLUE]/[/color] *error* d e h i p s x )

   ([color=BLUE]defun[/color] *error* ( msg )
       ([color=BLUE]if[/color] ([color=BLUE]=[/color] 'int ([color=BLUE]type[/color] d)) ([color=BLUE]setvar[/color] 'dimzin d))
       ([color=BLUE]if[/color] ([color=BLUE]not[/color] ([color=BLUE]wcmatch[/color] ([color=BLUE]strcase[/color] msg [color=BLUE]t[/color]) [color=MAROON]"*break,*cancel*,*exit*"[/color]))
           ([color=BLUE]princ[/color] ([color=BLUE]strcat[/color] [color=MAROON]"\nError: "[/color] msg))
       )
       ([color=BLUE]princ[/color])
   )

   ([color=BLUE]setq[/color] d ([color=BLUE]getvar[/color] 'dimzin))
   ([color=BLUE]setvar[/color] 'dimzin 0)

   ([color=BLUE]setq[/color] h
       ([color=BLUE]list[/color]
          '(00 . [color=MAROON]"TEXT"[/color])
          '(72 . 1)
          '(73 . 2)
           ([color=BLUE]cons[/color] 40 ([color=BLUE]getvar[/color] 'textsize))
           ([color=BLUE]cons[/color] 07 ([color=BLUE]getvar[/color] 'textstyle))
       )
   )
   ([color=BLUE]if[/color] ([color=BLUE]setq[/color] s ([color=BLUE]ssget[/color] '((0 . [color=MAROON]"LWPOLYLINE"[/color]) (-4 . [color=MAROON]"<NOT"[/color]) (-4 . [color=MAROON]"&="[/color]) (70 . 1) (-4 . [color=MAROON]"NOT>"[/color]))))
       ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i ([color=BLUE]sslength[/color] s))
           ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] x ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 90 ([color=BLUE]entget[/color] ([color=BLUE]setq[/color] e ([color=BLUE]ssname[/color] s ([color=BLUE]setq[/color] i ([color=BLUE]1-[/color] i))))))))
               ([color=BLUE]setq[/color] p ([color=BLUE]vlax-curve-getpointatparam[/color] e ([color=BLUE]setq[/color] x ([color=BLUE]1-[/color] x))))
               ([color=BLUE]entmake[/color]
                   ([color=BLUE]append[/color] h
                       ([color=BLUE]list[/color]
                           ([color=BLUE]cons[/color] 01 (station ([color=BLUE]vlax-curve-getdistatparam[/color] e x)))
                           ([color=BLUE]cons[/color] 10 p)
                           ([color=BLUE]cons[/color] 11 p)
                       )
                   )
               )
           )                        
       )
   )
   ([color=BLUE]setvar[/color] 'dimzin d)
   ([color=BLUE]princ[/color])
)

([color=BLUE]defun[/color] station ( x [color=BLUE]/[/color] n )
   ([color=BLUE]strcat[/color] ([color=BLUE]itoa[/color] ([color=BLUE]fix[/color] ([color=BLUE]/[/color] x 100.0)))
       ([color=BLUE]if[/color] ([color=BLUE]minusp[/color] x) [color=MAROON]"-"[/color] [color=MAROON]"+"[/color])
       ([color=BLUE]if[/color] ([color=BLUE]<[/color] ([color=BLUE]setq[/color] n ([color=BLUE]abs[/color] ([color=BLUE]rem[/color] x 100.0))) 10.0)
           ([color=BLUE]strcat[/color] [color=MAROON]"0"[/color] ([color=BLUE]rtos[/color] n 2 2))
           ([color=BLUE]rtos[/color] n 2 2)
       )
   )
)

([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color])

@BIGAL, I think you mean www.theswamp.org ;)

Link to comment
Share on other sites

  • 5 weeks later...

Thanks Lee Mac, It works. Only one thing to be fixed if you can. In the routine I sent "Test-12.lsp" it would align the station text (1+00) with the irregular line or polyline. Thanks

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...