Author Topic: Help me to convert a file  (Read 11207 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Help me to convert a file
« Reply #30 on: December 17, 2015, 08:24:52 PM »
Hi Kerry  i  write (/ pi 200)to convert the angle to grads

All the times the program take as midle insert point the right side of the section line. The problem is if i extent the section line to the left and right the road center line is not all ways in the middle of the cross section line. Thats way i said in the beginning of the topic to

1) select the cross section line
2)pick the middle of green cross section line from the road drawing
3)calculate the  angle G in grads

Topo,

Further to ymg's post,

PLEASE follow this through :

Code - Auto/Visual Lisp: [Select]
  1.  
  2. ;|
  3. AUNITS
  4. 0 -- Degrees
  5. 1 -- Degrees/minutes/seconds
  6. 2 -- Grads
  7. 3 -- Radians
  8. 4 -- Surveyor's units
  9. |;
  10.  
  11. (setvar 'aunits 0)
  12. (getvar 'Aunits) ;=> 0 DEGREES
  13. (setq en    (car (entsel "\nSelect Line")) )
  14.  
  15.  
  16. (vlax-curve-getStartPoint en) ;=> (0.0 0.0)
  17.  
  18. ;;The distance along the curve from the beginning of the curve to the location of the specified point.
  19. (setq pt (vlax-curve-getPointAtDist en 20)) ;=> (17.5001 -9.6823 0.0)  
  20.  
  21.  
  22. (setq ptd1 (polar pt (- (angle startPoint pt) (/ pi 2)) 5 )) ;=> (15.0795 -14.0573 0.0)
  23.  
  24. (setvar 'aunits 2)
  25. (getvar 'Aunits) ;=> 2 GRADS
  26.  
  27. (setq ptg1 (polar pt (- (angle startPoint pt) (/ pi 2)) 5 )) ;=>  WHAT DO YOU EXPECT FOR THIS RESULT
  28.  
  29.  
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Help me to convert a file
« Reply #31 on: December 17, 2015, 10:19:24 PM »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Help me to convert a file
« Reply #32 on: December 17, 2015, 11:13:36 PM »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

ronjonp

  • Needs a day job
  • Posts: 7529

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

pedroantonio

  • Guest
Re: Help me to convert a file
« Reply #34 on: December 18, 2015, 02:00:46 AM »
Quote
I plotted your sample section and point 1, 6 and 13 are right, no matter the direction or angle units.

Hi ymg.After your post i use again your code for A13 cross section and the results are wrong.

I upload the cross section data  file i use and the cross section i use , and tell were is my mistake.

Quote
;;The distance along the curve from the beginning of the curve to the location of the specified point.
(setq pt (vlax-curve-getPointAtDist en 20)) ;=> (17.5001 -9.6823 0.0)

I have one question. This lisp  works only for cross section with length 20m ? If i have 20m for the left of the road center line and 40m for the right how the program will understand were is the center of the road?


Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Help me to convert a file
« Reply #35 on: December 18, 2015, 02:25:58 AM »

Quote
;;The distance along the curve from the beginning of the curve to the location of the specified point.
(setq pt (vlax-curve-getPointAtDist en 20)) ;=> (17.5001 -9.6823 0.0)

I have one question. This lisp  works only for cross section with length 20m ? If i have 20m for the left of the road center line and 40m for the right how the program will understand were is the center of the road?


I'm giving up on this.
The code I wrote was pulled from my head to help you understand.

Personally I don't give a stuff about the width of your road; I was trying to demonstrate that polar uses radians and that your change of someone elses code to (/ pi 200 ) was useless and incorrect.

You didn't even make the effort to answer the question I raised in the code or to acknowledge the lesson.





kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

pedroantonio

  • Guest
Re: Help me to convert a file
« Reply #36 on: December 18, 2015, 02:36:56 AM »
Thank you Kerry for the lesson. It help me to understand many things,but can you explain me why my mistake almost correct the angle of the points? I upload in previous post photos with the results.I am not good in programming and i respect that you, (ronjonp  :evil: ) and ymg try to help me.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Help me to convert a file
« Reply #37 on: December 18, 2015, 03:30:32 AM »
By happenstance (/ pi 2)  is 89.1 degrees rotated from (/ pi 200)

... So you assumed the change fixed the issue and ignored the nominal 1 degree misalignment.

Code - Auto/Visual Lisp: [Select]
  1. (defun rtd (ang) (/ (* ang 180.0) pi))
  2. (defun rtg (ang) (/ (* ang 200.0) pi))
  3.  
  4. (rtd  pi ) ;=> 180.0 d
  5. (rtg  pi ) ;=> 200.0 g
  6.  
  7. (rtd (/ pi 200) ) ;=>  0.9 d
  8. (rtd (/ pi 2)   ) ;=> 90.0 d
  9.  

added re polar function:
« Last Edit: December 18, 2015, 03:45:26 AM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

pedroantonio

  • Guest
Re: Help me to convert a file
« Reply #38 on: December 18, 2015, 04:54:01 AM »
And why ymg say

Quote
I told you many times that the angle argument for function polar is radians. You don't need grad the side of your direction is also irrelevant.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Help me to convert a file
« Reply #39 on: December 18, 2015, 05:11:54 AM »
And why ymg say

Quote
I told you many times that the angle argument for function polar is radians. You don't need grad the side of your direction is also irrelevant.

You're joking, right ??
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

pedroantonio

  • Guest
Re: Help me to convert a file
« Reply #40 on: December 18, 2015, 05:28:26 AM »
ymg i read again your previous post
Code: [Select]
You do not need to pick each point, the programs
find them at every 20 meters.

You do have to enter a filename in the getfiled dialog box,
because you did not organize your data properly.  The section
should be in a single folder and at least have a name that could
be translated to a chainage.  Alternatively the first line in every
cross section file could be a real corresponding to the chainage.

How to manage my data? Is A13.txt  file correct?

I can not understand this

Code: [Select]
You do not need to pick each point, the programs
find them at every 20 meters.

When the program start i select in road drawing  the cross green line not the center line of the road !!!. Please show me how to use correct your program , and what to change to cross section files

ymg

  • Guest
Re: Help me to convert a file
« Reply #41 on: December 18, 2015, 01:29:08 PM »
topographer,

The whole exercise of re-calculating point out of your cross-section
is somewhat pointless.

Normally, the program you used to creates the cross-sections started
from points and calculated the offset distance and elevation.

So the proper way to do it would be to save your points as you creates
the cross-sections.

Now let says that for some reasons you lost your alignment drawing and
the file containing your original points and you want to recreates the alignment
and the point.

To do this, each cross section should have as the first line in each file, the chainage and the
coordinates of the center point and the orientation of the section. All  the offsets and distances
would be kept in the following lines.

This way you would need nothing else to re-calculate your points.  If you go back
to a project two years down the line,  your alignment can be reconstructed from
the cross-section files only.

Another question, although you are not very good at answering,  Why don't you
named your file in a meaningful way, like including the chainage in the name of the file ?

As for the correctness of file A13, I cannot check as the alignment drawing you gave us
does not show that one.  So even If I had the chainage of section A13, I cannot calculate the points.



ymg
« Last Edit: December 18, 2015, 01:45:59 PM by ymg »

pedroantonio

  • Guest
Re: Help me to convert a file
« Reply #42 on: December 18, 2015, 01:58:35 PM »
Hi ymg. i have confused with all this .Can you tell me what to do to run this lisp without problems.Why i have problem with the rotation  aligment. Is my cross section file wrong?If is not nessesery to change anything in the code upload me the files you use to see the diference.

Code: [Select]
Another question, although you are not very good at answering,  Why don't you
named your file in a meaningful way, like including the chainage in the name of the file ?

I can do any change you want in the cross section file ,this is not a problem.just give an example. The only thing  i want is to see this programm work perfect  :-D .

Thanks
« Last Edit: December 18, 2015, 02:13:59 PM by Topographer »

ymg

  • Guest
Re: Help me to convert a file
« Reply #43 on: December 18, 2015, 03:19:00 PM »
topographer,

This is the files I use, which is the one you uploaded.


pedroantonio

  • Guest
Re: Help me to convert a file
« Reply #44 on: December 18, 2015, 03:46:10 PM »
I can not see any difference.And you don't have rotation problem with this files ?If you usethis files then the programm mast have serious problem with the calculate ange.lIn your previous post you said me

Code: [Select]
To do this, each cross section should have as the first line in each file, the chainage and the
coordinates of the center point and the orientation of the section. All  the offsets and distances
would be kept in the following lines.

This way you would need nothing else to re-calculate your points.  If you go back
to a project two years down the line,  your alignment can be reconstructed from
the cross-section files only.

Another question, although you are not very good at answering,  Why don't you
named your file in a meaningful way, like including the chainage in the name of the file ?

So i think it is time to change the file and add the  the chainage and the
coordinates of the center point