public void TestLoadBaseNodeFromModel(string modelName, int expNumLinks) { ModelDoc2 doc = OpenSWDocument(modelName); LinkNode baseNode = ConfigurationSerialization.LoadBaseNodeFromModel(doc, out bool error); Xunit.Assert.False(error); Xunit.Assert.NotNull(baseNode); Xunit.Assert.Equal(expNumLinks, CommonSwOperations.GetCount(baseNode.RebuildLink())); }
public void TestGetCountNodeCollection(string modelName, int expected) { ModelDoc2 doc = OpenSWDocument(modelName); LinkNode baseNode = ConfigurationSerialization.LoadBaseNodeFromModel(doc, out bool abortProcess); Assert.False(abortProcess); Assert.Equal(expected, CommonSwOperations.GetCount(baseNode.Nodes)); SwApp.CloseAllDocuments(true); }
public void TestExportRobotSkipVisual(string modelName, int expNumLinks) { ModelDoc2 doc = OpenSWDocument(modelName); ExportHelper helper = new ExportHelper(SwApp); helper.SetComputeInertial(true); helper.SetComputeJointKinematics(true); helper.SetComputeJointLimits(true); helper.SetComputeVisualCollision(false); LinkNode baseNode = ConfigurationSerialization.LoadBaseNodeFromModel(doc, out bool error); Assert.False(error); helper.CreateRobotFromTreeView(baseNode); helper.ExportRobot(true); Assert.NotNull(helper.URDFRobot); Assert.Equal(expNumLinks, CommonSwOperations.GetCount(helper.URDFRobot.BaseLink)); Assert.True(SwApp.CloseAllDocuments(true)); }
public void TestLoadConfigFromStringXML(string modelName, int expNumLinks) { ModelDoc2 doc = OpenSWDocument(modelName); PrivateType serialization = new PrivateType(typeof(ConfigurationSerialization)); object swAttObj = serialization.InvokeStatic( "FindSWSaveAttribute", new object[] { doc, "URDF Export Configuration" }); Xunit.Assert.NotNull(swAttObj); Attribute swAtt = (Attribute)swAttObj; Parameter param = swAtt.GetParameter("data"); Xunit.Assert.NotNull(param); string data = param.GetStringValue(); Xunit.Assert.NotNull(data); Xunit.Assert.NotEmpty(data); LinkNode baseNode = (LinkNode)serialization.InvokeStatic( "LoadConfigFromStringXML", new object[] { data }); Link link = baseNode.RebuildLink(); Xunit.Assert.Equal(expNumLinks, CommonSwOperations.GetCount(link)); }