I have a DGN file with several features. Let us for the sake of example, take two buildings, which have sloping roofs. I wish to extract the coordinates of each of the facets of each of the buildings and print to a text file. How do I do this?
Hi,
you posted your question is such way and with so big lack of information, that it's not possible to answer it.
Unknown said:I have a DGN file with several features
What do you mean by features? It's common term used very different way by many software, very often it's used in GIS. Are your features Bentley Map XFM featuers or it's simply your own naming for plain MicroStation elements or they are created by specific application (e.g. AECOsim Building Designer)?
Unknown said:take two buildings, which have sloping roofs
OK, it sounds like 3D objects. In such case, how they were created?
Unknown said:How do I do this?
In what language? Are there any other requirements exist?
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Thanks for that really helpful reply. I have attached the DGN file. Now please tell me! I have to extract each of the polygonal facets of the solid and extract the corners of each of the vertices and report to a text file.
Hi shudh,
That would be a wonderful task to use programming facilities of Microstation. As far as I know there is no standard tool to do that. I would recommend to do that in VBA. (It is under Utilities>Macro).
Yes True! I require the VBA Code only. Unfortunately the documentation of MS Bentley v8i is not so good. So I was expecting some help from here!
I am not sure how do you mean your note about helpful, if it's serious or irony, but you stil have not answered my questions, so some information are still missing.
You have not mentioned what language you prefer or want to use ... because Smart Solids are used, you should use MDL Solid API in MDL or SmartSolid and SmartSolidElement objects in VBA. Both API provide methods how to extract information from SmartSolid element. These elements have no inteligence, so it's up to you to investigate how to identify "roof faces", but if the buildings are so simple as in your example file, any face that is not collinear or perpendicular to XY plane is the roof face.
The rest is up to your programming knowledge to iterate through all solid faces/surfaces and export the information to text file.
I need the code to extract the facets! Either give me a VBA code or point me to a resource where I can find the answer! According to my knowledge of British English, the question is complete as well!
As far as I know there is no such example because Solid API in VBA is pretty new, it was introduced in V8i (SELECTseries 3), so probably not many users have used it so far.
Regards,
Unknown said:Give me a VBA code
It's your job to write the code. You have posted a question, and various people have provided suggestions. Nobody is going to give you the code, because it's unlikely that anyone has exactly the same task as you.
Unknown said:Point me to a resource where I can find the answer
You have that answer already: use the VBA SmartSolid and SmartSolidElement classes.
Unknown said:Unfortunately the documentation of MS Bentley v8i is not so good
The VBA SmartSolid and SmartSolidElement classes were introduced with MicroStation V8i SS3. They are documented in VBA help.
What do you think is lacking in 'MS Bentley v8i' documentation?
Regards, Jon Summers LA Solutions
My VBA Code needs to do the following:
(a) Find the individual buildings / solid elements present in the DGN file. No link in the documentation how to do that.
(b) Extract each of the facets in the polyhedral element. No link in the documentation how to do that
(c) Extract the vertices of each of the facets. No link in the documentation how to do that
Therefore, it is actually seen that I know the algorithm (what has to be done) but I do not know how to, as the VBA Help (obtained through Alt + F11) gives only the MS Visual Basic Help. There is no Microstation help present. Neither are code samples present where one can take a cue. The only thing which is seen is the Object Browser, which is as incomprehensible as possible.
I hope you understand what is lacking in the documentation. Maybe one should learn from the ArcObjects documentation!
Open the IDE.
Type In:
Dim el as Element
Point your cursor to the Word "Element".
Press F1.
(Please find a way to address your needs as kind questions.)
Best Regards,
Stefan.
Unknown said:VBA Help (obtained through Alt + F11) gives only the MS Visual Basic Help. There is no Microstation help present.
There is, if you press F1 when the cursor in on top of MicroStation VBA object/method/dim, MicroStation VBA help will open instead of the standard VBA help.
If it doesn't happen from any reason, you can find MicroStation VBA help file (MicroStationVBA.chm) in the same folder where MicroStation is installed (it's something like C:\Program Files (x86)\Bentley\MicroStation).
Unknown said:My VBA Code needs to do the following
That's a much better specification than your original post!
Unknown said:Find the individual buildings / solid elements present in the DGN file
The MicroStation idiom for finding things programmatically is to scan a model. Search VBA help for Scan, ElementScanCriteria and ElementEnumerator.
It's your job to define the criteria by which the scanner can identify a building, as opposed to some other kind of solid.
Unknown said:Extract each of the facets in the polyhedral element
Have you looked at the methods of SmartSolidElement?
Unknown said:VBA Help (obtained through Alt + F11) gives only the MS Visual Basic Help
It is usual in Windows for the F1 key to provide help. Key chord Alt + F11 opens the VBA Interactive Development Environment (IDE), not help.
The F1 key is context-sensitive. If the cursor is in a standard VBA keyword, then it pops Microsoft VBA help. If the cursor is in a MicroStation VBA keyword, then it pops MicroStation VBA help.
There are two help files: Microsoft VBA help and MicroStation VBA help. Microsoft VBA is generic — it applies to all implementations of VBA. VBA help is specific to MicroStation.
Unknown said:There is no MicroStation help present
MicroStation help is installed with the product. You will find the help files (*.chm) in the \MicroStation folder.