Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

'Border' is not a valid template type argument for parameter 'T'

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
oransen
1814 Views, 2 Replies

'Border' is not a valid template type argument for parameter 'T'

I'm trying to get the Border of a drawing (IDW) but compilation fails...

 

 

error C2923: 'ATL::CComPtr': 'Border' is not a valid template type argument for parameter 'T'

 

 

Here's the code, all my other uses of ComPtr<T> work perfectly:

 

 

    CComPtr<Sheet> pSheet = nullptr ;
 
    // Get some data about the sheet...
    double SheetHeight,SheetWidth,Border ;
    CComBSTR bstrSheetName ;
    pSheet->get_Name (&bstrSheetName) ;

pSheet->get_Width(&SheetWidth) ; pSheet->get_Height(&SheetHeight) ;
CComPtr<Border> pBorder; // <---- Border is not a type name !!!HERE!!! pSheet->get_Border(&pBorder);

What am I missing? get_Border exists as a function, but the type Border no it seems...

2 REPLIES 2
Message 2 of 3
chandra.shekar.g
in reply to: oransen

@oransen,


  

    CComPtr<Sheet> pSheet = nullptr ;
 
    // Get some data about the sheet...
    double SheetHeight,SheetWidth,Border ;
    CComBSTR bstrSheetName ;
    pSheet->get_Name (&bstrSheetName) ;

pSheet->get_Width(&SheetWidth) ; pSheet->get_Height(&SheetHeight) ;
CComPtr<Border> pBorder; // <---- Border is not a type name !!!HERE!!! pSheet->get_Border(&pBorder);

As per above code, pSheet is assigned to nullptr and not assigned any value to it. This is what missing in your code.


In my system, get_border is working fine. Try below C++ code to get border.

 

	HRESULT Result = NOERROR;	

	CLSID InvAppClsid;
	Result = CLSIDFromProgID(L"Inventor.Application", &InvAppClsid);
	if (FAILED(Result)) return Result;

	CComPtr<IUnknown> pInvAppUnk;
	 
	Result = ::GetActiveObject(InvAppClsid, NULL, &pInvAppUnk);
	if (FAILED(Result))
		_tprintf_s(_T("*** Could not get hold of an active Inventor application ***\n"));
	 
	if (FAILED(Result)) return Result;

	CComPtr<Application> pInvApp;
	Result = pInvAppUnk->QueryInterface(__uuidof(Application), (void **)&pInvApp);
	if (FAILED(Result)) return Result;

	CComPtr<Document> pDoc;
	Result = pInvApp->get_ActiveDocument(&pDoc);

	CComPtr<DrawingDocument> pDrawDoc;
	pDrawDoc = pDoc;

	CComPtr<Sheet> pSheet;
	Result = pDrawDoc->get_ActiveSheet(&pSheet);

	CComPtr<Border> pBorder;
	Result = pSheet->get_Border(&pBorder);

	return S_OK;

Please feel free to contact if there is any queries.

 

If solves problem, click on "Accept as solution" / give a "Kudo".

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 3 of 3
oransen
in reply to: chandra.shekar.g

@chandra.shekar.g , thanks for testing. I rebuilt the whole solution and now Border is a recognised type.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report