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
Solved! Go to Solution.
Solved by wang890. Go to Solution.
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.
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