AutoCAD Civil 3D Customization

AutoCAD Civil 3D Customization

Reply
Mentor
831 Posts
7 Kudos
Registered: ‎06-08-2007
Post 1 of 3
Accepted Solution

created samplelines and sampled surfaces but samplieline sections count is 0

146 Views, 2 Replies
10-25-2012 05:00 PM

for each sample line it samples 6 surfaces. but i can't get the sampled surface object from the sampleline.

 

maybe need to commit something before running that code? like i think if i let the program finish just do the samplelines and add surface in. and then go in again it will show the section objects can be counted. bug in the com objects by autodesk? so many bugs all over the plac.

 

            'create sample line
            Dim oSampleline As AeccSampleLine = oSampleLineGroup.SampleLines.AddByStation(oPoint.Name, dStation, txtLeft.Text, txtRight.Text)

            oSampleLineGroup.SampledSurfaces.AddAllSurfaces(oAeccDb.SectionStyles.Item(0))

            For i As Integer = 0 To oSampleLineGroup.SampledSurfaces.Count - 1
                oSampleLineGroup.SampledSurfaces.Item(i).Sample = True
            Next

            oAcadDoc.Regen(Autodesk.AutoCAD.Interop.Common.AcRegenType.acAllViewports)

            For Each oSection As AeccSection In oSampleline.Sections
                If oSection.Links.Count <> 0 Then
                    If oSection.Surface.Name.Contains(txtEG_Indicator.Text) Then
                        'do nothing
                    End If

                    'get culvert length
                    Dim x1, x2, y1, y2 As Double
                    Dim dCulvertLength As Double

                    x1 = oSection.Links.Item(0).StartPointX
                    x2 = oSection.Links.Item(oSection.Links.Count - 1).EndPointX
                    y1 = oSection.Links.Item(0).StartPointY
                    y2 = oSection.Links.Item(oSection.Links.Count - 1).EndPointY

                    dCulvertLength = Sqrt((x2 - x1) ^ 2 + (y2 - y2) ^ 2) + CDbl(txtCulvertExtension.Text)

                End If
            Next

 

Civil 3D 2014
Work: i7 4770, SSD, 16GB, K2000, Dell PH2414H
Home: i7 3930k, SSD, 16GB, GTX 590, U3011

then again always 3 minutes later i search something and solve it myself. need to create sections at sample line.

 

what a pain. this is totally redundant. oh well.

 

 For i As Integer = 0 To oSampleLineGroup.SampledSurfaces.Count - 1
oSampleLineGroup.SampledSurfaces.Item(i).Sample = True
oSampleLineGroup.CreateSectionsAtSampleLine(oSampleline)
Next

 

 

 

 

Mentor
831 Posts
7 Kudos
Registered: ‎06-08-2007
Post 2 of 3

Re: created samplelines and sampled surfaces but samplieline sections count is 0

10-25-2012 05:08 PM in reply to: wang890

here's screenshot showing 6 surfaces are sampled ok but sections gives 0 count. this is my last step and it's crapping out on me. what the hell. seriously everytime the API has problems near the end.

 

 

Civil 3D 2014
Work: i7 4770, SSD, 16GB, K2000, Dell PH2414H
Home: i7 3930k, SSD, 16GB, GTX 590, U3011
Mentor
831 Posts
7 Kudos
Registered: ‎06-08-2007
Post 3 of 3

Re: created samplelines and sampled surfaces but samplieline sections count is 0

10-25-2012 05:17 PM in reply to: wang890

then again always 3 minutes later i search something and solve it myself. need to create sections at sample line.

 

what a pain. this is totally redundant. oh well.

 

     For i As Integer = 0 To oSampleLineGroup.SampledSurfaces.Count - 1
                oSampleLineGroup.SampledSurfaces.Item(i).Sample = True
                oSampleLineGroup.CreateSectionsAtSampleLine(oSampleline)
            Next

 

 

 

 

Civil 3D 2014
Work: i7 4770, SSD, 16GB, K2000, Dell PH2414H
Home: i7 3930k, SSD, 16GB, GTX 590, U3011
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post