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: 

The difference between MethodAdd and Add?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
oransen
336 Views, 4 Replies

The difference between MethodAdd and Add?

Some COM pointers in the Inventor API have two versions of the same function. For example

 

// Get the list of rectangular features
CComPtr<RectangularPatternFeatures> pRectPatList ;
pFeaturesList->get_RectangularPatternFeatures (&pRectPatList) ;

pRectPatList->Add (...)

pRectPatList->MethodAdd (...)

 What is the difference between Add and MethodAdd?

Tags (1)
4 REPLIES 4
Message 2 of 5
philippe.leefsma
in reply to: oransen

Every COM C++ Inventor API method come in 2 flavors:

 

- low level methods: that take output param as input and return HRESULT

- high level methods: that return the result directly and throw exceptions

 

high level methods are *usually* prefixed "Method".

 

Regards,

Philippe.

______________________________________________________________

If my post answers your question, please click the "Accept as Solution"

button. This helps everyone find answers more quickly!

 

 

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 3 of 5
oransen
in reply to: philippe.leefsma

So this is the same difference as is between

 

hRes = get_Blah...

 

and

 

BlahPtr = GetBlah()

 

?

 

And in both cases, when I get a pointer should I set it to NULL after use not to have memory leaks?

 

Message 4 of 5
philippe.leefsma
in reply to: oransen

Yes that's correct. Concerning pointers, this is a good practice to set them to NULL if not needed anymore, however if working with smart pointers, they should release their COM object as they are going out of scope. The Inventor SDK has several C++ samples, this is a good place to get started.

 

Regards,

Philippe.

 

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 5 of 5
oransen
in reply to: philippe.leefsma

Thanks for the clear reply.

 

"The Inventor SDK has several C++ samples, this is a good place to get started."

 

Unfortunately the C++ samples are very few compared with VB examples and they vary in quality.

 

In some of the C++ examples the pointers are set to NULL, in others not.

 

I see I still have much to learn!

 

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

Post to forums  

Autodesk Design & Make Report