public LinkSelector(RobotModel robot) { this.robot = robot; InitializeComponent(); this.linkSelectTree.Nodes.Add(robot.BaseLink); Refresh(); }
/// <summary> /// Creates a new joint editor proptery manager page that allows the user to edit joint properties. /// </summary> /// <param name="robot">Active robot model</param> /// <param name="joint">Joint to be edited</param> /// <param name="document">Active assembly document</param> /// <param name="swApp">Solidworks application environment</param> public JointPMPage(RobotModel robot, Joint joint, AssemblyDoc document, SldWorks swApp) { //Validate parameters if (robot == null) throw new ProgramErrorException("Tried to create a JointPMPage with a null robot model."); if (document == null) throw new ProgramErrorException("Tried to create a JointPMPage with a null assembly document."); if (swApp == null) throw new ProgramErrorException("Tried to create a JointPMPage with a null solidworks application interface."); //Initialize fields this.robot = robot; this.swApp = swApp; currentJoint = joint; mathUtil = ((IMathUtility)swApp.GetMathUtility()); //AssemblyDoc inherits ModelDoc2 but the relationship dosn't carry through the COM interface //Having two fields prevents having to cast half of the time modelDoc = (ModelDoc2)document; assemblyDoc = document; //Setup the page, its controls and their visual layout SetupPage(); SelectionObservers = new List<SelectionObserver>(); ButtonObservers = new List<ButtonObserver>(); CheckboxObservers = new List<CheckboxObserver>(); }
public JointAxis(SldWorks swApp, AssemblyDoc asm, StorageModel swData, string path, Joint current, int index, RobotModel robot) { this.swApp = swApp; this.asmDoc = asm; this.modelDoc = (ModelDoc2)asm; this.swData = swData; this.path = path; this.owner = current; this.robot = robot; this.AxisIndex = index; if (EffortLimit == 0) { this.EffortLimit = 1; } if (this.VelocityLimit == 0) { this.VelocityLimit = 1; } if (Axis != null) { CalcAxisVectors(); //CalcLimits(null); } if (index == 2) { IsContinuous = true; } }
/// <summary> /// Sets the current robot that is linked to this page /// </summary> /// <param name="robot">robot to be used</param> /// <param name="model">model to be used</param> public void setRobot(RobotModel robot, ModelDoc2 model) { this.robot = robot; robotName.Text = robot.Name; string[] configurations = model.GetConfigurationNames(); IncludeFRCfieldBox.Visible = PluginSettings.UseFRCsim; if (PluginSettings.UseFRCsim) { switch (robot.FRCfield) { case 2014: FRC2014FieldButton.Checked = true; break; case 2015: FRC2015FieldButton.Checked = true; break; default: NoFieldButton.Checked = true; break; } } if (robot.ExportType == 0) SDFExportTypeButton.Checked = true; else URDFExportTypeButton.Checked = true; }
public void setRobot(RobotModel robot) { this.robot = robot; clientArea = new Rectangle(0, 0, this.Width, this.Height); currentSelection = robot; currentSelection.Selected = true; Refresh(); }
/// <summary> /// Constructs the exporter /// </summary> /// <param name="robot"> Robot model to be exported</param> public Exporter(RobotModel robot) { //Thread loggerThread = new Thread(new ThreadStart(LaunchLogger)); //loggerThread.Start(); this.currentRobot = robot; //Thread.Sleep(1000); LaunchLogger(); }
public ManageRobot(RobotModel robot) { RobotInfo.WriteToLogFile("Creating Robot Manager (ManageRobot)"); this.robot = robot; InitializeComponent(); robotGraphPanel1.setRobot(robot); robotGraphPanel1.OnSelectionChanged += Select; this.TopMost = false; Select(robot); toggleFRCsim(PluginSettings.UseFRCsim); RobotInfo.WriteToLogFile("Robot Manager Created (ManageRobot)"); }
/// <summary> /// Creates a new Specific Joint object /// </summary> /// <param name="joint">The joint that this joint is in</param> /// <param name="path">The storage path for this joint</param> protected JointSpecifics(Joint joint, string path) { this.robot = RobotInfo.Robot; this.joint = joint; this.swApp = RobotInfo.SwApp; this.modelDoc = RobotInfo.ModelDoc; this.swData = RobotInfo.SwData; this.path = path; OriginValues = new OriginPoint(); if(OriginPt != null) OriginValues.Point = GetPointFromEntity(OriginPt); }
/// <summary> /// Constructs a new IJointAxis /// </summary> /// <param name="path">Path to this joint's storage</param> /// <param name="current">The joint that this axis is contained in</param> public IJointAxis(string path, Joint current) { this.swApp = RobotInfo.SwApp; this.modelDoc = RobotInfo.ModelDoc; this.swData = RobotInfo.SwData; this.path = path; this.owner = current; this.robot = RobotInfo.Robot; if (EffortLimit == 0) { this.EffortLimit = 1; } if (Axis != null) { CalcAxisVector(); } mathUtil = (MathUtility)swApp.GetMathUtility(); }
/// <summary> /// Creates a new joint /// </summary> /// <param name="path">Path to this joint in the StorageModel</param> /// <param name="owner">The Link that owns this joint (child Link in the joint)</param> public Joint(string path, Link parent, Link child) { this.swApp = RobotInfo.SwApp; this.asmDoc = RobotInfo.AssemDoc; this.modelDoc = RobotInfo.ModelDoc; this.swData = RobotInfo.SwData; this.path = path; this.robot = RobotInfo.Robot; this.Parent = parent; Parent.ChildJoints.Add(this); this.Child = child; this.Selected = false; this.Type = JointFactory.DefaultJointType; RobotInfo.WriteToLogFile("Getting Joint Specifics (Joint)"); jointSpecifics = JointFactory.GetSpecificJoint(Type,path,this); RobotInfo.WriteToLogFile("Successfully created Joint Specifics (Joint)"); if (swData.GetDouble(path) == 0) { swData.SetDouble(path, 1); } }
/// <summary> /// Sets the various properties of the current robot /// </summary> /// <param name="swApp">The solidworks application</param> /// <param name="asmDoc">The current assembly</param> /// <param name="swData">The current storage model</param> /// <param name="robot">the current robot</param> public static void SetProperties(SldWorks swApp, AssemblyDoc asmDoc, StorageModel swData, RobotModel robot) { SwApp = swApp; ModelDoc = (ModelDoc2)asmDoc; AssemDoc = asmDoc; SwData = swData; Robot = robot; mathUtil = SwApp.GetMathUtility(); }
/// <summary> /// update robot when selected /// </summary> /// <param name="robot"></param> public void OnRobotSelectionChanged(RobotModel robot_) { if (robot != null) SaveCurrentSelection(); robot = robot_; LoadSelections(); }
/// <summary> /// Constructer /// </summary> /// <param name="robot">Robot model to be used for export</param> /// <param name="iSwApp">The solidworks app</param> /// <param name="asm">The assembly document</param> public RobotExporter(RobotModel robot, SldWorks iSwApp, AssemblyDoc asm) { this.robot = robot; this.iSwApp = iSwApp; this.asm = asm; }
/// <summary> /// Loads a joint that has already been created /// </summary> /// <param name="swApp">Solidworks app</param> /// <param name="asm">Assembly document this joint and its robot belong to</param> /// <param name="swData">StorageModel that this joint is tored in</param> /// <param name="path">Path to this joint in the StorageModel</param> /// <param name="robot">The Robot model that the joint is in</param> public Joint(string path) { this.swApp = RobotInfo.SwApp; this.asmDoc = RobotInfo.AssemDoc; this.modelDoc = RobotInfo.ModelDoc; this.swData = RobotInfo.SwData; this.path = path; this.robot = RobotInfo.Robot; this.Parent = robot.GetLink(parentId); Parent.ChildJoints.Add(this); this.Child = robot.GetLink(childId); this.Selected = false; if(this.Type == null || this.Type.Equals("")) this.Type = JointFactory.DefaultJointType; RobotInfo.WriteToLogFile("Loading existing joint (Joint)"); jointSpecifics = JointFactory.GetSpecificJoint(Type, path, this); if (swData.GetDouble(path) == 0) { swData.SetDouble(path, 1); } }
/// <summary> /// open Joint tab of JointEditor for given joint when click Joint Pose button from Manage Robot window /// call from JointProperties /// </summary> /// <param name="robot">current robot to edit</param> /// <param name="manager"></param> public void OpenJointEditorPage(RobotModel robot, ManageRobot manager) { JointPMPage editor = jointSpecifics.FillPropertyPage();//SetupPage(); editor.RestoreManager += manager.ExternalSelect; editor.Show(); // editor.OnJointSelectionChanged(this); //calls SaveCurrentLinkSelection() and LoadCurrentLinkSelection(); //const int jointTabID = 33; editor.OnTabClicked(jointTabID); //calls ToggleJointPropertyManagers(this.Type); }
/// <summary> /// Creates a new link belonging to the given assembly /// </summary> /// <param name="swApp">The Solidworks App</param> /// <param name="asm"> The assembly that this Link is in</param> /// <param name="swData"> The Storage model that this Link is stored in </param> /// <param name="path"> The path to the StorageModel location of this link </param> /// <param name="baseLink"> Whether this Link is the base link of the model or not </param> public Link(String path, int id) { this.Selected = false; this.asmDoc = RobotInfo.AssemDoc; this.modelDoc = RobotInfo.ModelDoc; this.swData = RobotInfo.SwData; this.path = path; this.swApp = RobotInfo.SwApp; this.Id = id; this.robot = RobotInfo.Robot; attachments = new List<Attachment>(); ParentJoints = new List<Joint>(); ChildJoints = new List<Joint>(); nextAttachmentNum = 0; nextJointNum = 0; isBaseLink = false; if (swData.GetDouble(path) == 0) { swData.SetDouble(path, 1); Name = "NewLink"; this.color = DefaultColors[0]; } attachmentNums = new DoubleStorageArray(swData, path + "/attachmentNums"); parentJointNums = new DoubleStorageArray(swData, path + "/jointNums"); ModelConfiguration physical = new ModelConfiguration(path + "/physicalComps", (int)ModelConfiguration.ModelConfigType.Physical,this); ModelConfiguration visual = new ModelConfiguration(path + "/visualComps", (int)ModelConfiguration.ModelConfigType.Visual,this); ModelConfiguration collision = new ModelConfiguration(path + "/collisionComps", (int)ModelConfiguration.ModelConfigType.Collision,this); LinkModels = new ModelConfiguration[] { physical, visual, collision }; }
/// <summary> /// Constructor for setting up the link property manager page /// </summary> /// <param name="robot">The robot model</param> /// <param name="link">The link that will be edited</param> /// <param name="document">Active assembly document</param> /// <param name="swApp">The solidworks app</param> public LinkPMPage(RobotModel robot, AssemblyDoc document, SldWorks swApp, int type) { //Validate parameters if (robot == null) throw new ProgramErrorException("Tried to create a LinkEditorPMPage with a null robot model."); if (document == null) throw new ProgramErrorException("Tried to create a LinkEditorPMPage with a null assembly document."); if (swApp == null) throw new ProgramErrorException("Tried to create a LinkEditorPMPage with a null solidworks application interface."); //Initialize fields this.robot = robot; this.swApp = swApp; this.linksColored = false; currentModelConfig = type; //AssemblyDoc inherits ModelDoc2 but the relationship dosn't carry through the COM interface //Having two fields prevents having to cast half of the time modelDoc = (ModelDoc2)document; assemblyDoc = document; //Setup the page, its controls and their visual layout SetupPage(); }
public int OnDocChange() { currentRobot = null; currentDoc = null; ModelDoc2 activeDoc = iSwApp.ActiveDoc; if (activeDoc.GetType() == (int)swDocumentTypes_e.swDocASSEMBLY) { currentDoc = (AssemblyDoc)activeDoc; currentDoc.DestroyNotify2 += new DAssemblyDocEvents_DestroyNotify2EventHandler(OnDocClose); currentRobot = new RobotModel(currentDoc, iSwApp); if (manager != null && manager.Visible == true) { manager.Close(); } if (settings!= null && settings.Visible == true) { settings.Close(); } if (exporter != null && !exporter.IsClosed()) { exporter.CloseExporter(); exporter = null; } manager = new ManageRobot(currentRobot); settings = new SettingsForm(manager); } RobotInfo.WriteToLogFile("Doc changed (SwAddin)"); return 0; }
/// <summary> /// Constructor /// </summary> /// <param name="robot">Robot model to be exported</param> /// <param name="iSwApp">Solidworks app</param> /// <param name="asm">Assembly that the robot model is in</param> public URDFExporter(RobotModel robot, SldWorks iSwApp, AssemblyDoc asm) : base(robot, iSwApp, asm) { }
/// <summary> /// opens link editor page in solidworks window /// </summary> /// <param name="robot"></param> /// <param name="manager"></param> public void OpenLinkEditorPage(RobotModel robot,ManageRobot manager, int modelType) { LinkPMPage editor = new LinkPMPage(robot, asmDoc, swApp, modelType); //SetupPage(); editor.Show(); editor.RestoreManager += manager.ExternalSelect; editor.OnLinkSelectionChanged(this); //calls SaveCurrentLinkSelection() and LoadCurrentLinkSelection(); }
/// <summary> /// opens link editor page in solidworks window /// </summary> /// <param name="robot"></param> /// <param name="manager"></param> public void OpenRobotEditorPage(RobotModel robot, ManageRobot manager) { RobotPMPage editor = new RobotPMPage(robot, asmDoc, swApp); //SetupPage(); editor.Show(); editor.RestoreManager += manager.ExternalSelect; editor.OnRobotSelectionChanged(this); //calls SaveCurrentLinkSelection() and LoadCurrentLinkSelection(); }