Jump to content

LISP for Polyline following a "route"


Seigetsu.

Recommended Posts

Hello everyone, 

 

There is a process at work that we are trying to optimize. We have to draw a pipeline along a predetermined route, but the polyline should have vertices every 5.5m (which is the pipe length, but can be an input by user) and the angle of each vertex should not be more than 2 degrees (angle α in picture attached, represents the maximum rotation each pipe joint can have).

 

I am thinking of writing a LISP that would be able to draw this polyline given only a "route" polyline, but I'd like your opinion if it is possible and/or worth it? Is there a better way for me to do this? If LISP is possible/suggested, is there anything particular I should have in mind or something similar to base on?

 

Thanks in advance!

Screenshot_1.png

Edited by Seigetsu.
Link to comment
Share on other sites

The 5.5m vertices should be reasonably easy, look at Chainage LISPs, most will put in a block or marker at the required point - just need to remove the insert block part but add a vertex instead. User input for this is easy to do.

 

Get the vertexes from above and check using (angle ...) that they are within 0.03490659 or 3.10668607 radians (angle works in rads), 2 degrees,  If all is OK you can use entmod to modify existing vertexes if needed, add or delete them.

 

 

Is this enough of a hint for you? I'd work through this in stages, perhaps find a chainage LISP you are happy with and get that to return a list of 5.5m points, this is the chainage LISP I use at the moment: Change the "dist_list' list at the start to a list of 5.5. You might need to adjust the location of dist_list and cumm_dist in the code till after you have selected the polyline and calculated leng, and use leng to create your dist_list, the number of 5.5m vertexes that can be used to make up your polyline

 

 

Link to comment
Share on other sites

.... I don't know your skill level with LISP you see so will start off with hints instead of spending time writing code that you might have the ability to write anyway

Link to comment
Share on other sites

This is something like the vehicle check I wrote follows a pline, it draws a forward arc and looks at intersection point so would look at is point less than 2 degs, if so point is on existing. If not draw segment 5,5 long but 2 degs towards the existing. 

 

Forklift.thumb.png.bf7075efaf5a3d301cbb907f1c64b87d.png

 

THIS IS NOT CODE for this task needs more. It is an example of walk along.

 

Stephen P or any one can use code.

 

(setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline"))))

(setq interval ( getreal "\nEnter spacing m:"))

(setq cRad 3.05)
(setq startang (* pi 1.5))
(setq endang (/ pi 2.0))
(setq dist 0.0)

(setq len (vla-get-length obj))
(setq stpt (vlax-curve-getpointatdist obj interval))

(setq num (+ 1 (fix ( / len interval))))

(repeat num

(command "arc" "C" stpt (polar stpt endang crad)(polar stpt startang crad))
(setq objarc (vlax-ename->vla-object (entlast)))

(if (= (setq intpt (vlax-invoke obj 'intersectWith objarc acExtendnone)) nil)
(setq intpt (vlax-invoke obj 'intersectWith objarc acExtendThisEntity)) ; needed at start
)

(vla-delete objarc)
(setq ang (angle intpt stpt))

 

Need a real dwg with a few plines of existing path to test with.

 

Edited by BIGAL
  • Like 1
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...