- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good afternoon! I need help with compiling a DLL for iLogic. I created a DLL for a general function, which I will call in several iLogic rules. However, I am unable to identify what I am doing wrong.
Here is the DLL code:
Imports Inventor
Namespace MedidasLibrary.NameSpace
Public Class MedidasHelper
Public Function ObterMedidas(ByVal modelo As String) As Object()
Select Case modelo
Case "2 SCH05"
Return New Object() {10, 10}
Case "2 SCH10"
Return New Object() {20, 20}
Case "2 SCH40"
Return New Object() {30, 30}
Case "2 SCH80"
Return New Object() {40, 40}
Case Else
Return New Object() {0, "Modelo inválido"}
End Select
End Function
End Class
End Namespace
This is the code where I am calling this DLL in the rule within Inventor, in iLogic:
AddReference "C:\Users\Projeto\source\repos\TesteTubos\bin\x64\Release\TesteTubos.dll"
Imports MedidasLibrary.NameSpace
Sub Main()
' Definir os modelos e seus parâmetros
Dim modelos As New Dictionary(Of String, String) From {
{"VENT", MODELO_VENT},
{"COND", MODELO_COND},
{"NOVO_MODELO", "2 SCH05"} ' Adicione novos modelos aqui
}
' Processar cada modelo
For Each modelo In modelos
Dim medidas As Object() = MedidasHelper.ObterMedidas(modelo.Value)
ApplyModel(modelo.Key, medidas(0), medidas(1))
Next
End Sub
' Função genérica para aplicar medidas a qualquer modelo
Sub ApplyModel(ByVal modelName As String, ByVal A As Object, ByVal B As Object)
Select Case modelName
Case "VENT"
Param_Vent1 = A ' DIÂMETRO POR EXEMPLO
Param_Vent2 = B ' ESPESSURA POR EXEMPLO
Case "COND"
Param_Cond1 = A
Param_Cond2 = B
Case "NOVO_MODELO"
' Parâmetros para o novo modelo
Param_Novo1 = A ' DIÂMETRO POR EXEMPLO
Param_Novo2 = B ' ESPESSURA POR EXEMPLO
End Select
' Atualizações
Parameter.UpdateAfterChange = True
iLogicVb.UpdateWhenDone = True
InventorVb.DocumentUpdate(True)
End Sub
When I run this rule, it returns the following error message:
Warning on Line 2: The namespace or type specified in Imports 'MedidasLibrary.NameSpace' does not contain any public members or cannot be found. Check if the namespace or type is defined and contains at least one public member. Verify that the imported element's name does not use aliases.
And
Error on Line 13: 'MedidasHelper' is not declared. It may be inaccessible due to its protection level.
Can someone help me? What am I doing wrong? The file was compiled in VB.NET as a Class Library (.NET Framework) (dll).
Solved! Go to Solution.