I am getting an error when I try to change the value of a feature's Rotation Value. I have a schematic feature that I would like to rotate by changing the field's ROTATION value, but everytime I try to set the new value I get this error. "Error HRESULT E_FAIL has been returned from a call to a COM component"

Here is the part of the code where I set the value

ISchematicRelationController controller = new SchematicRelationControllerClass();
var parentContainer = controller.FindParent(duct);
if (parentContainer == null) {
   var rotIdx = parentContainer.Fields.FindField("ROTATION");
   var idx = duct.SchematicElement.Fields.FindField("ROTATION");
   if (rotIdx > -1) {
      Duct.SchematicElement.Value[rotIdx] = 45;
      parentContainer.Value[rotIdx] = 65; ------> this is where the exception occurs
  • aybody ? any kind of help would be appreciated – ZZZ Apr 19 '15 at 7:59

It turned out this field took double values so the answer was to set it as follows:

Duct.SchematicElement.Value[rotIdx] = 45;
  parentContainer.Value[rotIdx] = 65d; or 65.0
| improve this answer | |
  • +1, Glad you found a solution to your problem even though it took almost 5 months :) – Joseph Sep 9 '15 at 11:26
  • yeah it was a simple problem that I solved back then, but I was going through my account so I can post answers on the stuff that I have solved but never answered on here haha. – ZZZ Sep 9 '15 at 11:49
  • It is much appreciated that you're coming back to post your solutions, I'm sure this will help others in similar situations in the future =) – Joseph Sep 9 '15 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.