Jump to content

lisp to generate contour from xyz


pramodmaharana

Recommended Posts

Alignment is defined the way I have explained above at regular intervals, usually 20m or 25m, and the cross section details (lane width, center median, shoulders, verges, placement of guard rail, distance of guard rail to start of slope (this is very important and should be a variable) and so on. The user should give values in a dialog. From point to point is a short line and the cross section can be placed bisecting the angle between them, if not perpendicular on a straight stretch.

Link to comment
Share on other sites

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

  • ymg3

    14

  • aloy

    12

  • BIGAL

    6

  • manohar

    3

Top Posters In This Topic

Posted Images

Its pretty normal practice to always get a value & crossection at TP's even when no curve, and like aloy at fixed intervals. Some thing to think about is extra points, define spacing between chainage range 10-20 do 5 balance at 20, the other a bit trickier is to jump to model and pick a point working out perp to pline and chainage. Also if no curve at TP ie two lines 3 answers are possible sq to start, sq to next or 1/2 angle. Another is to do a crossection at a angle for a chainage pt.

 

YMG I must apologise I have not run code as I do not have a need to.

 

YMG its sounds like your on track I think I would take 1 step back though and look again at the spagetti. Most people want simple long and cross, plus a plan view.

 

Our third party Civil we can drive cars along alignments to check bottoming out problems at driveways make this rev 32 option. The principle owner who I worked for has been doing this stuff since the 80's and continues to improve the software. Auto roundabouts and intersection design, change 1 road all intersection kerbs are auto regraded the roads are dynamically linked it knows what road touches what other road. Drainage and sewers are part also.

 

There is definately a market for simple road design stuff, simple design lines and exsiting surface. Even if CIV3d was a few $100 people would not pay. The software we use is now being sold for Briscad and I expect other Autocad clones the mighty $$$ ruling.

Link to comment
Share on other sites

ymg3,

demoZ does not seem to work. I ran your latest version as follows:

Generated the points on screen, then tin (no cont or gen as points already in pl) then ran demoz. I see some activity but no visible result for the Lawson's walk. Perhaps pl has vanished before invoking demoz.

btw. where is 'avatar' given life. I do not see reference to it anywhere.

Regards,

Aloy

Link to comment
Share on other sites

aloy,

 

Normally you can run Demoz even if you have contours, but I made many changes

so may be I broke something will check later today and revert to you.

 

Avatar is only a list that contains the pixels for the smalll image at the lower rigth

of the dialogue box.

 

ymg

Link to comment
Share on other sites

ymg3,

If you want to progress in alignment design try to follow as closely as what civil3d does. I am sure you must be already having it. If not try to see the formation of tin and alingment design in the following link:

http://docs.autodesk.com/CIV3D/2013/ENU/index.html?url=filesCTU/GUID-899731B5-0B6A-451E-9CF2-0DCF00FA9B64.htm,topicNumber=CTUd30e6049

Regards,

Aloy

Link to comment
Share on other sites

Aloy,

 

I do not have access to Civil3d, or ever worked with it.

 

I did look at your link and there are some interesting concept.

 

One thing that would help me is if somebody would post a drawing containing

alignment with spirals, verticals and circular curves, I could look at how the data

is structured.

 

From there we probably could devise something in Vanilla Autocad that would mimic

the structure of Civil3D.

 

ymg

Link to comment
Share on other sites

Aloy,

 

You are right that demoz did not work in version posted above.

 

Try with this and bear in mind that it is a work in progress.

 

ymg

TriangV0.5.6.LSP

Edited by ymg3
Corrected a bug in Attachment
Link to comment
Share on other sites

ymg3,

Thanks for the above. I will try it later.

I am actually at outstation and I do not have access to alignment drawings in this country. However I give a link below that explains the procedure in designing highways with civil3d:

http://images.autodesk.com/adsk/files/road_design_with_autocad_civil_3d_0912_en.pdf

you may get further details from Link design in TD9/1993 with all sorts of updates. It is the UK system I am following. Some other countries in this region follow the US standards.

I will post a layout drawing done with C3D and another preferred option done with another about 10 years ago. I will do it when I get.

Regards,

Aloy

Link to comment
Share on other sites

ymg3,

Amazing. To my mind, you with help of others, have done what Autodesk could not do(which they implement with various APIs). And also it is really fast. This is almost 3000 lines of code and Linux was 10,000 lines at the beginning ( though it is 16m now) according to what i have read. Here I am only showing the magnitude of the work not comparing apple with apple.

Thank you.

Aloy

Edited by aloy
Link to comment
Share on other sites

aloy,

 

Dowload the attached and try the new command Xshape, Let me know what you think.

 

That command will create a boundary around your point set, you dynamically adjust

the length parameters by pressing + or - on the keyboard.

 

The boundary is accepted by pressing ENTER or LEFT-CLICK

 

RIGTH-CLICK will cancel.

 

More details in the code comments and in the paper

 

Efficient generation of simple polygons for characterizing the shape of a set of points in the plane

 

by Matt Duckham, Lars Kulik, Mike Worboys, Antony Galton

 

ymg

TriangV0.5.6.LSP

Edited by ymg3
Corrected a bug in Attachment
Link to comment
Share on other sites

 

Dowload the attached and try the new command Xshape, Let me know what you think.

 

ymg

 

Hi YMG,

 

Nice one.

 

Appreciate your dedication on improving the triangulation lisp. Thank You.

 

Is there any way to calculate cut and fill volume between two tins.

 

Manohar.

Link to comment
Share on other sites

manohar,

 

I've done very little work on volume calculation.

 

There is a two helpful function in the the program namely:

"voltin" will compute the volume of a triangle list (tl) down to elevation 0

"3df2sol" will transform a 3dface to a solid. Then all you need is to do

the union of all these solid etc. etc.

 

Here an experimental program not included in triangulation yet:

 

(defun c:voltin (/ );*acaddoc* bmax bmin en en3 en4 en5 en6 h i layp layr
                   ;pins pmax pol rmax ss1 ss2 ssprop ssref v1 v2 v3 varl
                   ;volp volr vp vr y)
                 
  (vl-load-com)
 
  ;;; Error Handler by ElpanovEvgenyi                                        ;
  (defun *error* (msg)
               (mapcar 'eval varl)
               (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")))
          (princ (strcat "\nError: " msg))
       )
               (and *AcadDoc* (vla-endundomark *AcadDoc*))
       (princ)
  )
    
  (setq varl '("CLAYER" "OSMODE" "CMDECHO" "DIMZIN")
        varl (mapcar (function (lambda (a) (list 'setvar a (getvar a)))) varl)
  )     
    
  (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
                  
    
  (setvar 'CMDECHO 0)
  (setvar 'DIMZIN 0)
  (setvar 'OSMODE 0)

  (if (and (setq layr (cdr (assoc 8 (entget (car (entsel "\nPick a 3DFACE on Reference Layer: ")))))
                 ss1 (ssget "_X" (list '(0 . "3DFACE")(cons 8 layr)))
           )
           (setq layp (cdr (assoc 8 (entget (car (entsel "\nPick a 3DFACE on Proposed Layer: ")))))
                 ss2 (ssget "_X" (list '(0 . "3DFACE")(cons 8 layp)))
           )
      )     
     (progn
        (vla-startundomark *AcadDoc*)

        
        (setvar 'CLAYER layr)
        (setq ssref (ssadd))
        (repeat (setq i (sslength ss1))
                     (setq   en (ssname ss1 (setq i (1- i)))
                  ssref (ssadd (3df2sol en) ssref) 
             )
                 )
         (vl-cmdf "_UNION" ssref "")
         (setq en3 (entlast))
         (vl-cmdf "_COPY" en3 "" '(0 0) '(0 0))
         (setq enr (entlast))
         
         ;(vla-GetBoundingBox (vlax-eName->vla-Object en3) 'rmin 'rmax)
         ;(setq rmax (vlax-SafeArray->List rmax))
         
         
         (setvar 'CLAYER layp)
         (setq ssprop (ssadd))
         (repeat (setq i (sslength ss2))
                     (setq en (ssname ss2 (setq i (1- i)))
                  ssprop (ssadd (3df2sol en) ssprop) 
             )
                 )
         (vl-cmdf "_UNION" ssprop "")
         (setq en4 (entlast))
         (vl-cmdf "_COPY" en4 "" '(0 0) '(0 0))
         (setq enp (entlast))
         
         ;(vla-GetBoundingBox (vlax-eName->vla-Object en4) 'pmin 'pmax)
        ;(setq pmax (vlax-SafeArray->List pmax))
        
         (vl-cmdf "_-LAYER" "_M" "SUPERFICIES" "")

         (vl-cmdf "_-INTERFERE" en3 "" en4 "" "_Y")
         (setq en5 (entlast))
         (vl-cmdf "_COPY" en5 "" '(0 0) '(0 0))
         (setq en6 (entlast))
         (vla-GetBoundingBox (vlax-eName->vla-Object en4) 'bmin 'bmax)
         (setq bmax (vlax-SafeArray->List bmax)
               bmin (vlax-SafeArray->List bmin)
         )
         
         (vl-cmdf "_SUBTRACT" en3 "" en5 "")
         (vl-cmdf "_SUBTRACT" en4 "" en6 "")
         
         (setq vref  (vlax-get-property (vlax-ename->vla-object enr)  'Volume)
               vprop (vlax-get-property (vlax-ename->vla-object enp)  'Volume)
               vcut  (vlax-get-property (vlax-ename->vla-object en3)  'Volume)
               vfill (vlax-get-property (vlax-ename->vla-object en4)  'Volume)
         )
         
         (setvar 'CLAYER layr)
         (setq y (cadr bmin)
               h (* (getvar 'TEXTSIZE) 1.5)
         )      
         (vl-cmdf "_text" "_J" "_MC" (list (car pins) y)           0 (strcat "Reference Volume: " (rtos vref 2 1) " m3"))
         (setq v1 (entlast))
         (setvar 'CLAYER layp)
         (vl-cmdf "_text" "_J" "_MC" (list (car pins) (- y h))     0 (strcat " Proposed Volume: " (rtos vprop 2 1) " m3"))
         (setq v2 (entlast))
         (vl-cmdf "_text" "_J" "_MC" (list (car pins) (- y h h))   0 (strcat "      Cut Volume: " (rtos vcut 2 1) " m3"))
         (setq v3 (entlast))
         (vl-cmdf "_text" "_J" "_MC" (list (car pins) (- y h h h)) 0 (strcat "     Fill Volume: " (rtos vfill 2 1) " m3"))
         (setq v4 (entlast))
         
         (vl-cmdf "_MOVE" en3 en4 v1 v2 v3 v4 "" pins pause)
         (vl-cmdf "_VSCURRENT" "_S" "")
     )      
  )  
  (*error* nil)
)

;; 3df2sol                                                                    ;
;; Given a 3DFACE Loft it Down to Elevation 0                                 ;
;; Returns the ename of the Solid created.                                    ;

(defun 3df2sol (en / en1 en2 p1 p2 p3 p4)
  (setq  ent (entget en)
          p1 (cdr (assoc 10 ent))
          p2 (cdr (assoc 11 ent))
          p3 (cdr (assoc 12 ent))
          p4 (cdr (assoc 13 ent))
  )
  
  (setq en1 (entmakex
               (list 
                 (cons 0 "3DFACE")  
                                 (cons 10 (list (car p1) (cadr p1) 0.))
                                 (cons 11 (list (car p2) (cadr p2) 0.))
                                 (cons 12 (list (car p3) (cadr p3) 0.))
                                 (cons 13 (list (car p4) (cadr p4) 0.))
                               ) 
                    )
  )
  (vl-cmdf "_loft" en  en1 "_MO" "_SOLID" "" "")
  (entlast)
)   

 

 

 

ymg

Link to comment
Share on other sites

ymg,

I have looked at the algorithms suggested by Duckhams et al and results of your code and have come to realised that it somehow failed to choose the correct one to use for the Delaunay triangulation. They seem to have implemented in Jave way back in 2008 on an Australian government sponsored initiative. However after getting the tin you can go backwards by invoking Xshape and erase all triangles step by step until you have no triangles at all. For that you need to press + and left click after xshape in succession.

After this exercise I hope to start a thread on using AutoCAD as an editor for the design and drafting of structures (another MT. Everest). I believe Acad has all the features necessary including animation of a 3D model. Please comment then.

Regards,

Aloy

Link to comment
Share on other sites

manohar,

 

I've done very little work on volume calculation.

 

Here an experimental program not included in triangulation yet:

 

ymg

 

 

Thanks . Your little work seems very big to me.

I have attached a dwg in which i tried your code.

I am getting 4 x 3d Solids instead of 2 x 3d Solids.

I deleted extra solid and then tried Union. But i don't know how to proceed further.

Please advice.

 

Manohar.

Drawing2.dwg

Link to comment
Share on other sites

  • 4 years later...

Sir,

i am trying to create contour with contour value. but i can't any one can help me. i need bellow types of contour in smooth line. and all contour in a layer and same color.  Pls help me. as bellow given attached file, 

image.thumb.png.e2823d40d4edf254e15db28cb15204bf.png

Link to comment
Share on other sites

  • 2 weeks later...

Hello ymg3 and Bigal,

That lisp was perfect but its something missing. triangulation is also make good but can you help me something more please.....

i need Interpolation in grid pattern on that triangulation  surface. please help me.

 

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