Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Add Boundary to TIN Surface

  1. #1
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Add Boundary to TIN Surface

    I am stuck trying to determine the proper syntax and arguments needed to programmatically add a polyline boundary to a TIN surface.

    I have successfully been able to access the surfaces collection, create a new (empty) surface, add points to that surface (via points file in the ..\Dtm\<SurfaceName>\ directory), and build the surface.

    ... But I still need an outer-boundary. Can someone help me out? I cannot find documentation for how to properly invoke this method.

    This is the method I have been experimenting with (unsuccessfully):

    Code:
    ;; Add boundary to surface
           (vlax-invoke-method
             (vlax-get (vlax-get new_aecSurfItem 'inputs) 'boundaries)
             'add
             ;| (vlax-safearray->list
             (vlax-variant-value
               (vla-get-coordinates
                 (vlax-ename->vla-object eName)))) |;
             (vlax-ename->vla-object eName)
             ;;eName
             "Boundary0"
             "Outer"
             "Yes"
             )
    This is the error message I get, in the current configuration:

    Code:
    lisp value has no coercion to VARIANT with this type:  #<VLA-OBJECT 
    IAcadLWPolyline 224bcb04>
    When done manually (i.e., right+click on the boundaries node within Terrain Model Explorer, select Add Boundary Definition), this is a copy of the command line:

    Code:
    Command: _AECTREEMGREVENT
    Select polyline for boundary:
    Boundary name <Boundary0>:
    Boundary type (Show/Hide/Outer) <Outer>:
    Make breaklines along edges? (Yes/No) <Yes>:
    Select polyline for boundary:
    What am I missing!?

    Edit: I am using AutoCAD Civil 3D Land Desktop Companion 2009
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Add Boundary to TIN Surface

    Check your syntax.
    The HELP file says...

    RetVal = object.Add(Type, bIsBreakLine, Coordinates[, Description])

    So the arguments to the 'Add method should be something like

    PHP Code:
    0
    :vlax-true
    (vlax-get-property (vlax-ename->vla-object eName"Coordinates")
    "Boundary0" 
    R.K. McSwain | CAD Panacea |

  3. #3
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Add Boundary to TIN Surface

    Quote Originally Posted by rkmcswain View Post
    Check your syntax.
    The HELP file says...

    RetVal = object.Add(Type, bIsBreakLine, Coordinates[, Description])

    RK, you're the man! That is exactly what I was missing!!

    Can you please tell me where you found this syntax listed?
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  4. #4
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Add Boundary to TIN Surface

    Quote Originally Posted by RenderMan View Post
    Can you please tell me where you found this syntax listed?
    Code:
    (strcat 
       (vl-registry-read 
          (strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key)) "ACADLOCATION") 
         "\\Help\\landauto-reference.chm"
    )
    R.K. McSwain | CAD Panacea |

  5. #5
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Add Boundary to TIN Surface

    You have much knowledge, RK.

    Cheers!
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Add Boundary to TIN Surface

    Thanks to your help, RK, I've successfully been able to add the boundary to the surface.

    However, the boundary is not acting on the surface properly.

    When viewed from Terrain Model Explorer, the boundary is correctly set to Outer, and set to Trim, but the boundary does not trim the surface at all.

    I've played with the various 'type' arguments when adding the boundary (0=Show, 1=Hide, 2=Outer, etc.). I've attempted to build the surface with just the points file, then add the boundary and re-build... no change. I've also attempted to add the boundary coordinates as a contour in lieu of the points (outside of the polyline), and this results in surface points off in space.

    Here is the code I've been using to add the points file, and boundary:

    Code:
    ;; Add points file to surface
    (setq pnts 
      (vlax-invoke-method
        (vlax-get (vlax-get surfObj 'inputs) 'pointfiles)
        'add
        textFilePath))
     
    ;; Add boundary to surface
    (setq bnd
      (vlax-invoke-method
        (vlax-get (vlax-get surfObj 'inputs) 'boundaries)
          'add
          ;;0                                                 ; Show
          ;;1                                                 ; Hide
          2                                                   ; Outer
          :vlax-true
          (vlax-get-property lineObj "Coordinates")
          "Boundary0"))
     
    ;; Build surface
    (vlax-invoke-method surfObj 'build)
    Something that caught my eye when reading through the Land Reference, is that the coordinates for the boundary should be in "Easting, Northing, Elevation format." The polyline I am selecting is at elevation 0. I've tried (vla-put-elevation lineObj basnElev) prior to (vlax-get-property lineObj 'coordinates), but the elevation is not included in the resulting points list.

    Could this be the reason for my boundary not trimming the surface?

    If so, how do I make pointList a variant of safearrays?

    Code:
    (foreach pt (vl-remove-if-not
                  '(lambda (x)
                     (= 10 (car x)))
                  (entget eName))
      (setq pointList (append (list (cadr pt) (caddr pt) basnElev) pointList)))
    Any help would be greatly appreciated.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  7. #7
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Add Boundary to TIN Surface

    Code:
    (defun AT:PointList->Array (lst)
      ;; Convert point list (must be appended first) to array
      ;; Alan J. Thompson, 09.16.09
      (if (vl-consp lst)
        (vlax-Make-Variant
          (vlax-SafeArray-Fill (vlax-Make-SafeArray vlax-vbDouble (cons 0 (- (length lst) 1))) lst)
        )
      )
    )
    
    
    (defun AT:GetVertexPoints (e / p l)
      ;; Return point at each vertex of LWPolyline or Polyline
      ;; e - LWPolyline, 2DPolyline, 3DPolyline
      ;; Alan J. Thompson, 09.20.10
      (if e
        (repeat (setq p (1+ (fix (vlax-curve-getEndParam e))))
          (setq l (cons (vlax-curve-getPointAtParam e (setq p (1- p))) l))
        )
      )
    )
    eg.
    Code:
    (AT:PointList->Array (apply 'append (AT:GetVertexPoints (car (entsel)))))
    Good for *Polylines (vla-object or ename).

  8. #8
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Add Boundary to TIN Surface

    Actually, this will keep you from having to append the point lists.


    Code:
    (defun AT:VertexPointsForArray (e / p l)
      ;; Return point at each vertex of LWPolyline or Polyline (in single list)
      ;; e - LWPolyline, 2DPolyline, 3DPolyline
      ;; Alan J. Thompson, 09.24.10
      (if e
        (repeat (setq p (1+ (fix (vlax-curve-getEndParam e))))
          (setq l (append l (vlax-curve-getPointAtParam e (setq p (1- p)))))
        )
      )
    )

  9. #9
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Add Boundary to TIN Surface

    Quote Originally Posted by RenderMan View Post
    Something that caught my eye when reading through the Land Reference, is that the coordinates for the boundary should be in "Easting, Northing, Elevation format."
    Quote Originally Posted by alanjt View Post
    Code:
    (defun AT:PointList->Array (lst)
      ;; Convert point list (must be appended first) to array
      ;; Alan J. Thompson, 09.16.09
      (if (vl-consp lst)
        (vlax-Make-Variant
          (vlax-SafeArray-Fill (vlax-Make-SafeArray vlax-vbDouble (cons 0 (- (length lst) 1))) lst)
        )
      )
    )
    Eureka!

    That was exactly the problem with my surface. Each point along the boundary, requires the surface elevation.

    This is the first time I'm having to push data into a safearray/variant, as I am normally pulling the data out into a list (i.e., coordinates).

    While I was unable to code this myself, I am at least pleased I was able to deduce the problem myself. It feels good to know you were 'at least' on the the right track.

    I cannot thank you enough for your help, cheers!
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  10. #10
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Add Boundary to TIN Surface

    Good deal. Can't wait to see the finished product.

Page 1 of 2 12 LastLast

Similar Threads

  1. Better Surface Boundary
    By Wish List System in forum Civil 3D Wish List
    Replies: 2
    Last Post: 2013-10-24, 08:26 PM
  2. 2013: Label a surface boundary
    By WScottAllenPE in forum AutoCAD Civil 3D - Surfaces
    Replies: 3
    Last Post: 2013-04-11, 02:06 PM
  3. Surface boundary causes surface errors
    By cblendermann.91943 in forum AutoCAD Civil 3D - Surfaces
    Replies: 3
    Last Post: 2007-02-23, 12:57 PM
  4. Topography Surface Boundary
    By Batman in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2005-05-31, 09:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •