70001976 Accessing IFC files from the VDF Wrapper vdraw.ocx

Article 70001976
Type HowTo
Product vdIFC
Version 8
Date Added 5/17/2021 12:00:00 AM
Fixed 9.9002.0.2 (5/17/2021 12:00:00 AM)
Submitted by Thomas Lihoreau

Summary

Is it possible to open IFC files using the ActiveX VDF component?

Solution

It is not possible to do this, the vdIFC component cannot be exported as ActiveX.
So in order to import an IFC file you need to create a c# .NET project that will do the convertion from IFC to VDML/VDCL and open this VDML/VDCL file from the ActiveX wrapper.
NOTE that in that case the IFC objects are converted to BlockReference objects (vdInsert / vdBlock)

So in a project C# .net framework 4 and up add references for VDF components like VectorDraw.Professional.dll and the and vdIFC.dll components then use the following code:

                vdIFC.vdIFCComponent ifccomponent = new vdIFC.vdIFCComponent();
                vdIFC.vdIFCDocument ifcdoc = ifccomponent.Open("yourfilename.ifc");
                if (ifcdoc != null)
                {
                    VectorDraw.Professional.Components.vdDocumentComponent vdfcomponent = ifcdoc.ToVDFComponent();
                    VectorDraw.Professional.vdObjects.vdDocument vddoc = vdfcomponent.Document;
                    vddoc.SaveAs("yourfilename.vdcl");
                    //open from your ocx the "yourfilename.vdcl"
                }

Send comments on this topic.