Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

Anonymous
Not applicable
1,940 Views
3 Replies
Message 1 of 4

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

Anonymous
Not applicable
Dear Friends,

when i try to set dimensionStyle "AlternateDisplayUnitType"property , sometimes it works fine and some times it gives "Unspecified Error"
Please let me know what is the problem with my code

Inventor.DimensionStyle oDimStyle = m_inventorDrawingDoc.StylesManager.DimensionStyles[3];

for (int ii = 1; ii <= s1.Count; ii++)

{

DrawingCurve s2 = s1[ii];

if (s2.CurveType == CurveTypeEnum.kLineSegmentCurve)

{

GeometryIntent top1 = oSheet.CreateGeometryIntent(s2, null);

Inventor.Layer oDimLayer = m_inventorDrawingDoc.StylesManager.Layers[21];

oSheet.DrawingDimensions.GeneralDimensions.AddLinear(endPoint1, top1, null,

DimensionTypeEnum.kVerticalDimensionType,

true, oDimStyle, oDimLayer);

}

}

oDimStyle.AlternateDisplayUnitType = false;

oDimStyle.LinearUnits = UnitsTypeEnum.kMillimeterLengthUnits;

Thanks & Regards,
Satyajeet

0 Likes
1,941 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Hi Satyajeet,

 

When you get "Unspecified Error", it's because the
style used is a Library one , you need to convert it to Local before reseting
its properties. 

Pleaser refer my VB code for converting to Local
style:

Sub test()
   

    Dim oDrawDoc As DrawingDocument
    Set
oDrawDoc = ThisApplication.ActiveDocument
   

    Dim oStyle As DimensionStyle
    Set
oStyle = oDrawDoc.StylesManager.DimensionStyles(3)
   

    If oStyle.StyleLocation = kLibraryStyleLocation
Then
        Set oStyle =
oStyle.ConvertToLocal
    End If
   

    If oStyle.AlternateUnitsDisplay = True
Then
       
oStyle.AlternateDisplayUnitType = False
    End
If
   
End Sub

 

Thanks,

-Lisa


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Dear
Friends,

when i try to set dimensionStyle
"AlternateDisplayUnitType"property , sometimes it works fine and some times it
gives "Unspecified Error"
Please let me know what is the problem with my
code


Inventor.DimensionStyle oDimStyle =
m_inventorDrawingDoc.StylesManager.DimensionStyles[3];


for (int ii = 1; ii <= s1.Count; ii++)


{


DrawingCurve s2 = s1[ii];


if (s2.CurveType == CurveTypeEnum.kLineSegmentCurve)


{


GeometryIntent top1 = oSheet.CreateGeometryIntent(s2, null);


Inventor.Layer oDimLayer = m_inventorDrawingDoc.StylesManager.Layers[21];


oSheet.DrawingDimensions.GeneralDimensions.AddLinear(endPoint1, top1, null,


DimensionTypeEnum.kVerticalDimensionType,


true, oDimStyle, oDimLayer);


}


}


oDimStyle.AlternateDisplayUnitType = false;


oDimStyle.LinearUnits = UnitsTypeEnum.kMillimeterLengthUnits;

Thanks
& Regards,
Satyajeet

0 Likes
Message 3 of 4

Anonymous
Not applicable

Thanks Lisa for solving my crash problem.

I implement following code in my code. Now it is working fine.

if (oDimStyle.StyleLocation == StyleLocationEnum.kLibraryStyleLocation)

{

oDimStyle = (Inventor.DimensionStyle )oDimStyle.ConvertToLocal();

}

if (oDimStyle.AlternateDisplayUnitType == true)

{

oDimStyle.AlternateDisplayUnitType = false;

}

if (oDimStyle.LinearUnits != UnitsTypeEnum.kMillimeterLengthUnits)

{

oDimStyle.LinearUnits = UnitsTypeEnum.kMillimeterLengthUnits;

}

Regards,
Satyajeet

0 Likes
Message 4 of 4

GCvanLan
Contributor
Contributor

I'm getting the same error:

    Edit Rule

    Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)),

 

Except that I'm not trying to adjust the style libraries at all.  Here's my code:

 

'Shunting values to custom properties

iProperties.Value("Custom", "ProjectNumber") = ProjectNumber

iProperties.Value("Custom", "ProjectName") = ProjectName

iProperties.Value("Custom", "ProjectLocation") = ProjectLocation

iProperties.Value("Custom", "ContName") = ContName

iProperties.Value("Custom", "ContLocation") = ContLocation

iProperties.Value("Custom", "EngName") = EngName

iProperties.Value("Custom", "EngLocation") = EngLocation

iProperties.Value("Custom", "CustPONum") = CustPONum

iProperties.Value("Custom", "Model") = Model

 

' Passing Varibles to D101 Assy

Parameter("101 General Assembly - Mounting Bars", "ProjectNumber") = ProjectNumber

Parameter("101 General Assembly - Mounting Bars", "ProjectName") = ProjectName

Parameter("101 General Assembly - Mounting Bars", "ProjectLocation") = ProjectLocation

Parameter("101 General Assembly - Mounting Bars", "ContName") = ContName

Parameter("101 General Assembly - Mounting Bars", "ContLocation") = ContLocation

Parameter("101 General Assembly - Mounting Bars", "EngName") = EngName

Parameter("101 General Assembly - Mounting Bars", "EngLocation") = EngLocation

Parameter("101 General Assembly - Mounting Bars", "CustPONum") = CustPONum

Parameter("101 General Assembly - Mounting Bars", "Model") = Model

Parameter("101 General Assembly - Mounting Bars", "Reducer") = Reducer

Parameter("101 General Assembly - Mounting Bars", "ReducerMake") = ReducerMake

 

' Passing Varibles to D101 Assy Jackstud Layout

Parameter("101 Jackstud layout - Mounting Bars", "ProjectNumber") = ProjectNumber

 

' Passing Varibles to D103 Assy

Parameter("103 Dual-Gate", "ProjectNumber") = ProjectNumber

Parameter("103 Dual-Gate", "ProjectName") = ProjectName

Parameter("103 Dual-Gate", "ProjectLocation") = ProjectLocation

Parameter("103 Dual-Gate", "ContName") = ContName

Parameter("103 Dual-Gate", "ContLocation") = ContLocation

Parameter("103 Dual-Gate", "EngName") = EngName

Parameter("103 Dual-Gate", "EngLocation") = EngLocation

Parameter("103 Dual-Gate", "CustPONum") = CustPONum

Parameter("103 Dual-Gate", "Model") = Model

 

iLogicVb.UpdateWhenDone = True

 

0 Likes