cycle through polygons and create Boundaries - LDD4

Discussion in 'AutoCAD' started by Craig Barrett, May 21, 2004.

  1. Hi, I've used VBA a little, need help with some LDD4 and Civil commands. I
    want to take all polygons (polylines) in a drawing and cycle through them to
    perform the same tasks on each. The polygons are watershed basins and I
    need to use each polygon as a boundary and from that boundary create a grid
    of 3d polylines then create a pond from the resulting linework and finally
    get a stage storage curve from this. I am using only one surface and
    simply need to delete the old boundary create the new boundary. Is there
    any access to Grading or Hydrology through VBA? Right now I have the
    following code:

    Sub Delete_first_Boundary()

    Dim surf As AeccSurface
    Dim bounds As AeccBoundaries
    Dim Bound As AeccBoundary
    Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
    Set bounds = surf.Inputs.Boundaries
    Set Bound = bounds.Item(0)

    ' Delete the old Boundary
    bounds.Delete Bound.Id

    ' Add a new Boundary

    Dim returnObj As AcadObject
    Dim selection As Variant
    Dim basePnt As Variant
    On Error Resume Next

    'this doesn't work - any ideas?
    ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"
    bounds.Add kBoundaryTypeOuter, False, returnObj, "NEW BOUNDARY"

    End Sub
     
    Craig Barrett, May 21, 2004
    #1
  2. Craig Barrett

    Steve Cannon Guest

    Craig,

    The correct form of adding to the Land ActiveX Boundaries Collection is:

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

    Where, Coordinates are a variant (array of doubles); input-only; in Easting,
    Northing, Elevation format.

    You cannot simply add the selected polyline object, you have to identify or
    filter the selected object as a LightweightPolyline, polyline, or
    3dpolyline; extract the coordinates (coordinates property); and then pass
    those coordinates to the bounds.add method. Note: the boundary coordinates
    need to be 3D, even though the Z value is not really used in the boundary
    application. If your selected object is a LightweightPolyline object, you
    will have to convert its coordinates array of 2D points to an array of 3D
    points with a zero or dummy Z value.

    No, Land Grading Objects and hydrology data is NOT exposed through the API.

    You have an pretty ambitious goal to code, good luck with it. There is a
    autodesk.aec.land-desktop.customization NG that you may wish to peruse, and
    post there for pertinent questions regarding the Land API.

    sc
     
    Steve Cannon, May 21, 2004
    #2
  3. Hi Craig,

    This sounds a highly ambitious project. Are you sure that you will use it
    enough to recover the programming time ?

    Bear in mind that once you have drawn the polyline you wish to use for a
    boundary, you can set up a set of "Standard slopes etc." for a grading
    object and attach a grading object defining a pond very quickly.

    Or you can draw in contours of the model at a very close spacing and use the
    contours to define your ponds.

    I would suggest you do an analysis of what your requirements are and how
    long it would take to do them with the standard tools, then how long you
    would take with your proposed program. Multiply each by the expected number
    of times you will do it Add on the program learning, programming time and
    programming debugging times and decide where to go from there.

    Other approaches which may warrant consideration are "stacking" menu
    commands onto an Icon, or using "Sendcommand" to carry out the standard Land
    Desktop, or Civil Design commands.

    As an example of this I wrote a program which had a user interface with
    buttons to call the 6 DTM editing commands in Land Desktop. On exit from
    the program it opened the create contours dialog box, allowing the user to
    edit and redraw contours all from one menu pick.

    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au


     
    Laurie Comerford, May 22, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.