Get a Document from a Definition

Top  Previous  Next

If you have a Part or Assembly definition,  but not, for some reason, its Document you can use get_Document:



       // Here is the definition obtained from somwhere...

       pDef = CComQIPtr<PartComponentDefinition>(pCompOcc->Definition);


       // Here is where you put the document you are after...

       CComPtr<PartDocument> pDoc ;



All the above is without checking for nullptr or HRESULT, you may want to do it. And it uses Part. You can use Assembly in the same way. Note also the (IDispatch**) cast.


Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)