Author Topic: EXTRACT DATA FROM TRANSVERSAL SECTIONS  (Read 3171 times)

0 Members and 1 Guest are viewing this topic.

Aldo

  • Newt
  • Posts: 22
EXTRACT DATA FROM TRANSVERSAL SECTIONS
« on: March 22, 2018, 02:09:31 PM »
Dear teachers I appeal to you to request help to generate a routine, the routine would consist in generating the data of the table (texts of green, red, cyan) which are generated starting from the data that must be entered so much of the value of the station as of the elevation at the intersection of the axis (blue texts) with the polyline representing the section of the terrain (green polyline), the colored texts of the table are generated from the accumulated distances and the elevations of the vertices of the polyline that represents the section of land to the left starting from the point of intersection of the axis with the section of terrain (blue circle), in the same way the values ​​of color cyan are the accumulated distances and the elevations of the vertices of the polyline that represents the section of the terrain to the right, the elevation of the vertices is a function of the elevation of the intersection of the axis with the polyline that represents the section of the land; The colors of the texts are only to be able to explain better what is required, it is not necessary that the routine represents colors.
https://i62.servimg.com/u/f62/19/88/13/91/captur11.jpg
Very grateful for the help given.


ronjonp

  • Needs a day job
  • Posts: 7527
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #1 on: March 22, 2018, 04:30:13 PM »
Try this ... it's a start.
Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ dz e elv n p pts tmp)
  2.   ;; RJP - 03.22.2018
  3.   (cond ((and (setq e (entsel "\nPick a polyline at your start point: "))
  4.               (wcmatch (cdr (assoc 0 (entget (car e)))) "POLYLINE,LWPOLYLINE")
  5.               (setq *glblelev*
  6.                      (cond ((getdist (strcat "\nEnter starting elevation[<"
  7.                                              (if *glblelev*
  8.                                                (vl-princ-to-string *glblelev*)
  9.                                                (vl-princ-to-string (getvar 'elevation))
  10.                                              )
  11.                                              ">]: "
  12.                                      )
  13.                             )
  14.                            )
  15.                            (*glblelev*)
  16.                            ((getvar 'elevation))
  17.                      )
  18.               )
  19.          )
  20.          (setq dz (getvar 'dimzin))
  21.          (setvar 'dimzin 0)
  22.          (setq p (vlax-curve-getclosestpointto (car e) (cadr e)))
  23.          (setq e (car e))
  24.          (setq pts (vlax-get (vlax-ename->vla-object e) 'coordinates))
  25.          (while (caddr pts)
  26.            (setq tmp (cons (list (car pts) (cadr pts) (caddr pts)) tmp)
  27.                  pts (cdddr pts)
  28.            )
  29.          )
  30.          (setq pts (apply 'strcat
  31.                           (append (list "STATION\t\tDISTANCE\t\tELEVATION\\P\\P")
  32.                                   (mapcar '(lambda (x)
  33.                                              (setq n (- (car x) (car p)))
  34.                                              (strcat "{\\L\\C"
  35.                                                      (cond ((equal n 0.0 1e-4) "7")
  36.                                                            ((minusp n) "1")
  37.                                                            ("4")
  38.                                                      )
  39.                                                      " 0+000\t\t"
  40.                                                      (rtos n 2 3)
  41.                                                      "\t\t"
  42.                                                      (rtos (+ *glblelev* (- (cadr x) (cadr p))) 2 3)
  43.                                                      "}\\P"
  44.                                              )
  45.                                            )
  46.                                           (cond ((> (caar tmp) (car p)) (setq tmp (reverse tmp)))
  47.                                                 (tmp)
  48.                                           )
  49.                                   )
  50.                           )
  51.                    )
  52.          )
  53.          (entmakex (list '(0 . "MTEXT")
  54.                          '(100 . "AcDbEntity")
  55.                          '(67 . 0)
  56.                          '(8 . "MTEXT")
  57.                          '(100 . "AcDbMText")
  58.                          (cons 10 p)
  59.                          '(40 . 1)
  60.                          '(41 . 0)
  61.                          '(46 . 0)
  62.                          '(71 . 1)
  63.                          '(72 . 5)
  64.                          (cons 1 pts)
  65.                          '(11 1 0 0)
  66.                          '(50 . 0)
  67.                          '(73 . 1)
  68.                          '(44 . 1)
  69.                    )
  70.          )
  71.          (setvar 'dimzin dz)
  72.         )
  73.   )
  74.   (princ)
« Last Edit: March 22, 2018, 05:11:36 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Aldo

  • Newt
  • Posts: 22
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #2 on: March 23, 2018, 05:17:42 PM »

I have the Autocad 2018 and the routine does not work, the following error occurs when entering the elevation

error: no function definition: VLAX-CURVE-GETCLOSESTPOINTTO

Thanks for the help

ronjonp

  • Needs a day job
  • Posts: 7527
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #3 on: March 23, 2018, 05:23:17 PM »

I have the Autocad 2018 and the routine does not work, the following error occurs when entering the elevation

error: no function definition: VLAX-CURVE-GETCLOSESTPOINTTO

Thanks for the help
You sure you copied all the code? It needs (vl-load-com) at the end.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Aldo

  • Newt
  • Posts: 22
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #4 on: March 23, 2018, 05:40:47 PM »
If I copied completely, I checked it in case it had been wrong but I did not

ronjonp

  • Needs a day job
  • Posts: 7527
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #5 on: March 23, 2018, 07:25:08 PM »
So it still does not work ? Are you running AutoCAD on Mac?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Aldo

  • Newt
  • Posts: 22
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #6 on: March 23, 2018, 10:35:33 PM »
It still does not work, I'm running in windows

ronjonp

  • Needs a day job
  • Posts: 7527
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #7 on: March 23, 2018, 11:53:09 PM »
It still does not work, I'm running in windows
Not sure what's going on.

You could try changing this: (setq p (vlax-curve-getclosestpointto (car e) (cadr e)))
To this (setq p (cadr e))

Just make sure you use snaps to make your selection.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Aldo

  • Newt
  • Posts: 22
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #8 on: March 26, 2018, 12:34:42 PM »
I made the change but now I get this error

error: no function definition: VLAX-ENAME->VLA-OBJECT

 :cry: :cry: :cry: :cry:


ronjonp

  • Needs a day job
  • Posts: 7527
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #9 on: March 26, 2018, 12:44:56 PM »
Try pasting this into the command line: (vl-load-com)


Then run the code.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Aldo

  • Newt
  • Posts: 22
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #10 on: March 27, 2018, 06:15:16 PM »
I already lost the hope that it works :cry: :cry: :cry: :cry:

thanks for the help anyway

ronjonp

  • Needs a day job
  • Posts: 7527
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #11 on: March 27, 2018, 10:39:12 PM »
If you look at the animation, it DOES work. Not sure what software you're running....

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #12 on: March 28, 2018, 02:46:19 AM »
Works here... try:

1) copy attached foo.lsp in the same folder of your drawing
2) at command line: (load "foo.lsp")
3) type: foo

Aldo

  • Newt
  • Posts: 22
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #13 on: March 28, 2018, 12:35:24 PM »
you're right, I tried it in another version and it works perfectly
Thank you very grateful

ronjonp

  • Needs a day job
  • Posts: 7527
Re: EXTRACT DATA FROM TRANSVERSAL SECTIONS
« Reply #14 on: March 28, 2018, 12:57:23 PM »
you're right, I tried it in another version and it works perfectly
Thank you very grateful
Good to hear :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC