- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This is more sort of a Programming question, but I was testing one thing in iLogic and I was having hard time to figure out how to accomplish this. See below code and explanation on what I am trying to achieve.
I have created two Arrays named as Occ1() and Occ2() as Doubles, and What I want to do it as I am iterating to two occurrences in my assembly, I would like to switch the arrays from Occ1() to Occ2() to save values of Points in two arrays. Lines which I think needs modification are added as Bold.
So the case is basically I have only two occurrences in my assembly and I am trying to get some geometrical data from both of them, and my intention is when my for loop iterates, first it will check my first occurrence and it saves the point data in Occ1() array and when it starts iterating the second occurrence, it saves that data in Occ2() array. I am not sure how to declare that or how to switch that.
Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition Dim oSS As SelectSet = oDoc.SelectSet Dim oOcc As ComponentOccurrence Dim Occ1(0) As Double Dim Occ2(0) As Double For Each oOcc In oDef.Occurrences Dim oPDef As PartComponentDefinition = oOcc.Definition Dim oBody As SurfaceBody = oPDef.SurfaceBodies.Item(1) i = 0 For Each oFace As Inventor.Face In oBody.Faces 'oSS.Clear If oFace.SurfaceType = SurfaceTypeEnum.kCylinderSurface Dim oFP As FaceProxy oOcc.CreateGeometryProxy(oFace, oFP) oSS.Select(oFP) Dim oCylinder As Cylinder = oFP.Geometry ReDim Preserve Occ1(i+1) Occ1(i) = Math.Round(oCylinder.BasePoint.X * 10, 0) 'In the next iteration I would like to make this Occ2(i), to save the values. i = i+1 End If Next Next
Any help on this will be highly appreciated. I would also welcome another suggestions apart from using two arrays to accomplish the same. My intention is to compare then these two array values.
Regards,
Dutt Thakar
Solved! Go to Solution.