I have not been able to get the code snippet out of the help examples (copied below) to return any value. I am trying to get the ItemTypeLibribry from my dgnlib without having one in my dgn.
Has anyone been able to get this work or is this a bug? I put '*' instead of '*a*' to try and get any it can find, but that didn't help either.
Dim oItemLibs As ItemTypeLibraries
Dim oItemLib As ItemTypeLibrary
Dim oDgn As designFile
Dim oAtt As Attachment
For Each oAtt In ActiveModelReference.Attachments
Set oDgn = oAtt.designFile
Set oItemLibs = New ItemTypeLibraries
Set oItemLib = oItemLibs.FindForDesignFile("*a*", oDgn, True, oItemLib)
If oItemLib Is Nothing Then Exit Do
a few comments:
Labyrinth Technology | dev.notes() | cad.point
With my MicroStation CONNECT Edition Update 13.1 the code seems to work fine: ItemType library in attached reference is displayed.
Sorry about the wrong formatting. I edited the initial post and hope it is correct now.
I am expecting the code to return the item type library from my dgnlib since it isn't in my active dgn file and I don't have any reference files attached. It sounds like you tried from a reference attachment. Could you please test to see if you can get the library returned from the dgnlib?
Paul Katalinich said:I don't have any reference files attached.
When you have no reference attached, why you iterate active model attachments?
Paul Katalinich said:if you can get the library returned from the dgnlib?
It seems dgnlibs are not included in searching, which seems to be bug.
That code was from the examples in the help. I assumed it has to iterate through attachments to get to the dgnlib if the Boolean parameter to include dgnlibs is set to true.
I will have to find another way until this bug is fixed.
Jan Šlegr said:It seems dgnlibs are not included in searching, which seems to be bug
I agree: one will often want to find an ItemTypeLibrary in a DGNlib, then copy it into the active DGN file. Once that ItemTypeLibrary is in the DGN file, we can use it to attach an Item Type instance to an element/model/file.
The VBA help documentation doesn't mention DGNlibs.
Regards, Jon Summers LA Solutions
there seems to be an issue with searching for ItemTypeLibraries in dgnlibraries using VBA.Just tested with recent build and the search was only successfull, if any other library was defined in the active dgn file.I will further investigate and let you know.
thanks a lot for your testing. It would be great whether it will be possible to include the check and fix to Update 14. I think it's something minor in the code, and as Jon wrote, dgnlibs are now everywhere and without dgnlib support, the method is pretty useless.
P.S. For me, it's another proof for (at least) VBA there are not any tests implemented, because when a feature is explicitly noted in documentation and there is even a parameter to control the feature and it does not work, the only reason can be "no test exists".
The first test results are confirmed and to address this issue the Defect # 1079197 is filed now with high priority and trying to get this fixed with Update 14.Best regards,Artur
Paul Katalinich said:I will have to find another way until this bug is fixed
Attach the DGNLib as a reference? Assuming that no graphic elements have been placed in the referenced model, it won't affect MicroStation's display. But the data in that referenced DGNLib should become available to the VBA Item Types API.
Let us know if that works.