Ilogic, creating a groove for the circlip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everybody!
I am writing to inquire about the possibility of your assistance in debugging a program on ILOGIC. Specifically, I am seeking help in creating an add-on that builds a groove for a retaining ring. I would be grateful for any assistance with debugging a programme on ilogic. I am working on creating an add-on that will build a groove for a retaining ring. In the assembly, I set the retaining ring, then the programme starts, I select the cylindrical groove, then specify the retaining ring, and... that's it.
I am relatively new to this area of programming, specifically the integration of AI, and I am keen to understand the nuances involved.
' === Selection of the cylindrical face ===
Dim selectedFace As Face
Try
selectedFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select a cylindrical face for groove insertion")
Catch
MessageBox.Show("Selection cancelled.", "ESC")
Return
End Try
If selectedFace Is Nothing OrElse selectedFace.SurfaceType <> SurfaceTypeEnum.kCylinderSurface Then
MessageBox.Show("A non-cylindrical face has been selected.’, “Error”)
Return
End If
Dim faceProxy As FaceProxy = selectedFace
Dim occ As ComponentOccurrence = faceProxy.ContainingOccurrence
If occ Is Nothing Then
MessageBox.Show(‘Component not found.’, ‘Error’)
Return
End If
If Not occ.DefinitionDocumentType = DocumentTypeEnum.kPartDocumentObject Then
MessageBox.Show(‘The selected component is not a part.’, ‘Error’)
Return
End If
' === Step 2: Enter component editing ===
occ.Edit()
' === Step 3: Select the size of the retaining ring (DIN 471) ===
Dim ringSizes() As String = {"D20", "D25", "D30", "D35", "D40"}
Dim selectedSize As String = InputListBox(‘Select retaining ring size (DIN 471):", ringSizes, ringSizes(0), ‘Size’, “Ring”)
If selectedSize = "" Then
MessageBox.Show(‘Size not selected.’, “Cancel”)
occ.ExitEdit(13443)
Return
End If
' === Step 4: Assign parameters by size ===
Dim D As Double, b As Double, t As Double
Select Case selectedSize
Case "D20" : D = 19.8 : b = 1.1 : t = 0.55
Case "D25" : D = 24.8 : b = 1.1 : t = 0.55
Case "D30" : D = 29.8 : b = 1.4 : t = 0.65
Case "D35" : D = 34.8 : b = 1.4 : t = 0.65
Case "D40" : D = 39.8 : b = 1.75 : t = 0.85
Case Else
MessageBox.Show(‘Unknown size.’, ‘Error’)
occ.ExitEdit(13443)
Return
End Select
' === Step 5: Check iFeature file ===
Dim iFeaturePath As String = "C:\iFeatures\GrooveDIN471.ide"
If Not System.IO.File.Exists(iFeaturePath) Then
MessageBox.Show(‘iFeature file not found: ‘ & iFeaturePath, “Error”)
occ.ExitEdit(13443)
Return
End If
' === Step 6: Get the active part document ===
Dim oPartDoc As PartDocument = ThisApplication.ActiveEditDocument
' === Step 7: Create iFeature and set parameters ===
Dim iFeatDef As iFeatureDefinition
iFeatDef = oPartDoc.ComponentDefinition.iFeatures.CreateiFeatureDefinition(iFeaturePath)
iFeatDef.InputParameters.Item("D").Value = D
iFeatDef.InputParameters.Item("b").Value = b
iFeatDef.InputParameters.Item("t").Value = t
' Binding to the selected cylindrical face
If iFeatDef.InputEntities.Count > 0 Then
iFeatDef.InputEntities.Item(1).InputEntity = faceProxy
End If
' Insert iFeature
oPartDoc.ComponentDefinition.iFeatures.Add(iFeatDef)
' === Step 8: Exit editing and finish ===
occ.ExitEdit(13443) ' kToParent
MessageBox.Show(‘Groove successfully inserted for ring ‘ & selectedSize, “Done”)
Error 70:
@public member 'iFeatures' on type 'PartComponentDefinition' not found.@@
how to deal with it?
Inventor 2023, SP4, WIN10 22H