/// <summary> /// Sets the body height to the new value supplied. /// </summary> /// <param name="Body">Body to adjust</param> /// <param name="value">Desired height in AD coords</param> void SetCompHeight(IPCB_ComponentBody Body, int value) { double RotX, RotY, RotZ; int StandOff; Body.BeginModify(); if (Body.GetState_DescriptorString().Contains("STEP")) { //todo: alter offset dont override Body.GetModel().GetState(out RotX, out RotY, out RotZ, out StandOff); Body.GetModel().SetState(RotX, RotY, RotZ, StandOff + value - Body.GetOverallHeight()); //todo: value = coord or mils? } else { Body.SetOverallHeight(value); } Body.EndModify(); }
/// <summary> /// Gets the total height of a body. /// </summary> /// <param name="Body">Body to adjust</param> /// <returns>Height of body in AD coords</returns> int GetCompHeight(IPCB_ComponentBody Body) { double RotX, RotY, RotZ; int StandOff; if (Body.GetState_DescriptorString().Contains("STEP")) { Body.GetModel().GetState(out RotX, out RotY, out RotZ, out StandOff); Body.SaveModelToFile("C:\\test.step"); return(Body.GetOverallHeight()); } else { return(Body.GetOverallHeight()); } }