Autodesk Inventor Customization
Reply
Topic Options
- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
*Tiffin, Josh
Getting and Setting Adaptive for HoleFeatur e using VC++
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
43 Views, 1 Replies
05-13-2003 09:15 PM
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
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
*Pudor, Steffen
Re: Getting and Setting Adaptive for HoleFeatur e using VC++
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-13-2003 10:12 PM in reply to:
*Tiffin, Josh
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.maYI adrTaRb...
> 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
>
>
>
- 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"
news:61B625DB88584C5A96DBB4D24F7FCC48@in.WebX.maYI
> 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
>
>
>
