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: 

SheetMetal.ActiveKFactor results in 0

3 REPLIES 3
Reply
Message 1 of 4
t_sutter
501 Views, 3 Replies

SheetMetal.ActiveKFactor results in 0

Hi Guys,

 

I want to get my active Kfactor out of my part into a costum property so that I can use that value to appear on our drawings.

After a lot of searching, all results came back on the following rule.

kFactor=SheetMetal.ActiveKFactor

I have created a number property that is unitless and used the rule above to populate the kFactor and shot it in a messagebox. It reports back 0.

kFactor=SheetMetal.ActiveKFactor

MessageBox.Show(kFactor, "K-Factor")

 

It should report back the result of the costom equation in our active Metal Unfold Rule. This is 0.2732395.

 

Does someone know where it goes wrong?

I've attached a test file to show.

 

We use Inventor 2015 on Win7


Any help is appreciated.

Thanks,

Tom

 

3 REPLIES 3
Message 2 of 4
xiaodong_liang
in reply to: t_sutter

Hi,

 

For a linear type of unfold method this is the kFactor used for all bends. For all other unfold methods this is used as the default in cases where the bend table or equations does not define the kFactor. While in your model, the kFactor has been defined as a list with your equation. The kFactor is different in different bound. So I do not think ActiveKFactor would tell the so-called 'active value'.   But it you wanted to get the default kFactor of this unfold method, you can use

 

doc = ThisDoc.Document
oSDef = doc.ComponentDefinition 
oUM = oSDef.ActiveSheetMetalStyle.UnfoldMethod
defaultKFactor = oUM.kFactor 
MsgBox(defaultKFactor)

 

 

kFactor

kFactor

kFactor

Message 3 of 4
t_sutter
in reply to: xiaodong_liang

Hi Xiaodong,

 

Thanks for your reply.

 

Please tell me if I understand your message correctly.

Because the Custom Equation allows different bends to have different K-factors (due too the bounding conditions), Inventor does not show the K-factor used, but the default K-factor.

 

If so, is it possible to specify a Kfactor in a form that changes the Kfactor value of a Linear Unfold Method? Is this a parameter which I can manipulate with a rule?

 

Thanks again,

Tom

Message 4 of 4
xiaodong_liang
in reply to: t_sutter

Hi Tom,

 

in your model, there is only one bend, so only one kFactor in the custom equation will take effect. If there is one more bend that falls into another bounding condition, two kFactors will take effect, but which one can be called 'active factor'? So what I meant is: in such situation, there is not a so-called 'active factor'. default kFactor takes effect when no equation factor is set for a bounding condition. I am not quite sure what you meant by 'active factor', so just mentioned default kFactor by the way.

 

>> is it possible to specify a Kfactor in a form that changes the Kfactor value of a Linear Unfold Method?

the code in my last reply is exactly what you can get started with. it gets the active sheetmetal style and get its kFactor. you can also set the factor. iLogic built-in rules cannot cover everything. In some cases, you have to use Inventor API directly in your rule. e.g. the code below iterates the UnfoldMethods, filters out the linear unfold method, and sets its kFactor.

 

doc = ThisDoc.Document
oSDef = doc.ComponentDefinition 
for each oEachMethod in oSDef.UnfoldMethods 
if oEachMethod.UnfoldMethodType = UnfoldMethodTypeEnum.kLinearUnfoldMethod Then
' set to a new value from your form
oEachMethod.kFactor = newV

End if
Next

 

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

Post to forums  

Autodesk Design & Make Report