11-14-2019
08:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
11-14-2019
08:12 AM
I ran a quick test in VBA to grab RangeBox coords on all planar surfaces.
Sub EdgeLoopTest()
Dim app As Application
Set app = ThisApplication
Dim doc As Document
Set doc = app.ActiveDocument
Dim startTime As Date, endTime As Date
startTime = Now()
If doc.DocumentType = kPartDocumentObject Then
Dim count As Integer
Dim pDoc As PartDocument
Set pDoc = doc
Dim cDef As ComponentDefinition
Set cDef = pDoc.ComponentDefinition
Dim srfBods As SurfaceBodies
Set srfBods = cDef.SurfaceBodies
Dim srfBod As SurfaceBody
For Each srfBod In srfBods
If srfBod.IsSolid Then
Dim sFaces As Faces
Set sFaces = srfBod.Faces
Dim sFace As Face
Dim eLoop As EdgeLoop
For Each sFace In sFaces
If sFace.SurfaceType = kPlaneSurface Then
For Each eLoop In sFace.EdgeLoops
'Dim x1 As Integer, x2 As Integer, y1 As Integer
'Dim y2 As Integer, z1 As Integer, z2 As Integer
Dim mn() As Double
Dim mx() As Double
eLoop.RangeBox.MinPoint.GetPointData mn
eLoop.RangeBox.MaxPoint.GetPointData mx
'x1 = eLoop.RangeBox.MinPoint.x
'y1 = eLoop.RangeBox.MinPoint.y
'z1 = eLoop.RangeBox.MinPoint.z
'x2 = eLoop.RangeBox.MaxPoint.x
'y2 = eLoop.RangeBox.MaxPoint.y
'z2 = eLoop.RangeBox.MaxPoint.z
count = count + 1
Next
End If
Next
End If
Next
End If
endTime = Now()
End SubThe part I tested had over 4800 faces and it ran in less than a second. I tried it with both the GetPointData and directly getting the XYZ properties. Same amount of time on both ways. I haven't tried it in an addin in c#. I'm not sure why it's so slow for you?