Jump to content

MARK CHAINAGE AND POINT ON POLYLINE FROM EXCEL DATA


bilalntk1

Recommended Posts

Hi,

I have a lot of chainages (around 28 kilometers) in the excel file. I need to put that on polyline in Autocad. please find sample attachments for your ready reference and please help. 

CHAINAGE.jpg

CHAINAGE.pdf

Link to comment
Share on other sites

So what help do you need? I don't know your skill level and if you have a library of LISPS that you use, so where do we start to help you?

 

For example, starting at the beginning, can you create a LISP routine (doesn't have to be complicated), can you get a routine to reference others, have you got one that can read from excel.... so where do we start to help you?

 

So the first part of your problem, there are a lot of routines out there that will read from an excel file - have you found any of them and can you get your excel data into a variable or a list in a LISP?

 

Then there are chainage LISPs too which will put a marker every so often, either a regular distance or a user specified distance, again have you found any of them? Might be that you just need help combining the 2 together you see.

 

So let us know where to start with the help and I am sure most of us will be happy to give you some snippets of advice, you might get lucky and LISP from someones library that does the same (I have a chainage LISP for example, can't remember where I got it from but that only does a constant distance between points and not a variable one, would need altering a touch)

 

 

Edit Here:

I think this is the piece of code that gets the points along a polyline.. everything else in the LISPs are just doing stuff, but think this is the line you will probably be struggling to find out

(setq list_pt (vlax-curve-getPointAtDist obj_vlax total_Chain_distance) )

 

Edited by Steven P
  • Like 1
Link to comment
Share on other sites

Second comment is how often will you be doing this? If it is a one off thing, or not often, then you can maybe ignore the excel to LISP part, just copy the data and hard code it to this chainage LISP, save a job and source of errors in programming

  • Like 1
Link to comment
Share on other sites

Like stevenP lets go back a couple of steps like how are you getting the chainages in the 1st place ? 

 

If its pick a point then do just that pick a point and write the chainage label on to the pline. (vla-curve-getclosestpointto obj_vlx pt)

 

To me looks like you have picked specific objects for the PDF.

 

  • Like 1
Link to comment
Share on other sites

Sir,

I have attached the original excel file and Autocad version for your reference.  actually, I need to export (Label) all chainages which are in the excel file, to the alignment in the attached Autocad drawing. 

 

10 hours ago, Steven P said:

So what help do you need? I don't know your skill level and if you have a library of LISPS that you use, so where do we start to help you?

 

For example, starting at the beginning, can you create a LISP routine (doesn't have to be complicated), can you get a routine to reference others, have you got one that can read from excel.... so where do we start to help you?

 

So the first part of your problem, there are a lot of routines out there that will read from an excel file - have you found any of them and can you get your excel data into a variable or a list in a LISP?

 

Then there are chainage LISPs too which will put a marker every so often, either a regular distance or a user specified distance, again have you found any of them? Might be that you just need help combining the 2 together you see.

 

So let us know where to start with the help and I am sure most of us will be happy to give you some snippets of advice, you might get lucky and LISP from someones library that does the same (I have a chainage LISP for example, can't remember where I got it from but that only does a constant distance between points and not a variable one, would need altering a touch)

 

 

Edit Here:

I think this is the piece of code that gets the points along a polyline.. everything else in the LISPs are just doing stuff, but think this is the line you will probably be struggling to find out

(setq list_pt (vlax-curve-getPointAtDist obj_vlax total_Chain_distance) )

 

 

CHAINAGE.xlsx NEED TO LABEL CHAINAGES.dwg

Edited by bilalntk1
for more clarity
Link to comment
Share on other sites

Just quickly with 33 points it might be quicker just to use the measure command as it would be to write, check and verify that a LISP functions correctly. Create a block and use that with measure, use the points above and delete all but the first block inserted for each point and there you go.

 

Obviously if this is something you do regularly it is worth a LISP, will have a think for you.

Link to comment
Share on other sites

This one might work, you have to put your points in the list and the points are the distance from the last point

 

 

So I reckon put these points in the list, to replace line 3:

 

(setq dist_list '(
1017.7673
2150.42
1674.53
797.12
800.1027
725
1235.2773
390.0027
1396.6773
399.05
638.243
587.6797
949.5073
2067.2227
277.5173
511.87
4336.29
1108.44
280.75
1325.0027
426.0951
1135.4422
2099
474.9927

))

 

 

 

Link to comment
Share on other sites

So looking again at this over lunch, it inserts a block named 'tick' - so you will need that in your drawing, and if you have an attribute in that you should be able to modify the code to complete that with the a chainage reference or distance

 

Lee Macs website has info on how to do that, insert the block using the above, then (entlast), sending that to Lees attribute L:ISP and job done. I'll leave it to you to do that part now.

  • Like 1
Link to comment
Share on other sites

Its a fas so useless for us to look at as its compiled.

 

So you picking points in some way so AGAIN why not do the label when you pick a point, it can be either on a pline or a offset point and the square off will be used. Do you really need the Excel ?

 

This is real rough but gives you an idea of how it could be done. Need info like text style and height, correct version writes at 90 to pline.

 

; sq pt off pline

(defun c:wow (obj pt pt2 dist )
(setq obj (vlax-ename->vla-object (car  (entsel "Pick obj"))))

(setvar 'textstyle "Standard")

(while (setq pt (getpoint "\nPick point or Enter to exit "))
(setq pt2 (vlax-curve-getclosestpointto obj pt))
(setq dist (vlax-curve-getdistatpoint obj pt2))
(command "text" pt2 2.5 "" (rtos dist 2 3))
)

(princ)
)

 

 

  • Like 2
Link to comment
Share on other sites

On 4/19/2022 at 7:56 AM, bilalntk1 said:

Hi,

I have a lot of chainages (around 28 kilometers) in the excel file. I need to put that on polyline in Autocad. please find sample attachments for your ready reference and please help. 

CHAINAGE.jpg

CHAINAGE.pdf 83.37 kB · 7 downloads

Please upload the original CHAINAGE .dwg from wher you get this CHAINAGE.pdf  as to use it as text size and style model 

 

 

 

 

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