AutoCAD Land Desktop (Read Only)
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Import ElevationContours

4 REPLIES 4
Reply
Message 1 of 5
Marv_McD
190 Views, 4 Replies

Import ElevationContours

Hi

Does anyone have sample code to import ElevationContour objects into autocad as AeccContour?


Sub contours()

Dim surfName As String
Dim surf As AeccSurface
Dim surfOut As AeccSurfaceOutputs
Dim surfIn As AeccSurfaceInputs
Dim bounds As AeccBoundaries
Dim Bound As AeccBoundary
Dim elevContours As AeccElevationContours


Dim contimport As AeccContour
Dim customobject As AcadObject



surfName = ActiveProject.Surfaces.CurrentSurface

Set surf = AeccApplication.ActiveProject.Surfaces.Item(surfName)
Set surfOut = surf.Outputs
Set surfIn = surf.Inputs

Set elevContours = surf.Outputs.ElevationContours
elevContours.Elevation = 227#


MsgBox "# Contours = " & elevContours.count
'set contimport.coordinates to ElevationContour.Coords
'set contimport.Elevation to ElevationContour.Elevation
'This is where I'm confused

Set customobject = AcadModelSpace.AddCustomObject(???)

End Sub


Tx in advance for assistance
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Marv_McD

Hi Marv,

I don't think there are APIs available to do this.

The best method is to use a "Sendcommand" to open the standard Create
Contour dialog box.

The user can then create contours to any desired settings
--


Laurie Comerford
CADApps
www.cadapps.com.au


"Marv_McD" wrote in message
news:f0d31f8.-1@WebX.maYIadrTaRb...
> Hi
> Does anyone have sample code to import ElevationContour objects into
autocad as AeccContour?
>
>
> Sub contours()
>
> Dim surfName As String
> Dim surf As AeccSurface
> Dim surfOut As AeccSurfaceOutputs
> Dim surfIn As AeccSurfaceInputs
> Dim bounds As AeccBoundaries
> Dim Bound As AeccBoundary
> Dim elevContours As AeccElevationContours
>
>
> Dim contimport As AeccContour
> Dim customobject As AcadObject
>
>
>
> surfName = ActiveProject.Surfaces.CurrentSurface
>
> Set surf = AeccApplication.ActiveProject.Surfaces.Item(surfName)
> Set surfOut = surf.Outputs
> Set surfIn = surf.Inputs
>
> Set elevContours = surf.Outputs.ElevationContours
> elevContours.Elevation = 227#
>
>
> MsgBox "# Contours = " & elevContours.count
> 'set contimport.coordinates to ElevationContour.Coords
> 'set contimport.Elevation to ElevationContour.Elevation
> 'This is where I'm confused
>
> Set customobject = AcadModelSpace.AddCustomObject(???)
>
> End Sub
>
>
> Tx in advance for assistance
>
Message 3 of 5
Anonymous
in reply to: Marv_McD

Here's a snippet of code I wrote for a routine that
automatically rebuilds the current surface and then spits out contours at
whatever contour interval ( my constant "cont_interval"). I use it for
grading on the fly, almost close to having dynamically updating contours, but I
still have to push a button. Haven't gotten around to adding any Events. This
will give you an idea how to generate contours though.

 

 

Fred

 

 

 

For cont = min_contour_elev To max_contour_elev
Step cont_interval
       
SurfOut.ElevationContours.Elevation =
cont
        x =
SurfOut.ElevationContours.Count
        If
x <> 0
Then
            For j
= 0 To x -
1
               
cont_coords =
SurfOut.ElevationContours.Item(j).Coordinates
               
Set draw_cont =
ThisDrawing.ModelSpace.AddCustomObject("AeccDbContour")
               
draw_cont.Coordinates =
cont_coords
               
draw_cont.Layer =
"grading-contour"
               
If cont Mod 5 = 0
Then
                   
draw_cont.Color =
acYellow
               
Else
                   
draw_cont.Color =
acGreen
               
End If
           
Next j
        End
If
    Next cont
Message 4 of 5
Marv_McD
in reply to: Marv_McD

Thanks,

My problem was I was setting the custom object to "AcadObject" as opposed to "AecContour"

Thanks for the help
Marv
Message 5 of 5
Anonymous
in reply to: Marv_McD

Hi Fred,

Thanks. It's nice to be demonstrated as wrong. I'll have to go and change
my DTM editing program now.

--


Laurie Comerford
CADApps
www.cadapps.com.au

"Fred Ernst" wrote in message
news:E079EDD389DCD20ECE4AA1841430208C@in.WebX.maYIadrTaRb...
> Here's a snippet of code I wrote for a routine that automatically rebuilds
the current surface and then spits out contours at whatever contour interval
( my constant "cont_interval"). I use it for grading on the fly, almost
close to having dynamically updating contours, but I still have to push a
button. Haven't gotten around to adding any Events. This will give you an
idea how to generate contours though.
>
>
> Fred
>
>
>
> For cont = min_contour_elev To max_contour_elev Step cont_interval
> SurfOut.ElevationContours.Elevation = cont
> x = SurfOut.ElevationContours.Count
> If x <> 0 Then
> For j = 0 To x - 1
> cont_coords =
SurfOut.ElevationContours.Item(j).Coordinates
> Set draw_cont =
ThisDrawing.ModelSpace.AddCustomObject("AeccDbContour")
> draw_cont.Coordinates = cont_coords
> draw_cont.Layer = "grading-contour"
> If cont Mod 5 = 0 Then
> draw_cont.Color = acYellow
> Else
> draw_cont.Color = acGreen
> End If
> Next j
> End If
> Next cont

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report