Jump to content

Recommended Posts

Posted

Hello guys and sorry for asking a question that might've been answered here already, I am confused a bit.

 

I've tables containing thousands of rows of bearings, distances travelled from previous point and distances of obstacles on the left and right side of a vehicle. What I need to do is to draw obstacles on the road. I tried drawing multiple polylines but I realized it is not good enough. It is important to visualize measurements of individual sides, not just road width alone.

 

I though about drawing a center polyline and offsetting left and right measurements. These offsets are obviously different for every segment and filling thousands manually is a no-go. I would like to compare the sketch with a map, but first I need to use the data to draw lines, rectangles or anything, that would interpret the collected data visually.

 

Sorry for my "non-technical" level of english, I have trouble describing the problem in my native language as well. Hopefully the screen attached will make my question clear. It would be great if the result would look like the one on the right side (thick polyline - but I would need to be able to set left/right thickness), but the left one using offsets would be sufficient.

 

Last resort would be converting all the measured points to coords by calculating all the angles using some scripts, but I hope there is a more elegant solution to this.

 

Thank you very much.

road.png

Posted

There should not be a problem doing a centreline and left and right offsets as well, you need to provide a sample data file.

Posted

Thanks for a quick answer. Sample data:

 

timestamp;lat;lon;distance;angle;right;left
1620394442.64;50.0363958333;14.338806;31.3;175.6;199.55;137.36
1620394442.64;50.0363958333;14.338806;31.3;175.6;203.67;137.90
1620394443.64;50.03638;14.3388136667;30.7;162.7;1196.90;139.04
1620394443.64;50.03638;14.3388136667;30.7;162.7;1197.04;140.60
1620394443.64;50.03638;14.3388136667;30.7;162.7;198.81;140.80
1620394443.64;50.03638;14.3388136667;30.7;162.7;194.69;149.17
1620394443.64;50.03638;14.3388136667;30.7;162.7;191.92;165.45
1620394444.64;50.0363618333;14.3388153333;50.6;176.6;190.97;160.11
1620394444.64;50.0363618333;14.3388153333;50.6;176.6;189.08;158.29
1620394444.64;50.0363618333;14.3388153333;50.6;176.6;207.86;164.30
1620394445.64;50.0363518333;14.3388141667;15.9;-175.7;1196.90;174.02

 

I can draw the centerline easily by using distance / angle, but I dont know how to attach different offsets for each of these lines. Thanks for your help.

Posted (edited)

I managed to draw the center line with offsets by using this:

 
_LINE 0,0 137.3<2.5 X
_SELECT L 
_OFFSET T M 30 -40 E
_UCS 137.3<2.5 

The problem is, I don't know where the CAD draws +/- values of offsets, because it is relative to mouse position. This is ridiculous, I can't even verify that the code did what it was supposed to.

Edited by itsjustme
Posted

This should help

(setq obj (vlax-ename->vla-object  (entlast)))
(vla-offset obj x)

where x is positive or -ve value eg 10 -20 

 

Posted

I would try a slightly different approach, rather than trying to work out a point (position) that is +/- use the 'distances' you have for right / left and the angle of the line -90 and +90 the multiple option of th offset command will allow you to enter multiple values so your offset command would become

_OFFSET T M 100<-87.5 50<92.5 E

In this example the right offset is 100 and left 50, you would only need to work out your new angles and in this case that was 2.5 - 90 = -87.5 and 2.5 + 90 = 92.5

Posted
On 5/8/2021 at 5:35 AM, itsjustme said:

Thanks for a quick answer. Sample data:

 

timestamp;lat;lon;distance;angle;right;left
1620394442.64;50.0363958333;14.338806;31.3;175.6;199.55;137.36
1620394442.64;50.0363958333;14.338806;31.3;175.6;203.67;137.90
1620394443.64;50.03638;14.3388136667;30.7;162.7;1196.90;139.04
1620394443.64;50.03638;14.3388136667;30.7;162.7;1197.04;140.60
1620394443.64;50.03638;14.3388136667;30.7;162.7;198.81;140.80
1620394443.64;50.03638;14.3388136667;30.7;162.7;194.69;149.17
1620394443.64;50.03638;14.3388136667;30.7;162.7;191.92;165.45
1620394444.64;50.0363618333;14.3388153333;50.6;176.6;190.97;160.11
1620394444.64;50.0363618333;14.3388153333;50.6;176.6;189.08;158.29
1620394444.64;50.0363618333;14.3388153333;50.6;176.6;207.86;164.30
1620394445.64;50.0363518333;14.3388141667;15.9;-175.7;1196.90;174.02

 

I can draw the centerline easily by using distance / angle, but I dont know how to attach different offsets for each of these lines. Thanks for your help.

Would you , please , upload a sample dwg  from this data , at least 4 o 5 lines 

 

Posted
On 5/9/2021 at 3:16 AM, itsjustme said:

I managed to draw the center line with offsets by using this:

 
_LINE 0,0 137.3<2.5 X
_SELECT L 
_OFFSET T M 30 -40 E
_UCS 137.3<2.5 

The problem is, I don't know where the CAD draws +/- values of offsets, because it is relative to mouse position. This is ridiculous, I can't even verify that the code did what it was supposed to.

 

Well, BIGAL pretty much answered your question. Using vla-Offset will do just as fine.

 

A positive value would indicate offsetting to the side that would result in the longer curve length. And if the curve length will stay the same, the the offset would be to the positive x, y, and z coordinates. A negative value would indicate otherwise.

  • 10 months later...
Posted

i want to do the same but it's my first time making a script how do i 

approach or do something like this

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