Lisp for chainage / stations along a polyline

Lisp for chainage / stations along a polyline

barry2104
Collaborator Collaborator
7,805 Views
3 Replies
Message 1 of 4

Lisp for chainage / stations along a polyline

barry2104
Collaborator
Collaborator

Hi all

I found a lisp for inserting chainages/stations along a polyline, that I would like get improved. The lisp can be found here:

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-changing-to-station-from-chaina...

 

If anyone knows how to edit the code to incorporate any/all of the following prompts when executing the lisp, that would be super helpful! Ideally it should run not only on Polylines but also on 2D and 3D Polylines.

 

So after installing the lisp and typing in „CHAINAGE“ or whatever the lisp is to be called, the following prompts would be ideal:

  1. Select Polyline, near start-chainage point (this ability would negate the need to check which direction the polyline runs in, to avoid having your Start-chainage at the wrong end of the polyline
  2. Enter start chainage [0+000] (in case for whatever reason the user can choose to start the chainage text at any desired number at the start of the polyline. If the user needs the start of the polyline to begin at chainage 45,123.150 (to be shown on the page then as 45+123.150) then he should just need to type in here 45123.15. So the 2nd marker would be at the round 45+130
  3. Interval [10.0 Standard]
  4. Number of decimals [0/1/2/3]
  5. Position Left or Right of polyline? [L/R]
  6. Text offset from Polyline [5.0] (Text/Chainage should be positioned standard 5 units left/right of the line, can be increased/decreased here as desired)  
  7. Text size [1.0]
  8. Text perpendicular to polyline? [Y/N]
  9. Insert Marker as Tickline or Circle or No marker? [Tick]
         (if T/C is selected…)  → Size of Marker [1.0] (only gets asked if T or C is selected in the previous prompt)
                                             → Scale of Marker [1.0] (in this case, the standard 1.0 = radius of circle / length of tick-marker)
  10. Insert extra chainages at all nodes? [No]

            (if Yes selected…)   → Number of decimals for node-chainages [0/1/2/3]

                                              → Separator [. or ,] (in some European countries, the decimal separator is a comma, so this option would be great! Otherwise standard with comma would be preferred)

 

Here's an example of the textual outputs I would expect to see running such a lisp:

0+000 (Start point standard 0+000)

0+010

0+017,123 (first node)

0+020

0+990

1+000

1+010

 

I also have looked at the options provided here: http://www.gilesdarling.me.uk/lisproutines.shtml#chmark

But although impressive, is not quite what i need, and I'm not at all experienced enough at lisp code to amend an existing lisp to suit my above desires.

Any help muchly appreciated!

Running AutoCAD Architecture 2020, in German
0 Likes
7,806 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant

Seems to me like a great target for your motivation to learn LSP.

Good luck!

0 Likes
Message 3 of 4

devitg
Advisor
Advisor

@barry2104 furthermore than @ВeekeeCZ quote, a sample.dwg with the before and after . would help to get some HELP. 

 

0 Likes
Message 4 of 4

Sea-Haven
Mentor
Mentor

The way to go is to do a DCL that asks the questions, a quick look at ask,  left side is values right side is radio buttons or toggles. See image example yes is a custom dcl. It has all 3 options get  values, toggles and a yes no radio button choice. Its not as hard as it looks. A donation goes a long way to get what you want.

 

Re Q1 yes a very simple check is when you do entsel and pick a pline you get a point and entity name, So you compare start and end point distance of the pline to pick point, and reverse the pline if required before doing chainages.

 

SeaHaven_0-1636692858016.png

Also this lisp, the 45+123.456 has been discussed many times. Where I am we don't use it.

0 Likes