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.
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.
Regards, Jon Summers LA Solutions