2

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
                    }
1
  • aybody ? any kind of help would be appreciated
    – ZZZ
    Commented Apr 19, 2015 at 7:59

1 Answer 1

1

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
3
  • +1, Glad you found a solution to your problem even though it took almost 5 months :)
    – Joseph
    Commented Sep 9, 2015 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
    Commented Sep 9, 2015 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
    Commented Sep 9, 2015 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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