Author Topic: Triangulation (re-visited)  (Read 320694 times)

0 Members and 3 Guests are viewing this topic.

rw2691

  • Newt
  • Posts: 133
Re: Triangulation (re-visited)
« Reply #555 on: February 26, 2016, 11:01:51 AM »
YMG,

Attached are the 2 drawings.

Looking at the depression lines I suppose I have the wrong idea about what they are. My take is that the highest crest and lowest swale would be marked. You are marking the entire ascent and descent. Consequently I had thought that was a misfunction.

My guess on the sticks is that you are failing to pick up on an elevation. Perhaps grabbing a latitude or departure coordinate as an elevation. If so, that could be why all the previous tests had encountered a crash.

Some time back I had looked through the contour codes. I never saw where you weren't protecting against division by zero. That is why I had previously thought it might be an out of memory issue with the array. The sticks make me suspect that it is mismatched data that happens in the depression code. That everything works perfectly without the depression code encourages my opinion.

As to your getting angry (or maybe frustrated)... consider it a misread on my part from Reply #550.

Rick
Hippocrates (400BC), "Life is short, craft long, opportunity fleeting, experiment treacherous, judgment difficult."

ymg

  • Guest
Re: Triangulation (re-visited)
« Reply #556 on: February 26, 2016, 06:44:17 PM »
Rick,

Just change your linetype scale to 1 instead of 30.

Another way is to set variable sc in the depression handling
section to 1.0

Code - Auto/Visual Lisp: [Select]
  1. ; New Section to Handle Depression Contour           June 2015             ;
  2.    (if (= godep "1")
  3.       (progn
  4.          (setq ti (time))
  5.  
  6.          (or
  7.             (tblsearch "ltype" "Depression")
  8.             (mk_linetype
  9.                "Depression"
  10.                "____|____|____|____|____|____|__"
  11.                "A,.5,-.005,[\"|\",STANDARD,S=.06,R=0.0,X=-0.01125,Y=-.0725],-.005"
  12.             )
  13.          )
  14.  
  15.          (setq lt        (cons 6 "Depression")
  16.                sc        (cons 48 1.0)
  17.                majdepcol (cons 62 majdepcolor)
  18.                mindepcol (cons 62 mindepcolor)
  19.                lgclosed  (length ccont)
  20.          )
  21.  

What you call sticks are actually tick mark on the downslope side
of contours that wil retain water.

This is standard way on topograhical map.

Here's a sample of what you will get.

ymg
« Last Edit: February 26, 2016, 06:57:07 PM by ymg »

geobid

  • Mosquito
  • Posts: 4
  • Some people doing impossible.
Re: Triangulation (re-visited)
« Reply #557 on: February 28, 2016, 04:44:03 AM »
Hi

I following this post for some time. Because I want to use it, let me make a few comments:
1) Is:
   (prompt "\nSelect a Linear Entity: ")           
   (if (setq s (ssget "+.:L:S" '((0 . "*LINE")))) 
      (progn                                       
         (setq en (ssname s 0)                     
              ent (entget en)                     
         )...

Should be:
   (prompt "\nSelect a Linear Entity: ")           
   (if (setq s (ssget "_+.:L:S" '((0 . "*LINE")))) 
      (progn                                       
         (setq en (ssname s 0)                     
              ent (entget en)                     
         )...

2) In your procedures you use global variables, it causes some problems when they are not reset it to the default values.

3) Depression should be optional

4) PROF should be able to determine the location of the beginning and the end of line.

I made my own DCL because the original are not optimal for me. I can share it but in Polish language.

I am impressed yours work you've put in here.
Regards

ymg

  • Guest
Re: Triangulation (re-visited)
« Reply #558 on: February 28, 2016, 06:29:38 AM »
geobid,

Will modify item 1 Thanks!

Agree that global variable can cause problems,
but I have many c: function that would need
you to do a selection otherwise.  Still the program
needs a lot of clean-up, this is why version number
is still at 0.xx (beta)

On item 3 I've already change the dcl and the program
to make depression optionnal. (Not published yet)

Item 4, I do not understand your comment there.
As it is, 0+000 is at beginning of line.  However you
can change that value in the dcl.

Thanks for your praises and constructive comments.

ymg


geobid

  • Mosquito
  • Posts: 4
  • Some people doing impossible.
Re: Triangulation (re-visited)
« Reply #559 on: February 28, 2016, 08:37:35 AM »
Thank you for your interest

Explain what's going on in section 4
If you generate a profile and line profile exceeds the limits of the surface
 program calculates odd values beyond the boundary. To prevent proposes
 adding the ability to indicate or give points on which you should count profile.

 In Annex is an example.


I have a suggestion
Maybe it's better to give up the command "acet-ui-progress" because it does not work best in higher versions of AutoCAD
and use something like this:

LISP:


;-------------------------------------------------------------------------------
; ProgressBar - Progress Bar
; Arguments: 3
;   Title$ = Dialog title
;   Message$ = Message to display
;   Delay~ - Percentage of *Speed# variable
; Example: (ProgressBar "Program Message" "Processing information..." 0.5)
;-------------------------------------------------------------------------------
(defun ProgressBar (Title$ Message$ Delay~)
  (setq *Delay~ Delay~)
  (if (not *Speed#) (Speed))
  (setq *Dcl_Id% (load_dialog "war.dcl"))
  (new_dialog "ProgressBar" *Dcl_Id%)
  (if (= Title$ "")(setq Title$ "AutoCAD Message"))
  (if (= Message$ "")(setq Message$ "Processing information..."))
  (set_tile "Title" (strcat " " Title$))
  (set_tile "Message" Message$)
  (setq *X# (1- (dimx_tile "ProgressBar")))
  (setq *Y# (1- (dimy_tile "ProgressBar")))
  (start_image "ProgressBar")
  (vector_image 0 2 2 0 8 )
  (vector_image 2 0 (- *X# 2) 0 8 )
  (vector_image (- *X# 2) 0 *X# 2 8 )
  (vector_image *X# 2 *X# (- *Y# 2) 8 )
  (vector_image (- *X# 2) *Y# *X# (- *Y# 2) 8 )
  (vector_image (- *X# 2) *Y# 2 *Y# 8 )
  (vector_image 2 *Y# 0 (- *Y# 2) 8 )
  (vector_image 0 (- *Y# 2) 0 2 8 )
  (end_image)
  (setq *Inc# 0 *Xpt# -4)
  (princ)
);defun ProgressBar
;-------------------------------------------------------------------------------
; Progress - Move the Progress Bar
;-------------------------------------------------------------------------------
(defun Progress (/ Complete$)
  (setq *Inc# (1+ *Inc#))
  (if (= (rem *Inc# 2) 1)
    (setq *Xpt# (+ *Xpt# 7))
  );if
  (start_image "ProgressBar")
  (if (> *Inc# 100)
    (progn
      (setq *Inc# 0 *Xpt# -4)
      (start_image "ProgressBar")
      (fill_image 3 3 (- *X# 5) (- *Y# 5) -15)
    );progn
    (progn
      (vector_image *Xpt#  3 (+ *Xpt# 4)  3 120)
      (vector_image *Xpt#  4 (+ *Xpt# 4)  4 110)
      (vector_image *Xpt#  5 (+ *Xpt# 4)  5 110)
      (vector_image *Xpt#  6 (+ *Xpt# 4)  6 100)
      (vector_image *Xpt#  7 (+ *Xpt# 4)  7 100)
      (vector_image *Xpt#  8 (+ *Xpt# 4)  8  90)
      (vector_image *Xpt#  9 (+ *Xpt# 4)  9  90)
      (vector_image *Xpt# 10 (+ *Xpt# 4) 10  90)
      (vector_image *Xpt# 11 (+ *Xpt# 4) 11  90)
      (vector_image *Xpt# 12 (+ *Xpt# 4) 12 100)
      (vector_image *Xpt# 13 (+ *Xpt# 4) 13 100)
      (vector_image *Xpt# 14 (+ *Xpt# 4) 14 110)
      (vector_image *Xpt# 15 (+ *Xpt# 4) 15 110)
      (vector_image *Xpt# 16 (+ *Xpt# 4) 16 120)
    );progn
  );if
  (end_image)
  (setq Complete$ (strcat (itoa (fix (+ *Inc# 0.5))) "% Wykonano..."))
  (set_tile "Complete" Complete$)
  (delay *Delay~)
  (action_tile "cancel" "(done_dialog)(exit)")
  (if (= *Inc# 100)(delay 10));Delay to show complete
  (princ)
);defun Progress
;-------------------------------------------------------------------------------
; EndProgressBar - Close Progress Bar dialog and clear variables
;-------------------------------------------------------------------------------
(defun EndProgressBar ( )
  (setq *Delay~ (* *Delay~ 0.5));Speed up bars remaining
  (if (and (> *Inc# 0)(< *Inc# 100))
    (repeat (- 100 *Inc#) (Progress))
  );if
  (done_dialog)
  (start_dialog)
  (unload_dialog *Dcl_Id%)
  (setq *Dcl_Id% nil *Delay~ nil *Inc# nil *X# nil *Xpt# nil *Y# nil)
  (princ)
);defun EndProgressBar
;-------------------------------------------------------------------------------
; Speed - Determines the approximate computer processing speed and sets the
; global variable *speed# which may be used in delay loops while in dialogs.
;-------------------------------------------------------------------------------
(defun Speed (/ Cdate~ Cnt# NewSecond# OldSecond#)
  (setq Cdate~ (getvar "CDATE"))
  (setq NewSecond# (fix (* (- (* (- Cdate~ (fix Cdate~)) 100000)(fix (* (- Cdate~ (fix Cdate~)) 100000))) 10)))
  (repeat 2
    (setq Cnt# 0)
    (setq OldSecond# NewSecond#)
    (while (= NewSecond# OldSecond#)
      (setq Cdate~ (getvar "CDATE"))
      (setq NewSecond# (fix (* (- (* (- Cdate~ (fix Cdate~)) 100000)(fix (* (- Cdate~ (fix Cdate~)) 100000))) 10)))
      (setq Cnt# (1+ Cnt#))
    );while
  );repeat
  (setq *Speed# Cnt#)
  (princ)
);defun Speed
;-------------------------------------------------------------------------------
; delay - time delay function
; Arguments: 1
;   Percent~ - Percentage of *Speed# variable
; Returns: time delay
;-------------------------------------------------------------------------------
(defun delay (Percent~ / Number~)
  (if (not *Speed#) (Speed))
  (repeat (fix (* *Speed# Percent~)) (setq Number~ pi))
  (princ)
);defun delay
;-------------------------------------------------------------------------------
(princ);End of ProgressBar.lsp


And DCL:

//------------------------------------------------------------------------------
// Program Name: ProgressBar.dcl [Progress Bar R3]
// Created By:   Terry Miller (Email: terrycadd@yahoo.com)
//               (URL: http://web2.airmail.net/terrycad)
// Date Created: 6-20-04
// Function:     Progress Bar dialog
//------------------------------------------------------------------------------
// Revision History
// Rev  By     Date    Description
//------------------------------------------------------------------------------
// 1    TM    6-20-04  Initial version
// 2    TM    2-20-05  Divided initial function into three functions, ProgressBar,
//                     Progress, and EndProgressBar to be used in loops.
// 3    TM    1-20-07  Updated progress bar dialog design.
//------------------------------------------------------------------------------
// ProgressBar - Progress Bar dialog
//------------------------------------------------------------------------------
ProgressBar : dialog {
  key = "Title";
  label = "";
  spacer;
  : text {
    key = "Message";
    label = "";
is_default = true;
  }
  : row {
    : column {
      : spacer { height = 0.12; fixed_height = true;}
      : image {
        key = "ProgressBar";
        width = 58.92; fixed_width = true;
        height = 1.51; fixed_height = true;
        aspect_ratio = 1;
        color = -15;
        vertical_margin = none;
is_default = false;
      }
      spacer;
    }
//    cancel_button;
  }
  : text {
    key = "Complete";
    label = "";
is_default = false;
  }
}// ProgressBar
//------------------------------------------------------------------------------

« Last Edit: February 28, 2016, 08:56:08 AM by geobid »

ymg

  • Guest
Re: Triangulation (re-visited)
« Reply #560 on: February 28, 2016, 09:01:18 AM »
Geobid,

I see your point, but do not understand why you
would generate an alignment that is not in your TIN.

The progress bar is simply an attempt at preventing
Autocad hanging when in the middle of a long lisp.
I admit that it is not entirely successful at it.

I'll look at what you propose, but If I am to change progress bar,
I lean on the side of ElpanovEvgenyi's modemacro solution.

ymg

geobid

  • Mosquito
  • Posts: 4
  • Some people doing impossible.
Re: Triangulation (re-visited)
« Reply #561 on: February 28, 2016, 09:14:46 AM »
YMG

Of course this is just my suggestion.

Because I am a "lazy" user therefore it is easier for me to draw a line profile as in Figure 1.

This MODEMACRO of Elpanov Evgenyi's is very good :)

Thank you for your interest and best regards.
« Last Edit: February 28, 2016, 09:40:56 AM by geobid »

rw2691

  • Newt
  • Posts: 133
Re: Triangulation (re-visited)
« Reply #562 on: February 28, 2016, 10:00:05 AM »
YMG,

Setting ltscale to 1 did make the depression linetype display, and my setting had made the sticks. I was wondering why I have never seen a depression linetype. I had tried to change celtype, which is how I typically manage independent objects, but the reach from 30 to 1 was not showing up by my normal entries for it (0.1 to 0.9).

However, I use ltscale as a global control for object, text, and line sizes. Setting it to 30 is a drafting scale of 1"=30' when printed (with lines thickened by color). All production within my system is designed to work that way. As mentioned, using celtscale for depression lines might be a better choice with the varied systems that people use.

But there is another issue I have noticed. Using the two drawings that I posted... At approximately the coordinates of (4980,4229) are some line sections that aren't supposed to be there. I have attached the depression and no depression images for that area. By my point data there are 2 TIN's near the location. They are the TIN by points 212, 213, and 224 (just below this TIN). Then also points 225, 217, and 208 (within this TIN).

Rick
Hippocrates (400BC), "Life is short, craft long, opportunity fleeting, experiment treacherous, judgment difficult."

rw2691

  • Newt
  • Posts: 133
Re: Triangulation (re-visited)
« Reply #563 on: February 28, 2016, 10:22:03 AM »
YMG,

I might add that the points are replicated about thirty times across the drawing, and this is the only area that I noticed for having bogus lines.

I would also like to add that geobid's idea is one that I am sympathetic toward. It may not be good design practice to just slash a line across the TIN's, but that is what a lot of people will do. How he is suggesting to handle it is forcing them into good practice.

Rick
Hippocrates (400BC), "Life is short, craft long, opportunity fleeting, experiment treacherous, judgment difficult."

ymg

  • Guest
Re: Triangulation (re-visited)
« Reply #564 on: February 28, 2016, 11:27:49 AM »
Rick,

The two extra lines should not be there. So I don't know, currently revisiting
the contour generating routine.  Might be a bit early to claim victory, but so
far I found a simple way to handle the dreaded even contour.

Also in the process of revising c:flip to handle contours and update them as
you flip an edge.  Good progress there but still some bugs.

I did find that insertion of constraint could creates under some condition some
clockwise 3dfaces which could cause problems. (All 3dfaces should wind CCW.

For the linetype scale, you could adjust it in the code as I proposed.  This way
you could keep your global settings.

Also done some progress in the generation of cross section.

For the alignment, if peoples want to slash a line, they may.
They will however get a section of their profile dropping to zero
when they are outside the tin.

ymg

rw2691

  • Newt
  • Posts: 133
Re: Triangulation (re-visited)
« Reply #565 on: February 28, 2016, 12:01:14 PM »
YMG,

I have assumed that the code in Reply #556 is missing some parenthesis. Is the following a correct way to patch it in?

Code: [Select]
; New Section to Handle Depression Contour           June 2015             ;
       (if (= godep "1")
          (progn
             (setq ti (time))
     
             (or
                (tblsearch "ltype" "Depression")
                (mk_linetype
                   "Depression"
                   "____|____|____|____|____|____|__"
                   "A,.5,-.005,[\"|\",STANDARD,S=.06,R=0.0,X=-0.01125,Y=-.0725],-.005"
                )
             )
     
             (setq lt        (cons 6 "Depression")
                   sc        (cons 48 1.0)
                   majdepcol (cons 62 majdepcolor)
                   mindepcol (cons 62 mindepcolor)
                   lgclosed  (length ccont)
             )
          )
       )
       
   ;; the above replaces the below...
   
   ;; New Section to Handle Depression Contour           June 2015             ;

   ;;(setq ti (time))
   
   ;;(or (tblsearch "ltype" "Depression")
   ;;    (mk_linetype "Depression" "____|____|____|____|____|____|__"
   ;;                 "A,.5,-.005,[\"|\",STANDARD,S=.06,R=0.0,X=-0.01125,Y=-.0725],-.005"
   ;;    )
   ;;)


Rick
« Last Edit: February 29, 2016, 07:31:29 AM by rw2691 »
Hippocrates (400BC), "Life is short, craft long, opportunity fleeting, experiment treacherous, judgment difficult."

rw2691

  • Newt
  • Posts: 133
Re: Triangulation (re-visited)
« Reply #566 on: February 28, 2016, 12:33:10 PM »
YMG,

I inserted geobid's modification to the depression linetype, and your code (as I posted) for an sc variable.

I also used my new points that have elevations above x.004', but with no 650' break lines.

It all computed properly. No crash, and none of the orphaned contour segments.

However, the sc variable did not remedy the ltscale = 30 issue. I had to set it to 1.

Rick
Hippocrates (400BC), "Life is short, craft long, opportunity fleeting, experiment treacherous, judgment difficult."

rw2691

  • Newt
  • Posts: 133
Re: Triangulation (re-visited)
« Reply #567 on: February 28, 2016, 12:55:06 PM »
YMG,

I rebuilt everything again, but inserting the 650' break lines. Same results. No "nil" crash. Depressions all normal.

So is it the x.004' fix to the point data, or something to do with the linetype command, or your patch to try and remedy the ltscale problem?

It didn't have a problem with the 650' break line, so expect that the x.004' fix wasn't necessary as well.

I have noticed one thing however... between selecting the TIN's and the start of producing contours is a lengthy time period that does not have a progress bar.

Rick.
« Last Edit: February 28, 2016, 12:58:51 PM by rw2691 »
Hippocrates (400BC), "Life is short, craft long, opportunity fleeting, experiment treacherous, judgment difficult."

ymg

  • Guest
Re: Triangulation (re-visited)
« Reply #568 on: February 28, 2016, 01:52:11 PM »
Rick,

The Depression linetype gets created only if it is not already
in the drawing.

So before running the code make sure you unload that linetype
from the drawing.  In order to do that you need to erase all the
contours then run.

Then you will see the effect of changing the value of sc.

Your patching is ok, all you need is to change the value of sc.
I believe originally it was set at 48.0, but with a global ltscale of 30
you might need to go even lower than 1.0


ymg
sc.
« Last Edit: February 28, 2016, 02:00:29 PM by ymg »

rw2691

  • Newt
  • Posts: 133
Re: Triangulation (re-visited)
« Reply #569 on: February 28, 2016, 01:58:26 PM »
YMG,

I noticed that I had better remove...

(setq lt (cons 6 "Depression") sc (cons 48 48.0) majdepcol (cons 62 majdepcolor) mindepcol (cons 62 mindepcolor))

I also realized that the parenthesis that I added were too early. I moved them to include the entire depression code.

I also included a (set godep "1") since godep isn't implemented in the dcl yet.

Now it works. ltscale can be anything.

Don't know if everything is fixed... but for now it all works.

Rick
   
« Last Edit: February 29, 2016, 07:03:53 AM by rw2691 »
Hippocrates (400BC), "Life is short, craft long, opportunity fleeting, experiment treacherous, judgment difficult."