private InvApplication(InvApplication invApplication) { InternalApplication = invApplication.InternalApplication; //get a reference to the active application obtained in addin startup Inventor.Application invApp = InternalApplication; AssemblyDocument assDoc = (AssemblyDocument)invApp.ActiveDocument; Inventor.Point transPoint = invApp.TransientGeometry.CreatePoint(0, 0, 0); WorkPoint wp = assDoc.ComponentDefinition.WorkPoints.AddFixed(transPoint, false); //get the active document Document activeDoc = invApp.ActiveDocument; //cast to the right type AssemblyDocument assemblyDocument = (AssemblyDocument)activeDoc; //get the ComponentDefinition AssemblyComponentDefinition assCompDef = (AssemblyComponentDefinition)assemblyDocument.ComponentDefinition; //get the WorkPoints collection WorkPoints workPoints = assCompDef.WorkPoints; //create an Inventor.Point transient geometry object Inventor.Point transientPoint = invApp.TransientGeometry.CreatePoint(0, 0, 0); //add WorkPoint WorkPoint workPoint = workPoints.AddFixed(transientPoint, false); }
/// <summary> /// Создает рандомное количество очков работы в зависимости от скилла персонажа и тиммейта /// </summary> private static int CreateWorkPoints( int playerSkill, WorkPoints playerPoints, int rapperSkill, WorkPoints rapperPoints ) { var playerValue = Random.Range(1, playerSkill + 1); playerPoints.Show(playerValue); var rapperValue = Random.Range(1, rapperSkill + 1); rapperPoints.Show(rapperValue); return(playerValue + rapperValue); }