TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ymg on April 29, 2015, 10:16:22 AM

Title: - = { Challenge } = - Best Way to Represent an Alignment in Vanilla Cad
Post by: ymg on April 29, 2015, 10:16:22 AM
How would you guys attach to a 3d polyline the data representing
a complete Road Center Line, all this in Vanilla Cad.

We need to be able to attach the horizontal and vertical curves.
The horizontals curves also might have spirals or easement curves.

All this to be able to select the 3dpoly and be linked with all that data.

ymg
Title: Re: - = { Challenge } = - Best Way to Represent a Road Center Line in Vanilla Acad
Post by: Swift on April 29, 2015, 10:23:37 AM
you have a design alignment now?

I'm not sure you can get an exact representation but a good representation is certainly possible, with a suitable Delta spacing of points.
Title: Re: - = { Challenge } = - Best Way to Represent a Road Center Line in Vanilla Acad
Post by: Swift on April 29, 2015, 10:26:04 AM
Is this a one time thing or will it be reoccurring and you need a process for it?
Title: Re: - = { Challenge } = - Best Way to Represent a Road Center Line in Vanilla Acad
Post by: ymg on April 29, 2015, 10:45:57 AM
Swift,

As you probably know there is  this triangulation program
that I've been working on for a while. (See attachment)

In it there is a function to extract a profile from the tin.
However right now the center line is represented by
an LWpolyline with bulges for horizontal curves.

To be truly useful what we need is an alignment
and extract the profile from this.

ymg

Title: Re: - = { Challenge } = - Best Way to Represent a Road Center Line in Vanilla Acad
Post by: Swift on April 29, 2015, 11:13:38 AM

I'm sorry but I do not know enough Lisp to even follow your code


Conceptually, I have some thoughts but I do not understand your process enough to be able to offer any meaningful guidance or a solution.


If I understand you correctly now you are seeking to take a designed centerline and by "designed centerline" I mean one generated with tangent segments and tangent curves which may or may not have polynomial spiral transitions.


And you wish to obtain a profile along this alignment from a tin.


The problem that I see is that you cannot maintain a true 3-D polyline with segments and still represent the elevation of every intersecting tin triangle edge. You could however intropolate every point of interest to an elevation on the tin but I doubt this is the solution you are after.


To the best of my understanding the only way to truly represent this is to decompose your horizontal alignments down to segments defined by the location of intersecting tin edges which then presents a few problems in that horizontal points of interest, i.e. what I would refer to as PC,PT, TS,SC,CS,ST will most likely not fall on a triangle edge and these points will have to be intropolated between the previous and next vertex or you will have to solve elevation of the point within the triangle that it resides


It is an interesting challenge

Title: Re: - = { Challenge } = - Best Way to Represent a Road Center Line in Vanilla Acad
Post by: ymg on April 29, 2015, 11:32:41 AM
Swift,

The extraction from the tin is not really a problem.
Lots of details but can be managed.

What I am after is how to attach the pertinent details
to the 3d polyline.  More like a parametric representation.

We can always re-calculate on the fly the spiral or the
vertical curve as we extract.

My thinking is may be extended data, where we have
vertices number of the curve, and radius etc.

Then we have to be able to modify this data as we revised
the alignment.

As you say, interesting challenge.

ymg
Title: Re: - = { Challenge } = - Best Way to Represent a Road Center Line in Vanilla Acad
Post by: HasanCAD on April 30, 2015, 02:53:53 AM
error when run
Quote
Error: no function definition: MASSOC-FUZZ
Title: Re: - = { Challenge } = - Best Way to Represent a Road Center Line in Vanilla Acad
Post by: ymg on April 30, 2015, 04:59:19 AM
HasanCad,

Sorry about that,looks like I did too much
cleanup.

I corrected the above.

here are the functions.

Code - Auto/Visual Lisp: [Select]
  1. ;; assoc-fuzz   by Irneb                                                      ;
  2.  
  3. (defun assoc-fuzz (k l fuzz / found)
  4.   (while (and (setq found (car l)) (not (equal k (car found) fuzz)))
  5.     (setq l (cdr l))
  6.   )
  7.   found
  8. )
  9.  
  10. ;; massoc-fuzz    by Gile Chanteau (Modified to use Irneb's assoc-fuzz)       ;
  11. ;; Retourne la liste de toutes les valeurs pour le code spécifié              ;
  12. ;; dans une liste d'association                                               ;
  13. ;;                                                                            ;
  14. ;; Arguments                                                                  ;
  15. ;; key : la clé à rechercher dans la liste                                    ;
  16. ;; alst : une liste d'association                                             ;
  17. ;;                                                                            ;
  18.  
  19. (defun massoc-fuzz (k l fuzz)
  20.   (if (setq l (member (assoc-fuzz k l fuzz) l))
  21.      (cons (car l) (massoc-fuzz k (cdr l) fuzz))
  22.   )
  23. )
  24.  

ymg
Title: Re: - = { Challenge } = - Best Way to Represent a Road Center Line in Vanilla Acad
Post by: Lee Mac on April 30, 2015, 06:06:06 AM
massoc-fuzz could be simply:
Code - Auto/Visual Lisp: [Select]
  1. (defun massoc-fuzz ( key lst fuz )
  2.     (vl-remove-if-not '(lambda ( itm ) (equal key itm fuz)) lst)
  3. )

Or:
Code - Auto/Visual Lisp: [Select]
  1. (defun massoc-fuzz ( key lst fuz )
  2.     (apply 'append (mapcar '(lambda ( itm ) (if (equal key itm fuz) (list itm))) lst))
  3. )

Or:
Code - Auto/Visual Lisp: [Select]
  1. (defun massoc-fuzz ( key lst fuz / rtn )
  2.     (while lst
  3.         (if (equal key (car lst) fuz) (setq rtn (cons (car lst) rtn)))
  4.         (setq lst (cdr lst))
  5.     )
  6.     (reverse rtn)
  7. )

Or, if you really wanted to use recursion:
Code - Auto/Visual Lisp: [Select]
  1. (defun massoc-fuzz ( key lst fuz )
  2.     (cond
  3.         (   (null lst) nil)
  4.         (   (equal (car lst) key fuz) (cons (car lst) (massoc-fuzz key (cdr lst) fuz)))
  5.         (   (massoc-fuzz key (cdr lst) fuz))
  6.     )
  7. )
Title: Re: - = { Challenge } = - Best Way to Represent a Road Center Line in Vanilla Acad
Post by: ymg on April 30, 2015, 06:18:08 AM
Thanks!  Lee

In my case need to modify your proposal to:

Code - Auto/Visual Lisp: [Select]
  1. (defun massoc-fuzz (k l fuzz)
  2.     (vl-remove-if-not '(lambda (a) (equal k (car a) fuzz)) l)
  3. )



ymg
Title: Re: - = { Challenge } = - Best Way to Represent an Alignment in Vanilla Cad
Post by: ymg on May 03, 2015, 12:01:35 PM


Found some interesting stuff on the subject of Alignment:

   http://www.buildingsmart-tech.org/infrastructure/projects/alignment

ymg
Title: Re: - = { Challenge } = - Best Way to Represent an Alignment in Vanilla Cad
Post by: lamarn on May 03, 2015, 01:30:20 PM
 civil3d 2016 supports ifc2x3. Surely intresting to make a 'bridge' between bsa and autocad verticals.
Title: Re: - = { Challenge } = - Best Way to Represent an Alignment in Vanilla Cad
Post by: ymg on May 03, 2015, 01:35:54 PM
lamarn,

Yes, I could see that Autodesk had many of its vertical product certified.

Not sure I am up to it, but I'll study some.

ymg
Title: Re: - = { Challenge } = - Best Way to Represent an Alignment in Vanilla Cad
Post by: ymg on May 07, 2015, 07:08:42 AM
Thinking aloud! here.

How about attaching XML in extended data ?

However they are very verbose.

ymg
Title: Re: - = { Challenge } = - Best Way to Represent an Alignment in Vanilla Cad
Post by: dgorsman on May 07, 2015, 10:16:02 AM
Why bother with XML?  Extended data will handle anything XML can handle, and almost as gracefully.  The only thing it won't do is provide the advanced XPath syntax searching, but then again it can be built into the interface.  And it will do things that XML cannot do, like store persistent hard and soft pointers.
Title: Re: - = { Challenge } = - Best Way to Represent an Alignment in Vanilla Cad
Post by: ymg on May 07, 2015, 01:58:02 PM
dgorsman,

Quote
Why bother with XML?  Extended data will handle anything XML can handle, and almost as gracefully.

I essentially agree with you but for one point, there are standard schema for things like an alignment description.

So I believe it would maybe simplify the decoding part.  However I am very "Green Horned" as far as extended data is concerned.

ymg