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.
Sub FindItemTypeLibraryFromDesignFileAndDgnLibs() 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 Do Set oItemLib = oItemLibs.FindForDesignFile("*a*", oDgn, True, oItemLib) If oItemLib Is Nothing Then Exit Do Debug.Print oItemLib.LibName Loop Next End Sub
Jan,
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?
Thanks,Paul
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.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
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.
Thank you.
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.
ItemTypeLibrary
The VBA help documentation doesn't mention DGNlibs.
Regards, Jon Summers LA Solutions
Hi all,
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.
Best regards,
Artur
Hi Artur,
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.
With regards,
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