Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

created samplelines and sampled surfaces but samplieline sections count is 0

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
wang890
405 Views, 2 Replies

created samplelines and sampled surfaces but samplieline sections count is 0

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

 

Stantec
Dell Precision 5530, Prism M320PU, C3D 14/17/19
2 REPLIES 2
Message 2 of 3
wang890
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.

 

 

Stantec
Dell Precision 5530, Prism M320PU, C3D 14/17/19
Message 3 of 3
wang890
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

 

 

 

 

Stantec
Dell Precision 5530, Prism M320PU, C3D 14/17/19

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

Post to forums  

Rail Community


Autodesk Design & Make Report