The video sample object is a specialized implementation of the IMFSample interface for use with the Enhanced Video Renderer (EVR). To create an instance of this object, call the MFCreateVideoSampleFromSurface function. The function takes a pointer to a Direct3D surface and returns a pointer to the IMFSample interface. The following types of objects should allocate samples using this function:
Custom EVR presenters. A presenter allocates video samples and sends them to the mixer's IMFTransform::ProcessOutput method. For more information, see How to Write an EVR Presenter.
Video decoders that support video acceleration. For more information, see Supporting DXVA 2.0 in Media Foundation.
Import video files just as you would import a transcript or other file into your TextMap case. When the import is complete, the transcript displays in the Transcript List with a video icon that is different than the icon for text-only transcripts.
The video sample object implements the following interfaces:
If the pUnkSurface parameter of MFCreateVideoSampleFromSurface is non-NULL, the resulting video sample contains a single media buffer that encapsulates the Direct3D surface. This buffer object has limited functionality:
The buffer's IMFMediaBuffer::Lock method returns E_NOTIMPL.
The buffer does not implement the IMF2DBuffer interface.
The only way to access the surface from the buffer is to call IMFGetService::GetService, using the service identifier MR_BUFFER_SERVICE.
If the pUnkSurface parameter is NULL, the video sample is created with zero media buffers. To add a buffer the sample, do the following:
Create a Direct3D surface.
Create a surface buffer by calling MFCreateDXSurfaceBuffer. For more information, see DirectX Surface Buffer.
Add the buffer to the sample by calling IMFSample::AddBuffer.
Use this approach if you need the surface memory to be accessible through the IMF2DBuffer interface.
SolidProfessor - Sam Sanchez May 10, 2016 Comment
Not all CAD programs have the same capabilities as and so exchanging things like a STEP file between SOLIDWORKS and other CAD software packages can become troublesome.
The International Standard Organization (ISO) tried to solve this by creating a uniform standard format. The full name is the Standard for The Exchange of Product Model Data or more commonly, a STEP file.
This file format is well-known and is a widely used way to exchange CAD data between platforms.
Exporting a STEP file out of SOLIDWORKS is easy. With a part file open, you just go to “File,” select “Save as…” and choose STEP as the file type.
However, importing a STEP file from another system can be a little tricky. In the video tutorial above, we have a STEP file received from a vendor that we’d like to look at and potentially modify in SOLIDWORKS.
The best way to import a STEP file is through the “File” drop-down menu. Select “Open” and change the file type to look for STEP files.
Before we click “Open,” click the “Options” button to go over some of the options. The “Import Options” dialog box appears.
The defaults are usually safe to use, but it sometimes pays to take a quick look before importing a STEP file to make sure you get the results you’re looking for.
Only the general settings are important here, as the STL/VRML and IDF settings only apply to specific files types and don’t apply to STEP files.
The “Surface/solid entities” checkbox and the “Free point/curve entities” control what exactly we’re trying to import. Users can import one or the other or both and each have some sub-options that let you control exactly what data you’d like to import from the STEP file.
If users check the “Surface/solid entities” checkbox, SOLIDWORKS will import any 3D geometry it can from the file.
Related checkboxes underneath allow users to ask SOLIDWORKS to try and form the surfaces into solid bodies, import a smaller number of total surfaces by knitting surfaces together or import them individually, resulting in the most possible bodies.
SOLIDWORKS can also merge entities.
In this example we’ll ask it to try and form solids if it can and to merge entities by selecting “Try forming solid(s)” and “Merge Entities,” to leave us with the least amount of bodies possible.
The “B-Rep mapping” box, if checked, will try and use boundary representation data, or B-Rep data, to directly map the typologies as it directly imports the data. This is faster than choosing the knit surfaces option, especially for importing complex models.
For this example, we’ll leave the B-Rep mapping box unchecked.
We can also choose to import point or curved entities to import the data as 2D and 3D sketch data, by selecting “Free point/curve entities.” This option is useful if you’re importing free points or free curves from either a CAD or analysis package. With this box checked, you can either have SOLIDWORKS import the data as sketches or as curve features. The user must decide which option will be best depending on how the data will be used.
STEP files can be imported as either part files or assembly files. If the file will contain multiple bodies, SOLIDWORKS will import it as a multi-body part by default. Users can check the “Import multiple bodies as parts” box to have SOLIDWORKS open the STEP file as an assembly with each body imported as its own part.
It is recommended to check the next two boxes, “Perform entity check and repair errors” and “Automatically run Import Diagnostics (Healing).” However, if a user’s system crashes or experiences trouble importing the file, it is recommended to uncheck these.
If users are importing models with incredibly small entities (smaller than a hundred-thousandth of a millimeter), they will need to check the “Customize curve tolerance” check box and set the tolerance. This is tricky, but is only important for models with ridiculously small entities.
The “Units” option below, lets us use the units specified in the STEP file or the default units in your SOLIDWORKS part or assembly templates.
The IGES and NX options don’t apply to STEP, but they let you import additional information specific to those file types if you’d like.
For STEP files, you can choose to import the configuration data contained in the file if there is any by checking the “Map configuration data” box. If a user is only concerned about the 3D geometry, this can be left cleared.
We can now click OK to accept the options and click “Open.” SOLIDWORKS begins to run the import and after a few seconds a dialog box appears, asking if we’d like to run “Import Diagnostics” on the part.
Since we have the “Automatically run Import Diagnostics (Healing)” box checked, we can click yes. Import diagnostics runs and shows any problems in the model.
Our model has one faulty face. We can right click the face and select “Zoom to Selection” to get a closer look.
We can right-click the face and try to repair it, but it’s recommended to first click “Attempt to Heal All” within the “Import Diagnostics” side bar. Since it works, we have a single solid body and SOLIDWORKS asks if we would like to proceed with feature recognition. We’ll click yes again.
After clicking OK in the “FeatureWorks” sidebar, feature recognition runs and when it completes, we can see the imported STEP file along with the nice clean SOLIDWORKS feature tree.
In this example, everything worked fine. However, any time a user works with imported geometry, they’ll always need to be prepared to do a little cleanup or repair work in the file to make it useable like this.
You can learn more about the new capabilities in SOLIDWORKS 2016 by signing up for a free membership.
About the Author