Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I get this error when i try to run my code:
System.Runtime.InteropServices.COMException (0x80004005): Määrittämätön virhe. (Exception from HRESULT: 0x80004005 (E_FAIL))
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Inventor.CustomPropertyFormat.set_ShowTrailingZeros(Boolean )
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
It doesn't happen on all parts. I've attached part with this problem.
I found this but it didn't help.
SyntaxEditor Code Snippet
'Set a reference to the active part document Dim oDoc As PartDocument oDoc = ThisApplication.ActiveDocument Dim oDef As PartComponentDefinition oDef = oDoc.ComponentDefinition oDoc.Update Dim oparams As Parameters Dim oparam As Parameter oparams = oDoc.ComponentDefinition.Parameters Dim exists As Boolean exists = False 'Find out if parameter exists, if not it will create this parameter in the table For Each oparam In oparams If oparam.Name = "MAX_Y" Then exists = True If oparam.Name = "MAX_Z" Then exists = True If oparam.Name = "MAX_X" Then exists = True Next 'Change the value if the parameter exists otherwise add the parameter If exists Then oparams.Item("MAX_Y").Value = Measure.ExtentsWidth/10 Else oparams.UserParameters.AddByValue("MAX_Y", Measure.ExtentsWidth/10, 11266) End If If exists Then oparams.Item("MAX_X").Value = Measure.ExtentsLength/10 Else oparams.UserParameters.AddByValue("MAX_X", Measure.ExtentsLength/10, 11266) End If If exists Then oparams.Item("MAX_Z").Value = Measure.ExtentsHeight/10 Else oparams.UserParameters.AddByValue("MAX_Z", Measure.ExtentsHeight/10, 11266) End If 'Dim param As Parameter 'param = Parameter.Param("MAX_Y") Parameter.Param("MAX_Y").ExposedAsProperty = True Parameter.Param("MAX_Y").CustomPropertyFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision Parameter.Param("MAX_Y").CustomPropertyFormat.ShowTrailingZeros = True Parameter.Param("MAX_Y").CustomPropertyFormat.ShowLeadingZeros = False Parameter.Param("MAX_Y").CustomPropertyFormat.ShowUnitsString = False 'Parameter.Param("MAX_Y").CustomPropertyFormat.Units = "mm" 'param =Parameter.Param("MAX_Z") Parameter.Param("MAX_Z").ExposedAsProperty = True Parameter.Param("MAX_Z").CustomPropertyFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision Parameter.Param("MAX_Z").CustomPropertyFormat.ShowTrailingZeros = True Parameter.Param("MAX_Z").CustomPropertyFormat.ShowLeadingZeros = False Parameter.Param("MAX_Z").CustomPropertyFormat.ShowUnitsString = False 'Parameter.Param("MAX_Z").CustomPropertyFormat.Units = "mm" 'param =Parameter.Param("MAX_X") Parameter.Param("MAX_X").ExposedAsProperty = True Parameter.Param("MAX_X").CustomPropertyFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision Parameter.Param("MAX_X").CustomPropertyFormat.ShowTrailingZeros = True Parameter.Param("MAX_X").CustomPropertyFormat.ShowLeadingZeros = False Parameter.Param("MAX_X").CustomPropertyFormat.ShowUnitsString = False 'Parameter.Param("MAX_X").CustomPropertyFormat.Units = "mm" oDoc.Update
_____________________________________________________________________________________
Inventor Professional 2019.3
Vault Workgroup 2019.1.1
Inventor Professional 2019.3
Vault Workgroup 2019.1.1
Solved! Go to Solution.

