//Used right now only by the Part Exporter, but this starts the building of the robot public void createRobotFromActiveModel() { mRobot = new robot(); mRobot.name = ActiveSWModel.GetTitle(); Configuration swConfig = ActiveSWModel.ConfigurationManager.ActiveConfiguration; foreach (string state in swConfig.GetDisplayStates()) { if (state.Equals("URDF Export")) { swConfig.ApplyDisplayState("URDF Export"); } } //Each Robot contains a single base link, build this link mRobot.BaseLink = createBaseLinkFromActiveModel(); }
//Fills either TreeView from the URDF robot public void fillTreeViewFromRobot(robot Robot, TreeView tree) { LinkNode baseNode = new LinkNode(); link baseLink = Robot.BaseLink; baseNode.Name = baseLink.name; baseNode.Text = baseLink.name; baseNode.Link = baseLink; baseNode.isBaseNode = true; baseNode.linkName = baseLink.name; baseNode.Components = baseLink.SWcomponents; baseNode.coordsysName = "Origin_global"; baseNode.isIncomplete = false; foreach (link child in baseLink.Children) { baseNode.Nodes.Add(createLinkNodeFromLink(child)); } tree.Nodes.Add(baseNode); tree.ExpandAll(); }
//Populates the TreeView with the organized links from the robot public void fillTreeViewFromRobot(robot robot) { tree.Nodes.Clear(); LinkNode baseNode = new LinkNode(); link baseLink = robot.BaseLink; baseNode.Name = baseLink.name; baseNode.Text = baseLink.name; baseNode.Link = baseLink; baseNode.ContextMenuStrip = docMenu; foreach (link child in baseLink.Children) { baseNode.Nodes.Add(createLinkNodeFromLink(child)); } tree.Nodes.Add(baseNode); tree.ExpandAll(); }
// The one used by the Assembly Exporter public void createRobotFromTreeView(LinkNode baseNode) { mRobot = new robot(); progressBar.Start(0, Common.getCount(baseNode.Nodes) + 1, "Building links"); int count = 0; progressBar.UpdateProgress(count); progressBar.UpdateTitle("Building link: " + baseNode.Name); count++; link BaseLink = createLink(baseNode, 1); mRobot.BaseLink = BaseLink; baseNode.Link = BaseLink; progressBar.End(); }