Hide Table of Contents
DetachPdfDefinition Method (ISketchManager)

Detaches the specified PDF definition from the drawing.

.NET Syntax

Visual Basic (Declaration) 
Function DetachPdfDefinition( _
   ByVal PdfDefinition As PdfDefinition _
) As System.Boolean
System.bool DetachPdfDefinition( 
   PdfDefinition PdfDefinition
function DetachPdfDefinition( 
   PdfDefinition : PdfDefinition
) : System.boolean;
Managed Extensions for C++ 
System.bool DetachPdfDefinition( 
   PdfDefinition* PdfDefinition
System.bool DetachPdfDefinition( 
&   PdfDefinition^ PdfDefinition


PDF definition

Return Value

True if successful, false if not


Create a C++ program in Visual Studio using the C++ snippet below, substituting your_pdf with the full path to a PDF file on your computer.


C++ snippet attaches and detaches your_pdf


dsCommandMessage_ptr commandline;



dsRunCommandError_e error = dsRunCommand_InvalidCommand;

dsStringArray parameters;

dsLongArray parametersLong;

dsString strFile = L"your_pdf";

dsResType_e type = dsResType_String;

parameters.add( strFile );

parametersLong.add( type );


application->RunCommand2( L"_ATTACHPDF", parameters, parametersLong, true, &error );

commandline->PrintLine( error != dsRunCommand_Succeeded ? L"Run command failed" : L"Run command passed!" );


dsDocument_ptr document;

application->GetActiveDocument( &document );


dsLongArray ExternalDefinitionTypeLongArray;

dsObjectPtrArray ExternalDefinitionsArray;

document->GetImmediateChildReferences( &ExternalDefinitionTypeLongArray, &ExternalDefinitionsArray );


dsModel_ptr dsModel;

document->GetModel( &dsModel );


dsSketchManager_ptr sketchManager;

dsModel->GetSketchManager( &sketchManager );


dsPdfDefinition_c* pdfDefinition = ( dsPdfDefinition_c* )ExternalDefinitionsArray[ 0 ];


bool bRet;

sketchManager->DetachPdfDefinition( pdfDefinition, &bRet );

commandline->PrintLine( bRet ? L"Passed to detach Pdf" : L"Failed to detach PDF" );


See Also


DraftSight 2024 SP02

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   DetachPdfDefinition Method (ISketchManager)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2024 SP03

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.