Your Products have been synced, click here to refresh
Unfortunately I haven't done *any* work in VB.NET (I use the superb Delphi (Pascal) environment when not programming PC-DMIS Basic, Excel or other exotic languages). Actually, I haven't done anything .NET...
I believe a collection must implement a certain interface/iterator to have "for each" to work - it looks like PC-DMIS is not doing it (or exporting it) in exactly the right way.
In theory, it looks like you should be able to write an iterator in VB - https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/for-each-next-statement might give some clues for a workaround.
Imports PCDLRN Imports System.Collections Imports System.Runtime.CompilerServices Module Module1 Sub Main() Dim app As Application = CreateObject("PCDLRN.Application", "") Dim prg As PartProgram = app.ActivePartProgram Dim cmds As Commands = prg.Commands [COLOR=#0000CD] 'Dim cmds As List(Of Commands) = New List(Of Commands) From {app.ActivePartProgram.Commands}[/COLOR] ' [COLOR=#008000] 'This doesn't work either 'Dim cmds As Command = CTypeDynamic(Of System.Collections.IEnumerator)(app.ActivePartProgram.Commands) 'Debug.Print(cmds("PNT1").typedescription)[/COLOR] ' Casting cmds to object here works, but may as well declare as Object For Each cmd As PCDLRN.Command In CObj(cmds) Debug.Print(cmd.TypeDescription) Next End Sub End Module
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |