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: 

what is wrong with my ifeature?desperately need your help

2 REPLIES 2
Reply
Message 1 of 3
ewighell
170 Views, 2 Replies

what is wrong with my ifeature?desperately need your help

I create an iFeature in my program. but I can't modify its parameters.
here are some codes:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
CComPtr piFeatDef1;
HRESULT hr = (*ppiFeatComp)->get_Definition(&piFeatDef1);
CComPtr piFeatInputs1;
hr = piFeatDef1->get_iFeatureInputs(&piFeatInputs1);
hr = piFeatInputs1->get_Count(&iInpCnt);
for ( int i = 1; i <= iInpCnt; ++i)
{
CComPtr piFeatInp;
hr = piFeatInputs1->get_Item(i, &piFeatInp);
ObjectTypeEnum eType;
hr = piFeatInp->get_Type(&eType);

if (eType == kiFeatureParameterInputObject)
{
double dbl ;
hr = piFeatParaInp->get_Value(dbl); //here succeeds
hr = piFeatParaInp->putt_Value(&dbl);//the value of hr shows that here fails,
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

by the way, the ifeature I created in the program can be modified in the user environment.

I have been working on this problem for a long time but in vain. so, please help me, thank you very much! null
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: ewighell

The problem here is that the API doesn't yet support editing existing (or
placed) iFeatures. So, setting the iFeatureParameterInput.Value property
will work fine if it is done before the placement (the API workflow in which
you first define the various inputs before actually placing the iFeature).
But it will not work if you attempt to set this property on existing
iFeatures.

But, it seems like all you want to do is modify parameters. In which case,
there is hope. You can simply modify the parameter value using the
corresponding Parameter object. This would be the equivalent of modifying
the parameter value in the parameters dialog in the user interface. And do
an update of the document.

Here is some VBA code to help explain (this assumes that the 2nd
iFeatureInput for the feature is a parameter input):

Sub EditiFeat()
Dim odoc As PartDocument
Set odoc = ThisApplication.ActiveDocument

Dim odef As PartComponentDefinition
Set odef = odoc.ComponentDefinition

Dim oFeatDef As iFeatureDefinition
Set oFeatDef = odef.ReferenceComponents.iFeatureComponents(1).Definition

Dim oFeatParamInput As iFeatureParameterInput
Set oFeatParamInput = oFeatDef.iFeatureInputs.Item(2)

oFeatParamInput.Parameter.value = 2

odoc.Update2
End Sub

Hope this helps,
Sanjay-


wrote in message news:5151443@discussion.autodesk.com...
I create an iFeature in my program. but I can't modify its parameters.
here are some codes:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
CComPtr piFeatDef1;
HRESULT hr = (*ppiFeatComp)->get_Definition(&piFeatDef1);
CComPtr piFeatInputs1;
hr = piFeatDef1->get_iFeatureInputs(&piFeatInputs1);
hr = piFeatInputs1->get_Count(&iInpCnt);
for ( int i = 1; i <= iInpCnt; ++i)
{
CComPtr piFeatInp;
hr = piFeatInputs1->get_Item(i, &piFeatInp);
ObjectTypeEnum eType;
hr = piFeatInp->get_Type(&eType);

if (eType == kiFeatureParameterInputObject)
{
double dbl ;
hr = piFeatParaInp->get_Value(dbl); //here succeeds
hr = piFeatParaInp->putt_Value(&dbl);//the value of hr shows that
here fails,
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

by the way, the ifeature I created in the program can be modified in the
user environment.

I have been working on this problem for a long time but in vain. so, please
help me, thank you very much!

null
Message 3 of 3
ewighell
in reply to: ewighell

I made it with your help, thank you very much!

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

Post to forums  

Autodesk Design & Make Report