Getting and Setting Adaptive for HoleFeature using VC++

Getting and Setting Adaptive for HoleFeature using VC++

Anonymous
Not applicable
398 Views
1 Reply
Message 1 of 2

Getting and Setting Adaptive for HoleFeature using VC++

Anonymous
Not applicable
I'm having some trouble getting and setting the Adaptive property using
VC++. I need to set the adaptivity when a user selects this option in a
dialog box that creates our company's standard holes. I also need to
retrieve the current adaptive setting if the user selects a HoleFeature to
edit. Below are some of the options I have used. They all compile, but on
getting the adaptive setting I get a return value of 0 if the HoleFeature
is not adaptive and a return value of -1 when the HoleFeature is adaptive.
When I try to set the HoleFeature adaptive the add-in crashes Inventor.

// Getting adaptivity setting
VARIANT_BOOL bAdaptive;
bAdaptive = pHoleFeat->GetAdaptive();
hr = pHoleFeat->get_Adaptive(&bAdaptive);
pHoleFeat->get_Adaptive(&bAdaptive);
bAdaptive = pHoleFeat->Adaptive;

// Setting adaptivity
VARIANT_BOOL test = TRUE;
pHoleFeat->put_Adaptive(test);
pHoleFeat->PutAdaptive(test);
hr = pHoleFeat->put_Adaptive(test);

Thanks in advance for any help

Josh
0 Likes
399 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
VARIANT_BOOL supports following values:
- VARIANT_FALSE = #define VARIANT_TRUE ((VARIANT_BOOL)0xffff) = -1
- VARIANT_TRUE = #define VARIANT_FALSE ((VARIANT_BOOL)0) = 0

you pass TRUE to the put function and TRUE is defined as +1. But +1 is not a
VARIANT_BOOL value. Try it with VARIANT_TRUE. You crash, because you use
member functions, which fires exceptions. You have to catch these
exceptions, else the addin crashes. IMHO it is better to use the fcns which
returns the HRESULT error status and ask the status for succeed or failure.

Steffen Pudor


"Josh Tiffin" schrieb im Newsbeitrag
news:61B625DB88584C5A96DBB4D24F7FCC48@in.WebX.maYIadrTaRb...
> I'm having some trouble getting and setting the Adaptive property using
> VC++. I need to set the adaptivity when a user selects this option in a
> dialog box that creates our company's standard holes. I also need to
> retrieve the current adaptive setting if the user selects a HoleFeature to
> edit. Below are some of the options I have used. They all compile, but
on
> getting the adaptive setting I get a return value of 0 if the HoleFeature
> is not adaptive and a return value of -1 when the HoleFeature is adaptive.
> When I try to set the HoleFeature adaptive the add-in crashes Inventor.
>
> // Getting adaptivity setting
> VARIANT_BOOL bAdaptive;
> bAdaptive = pHoleFeat->GetAdaptive();
> hr = pHoleFeat->get_Adaptive(&bAdaptive);
> pHoleFeat->get_Adaptive(&bAdaptive);
> bAdaptive = pHoleFeat->Adaptive;
>
> // Setting adaptivity
> VARIANT_BOOL test = TRUE;
> pHoleFeat->put_Adaptive(test);
> pHoleFeat->PutAdaptive(test);
> hr = pHoleFeat->put_Adaptive(test);
>
> Thanks in advance for any help
>
> Josh
>
>
>
0 Likes