本文整理汇总了C#中MgaFCO.GetGuidDisp方法的典型用法代码示例。如果您正苦于以下问题:C# MgaFCO.GetGuidDisp方法的具体用法?C# MgaFCO.GetGuidDisp怎么用?C# MgaFCO.GetGuidDisp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MgaFCO
的用法示例。
在下文中一共展示了MgaFCO.GetGuidDisp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateCADAssemblyXml
private void GenerateCADAssemblyXml(MgaProject project, MgaFCO currentobj, int param)
{
int origPrefs = project.Preferences;
try
{
project.Preferences = project.Preferences | (int)GME.MGA.preference_flags.MGAPREF_IGNORECONNCHECKS | (int)GME.MGA.preference_flags.MGAPREF_FREEINSTANCEREFS;
CyPhyML.ComponentAssembly assembly = CyPhyMLClasses.ComponentAssembly.Cast(currentobj);
List<string> errorList = new List<string>();
if (!VerifyAssembly(assembly, errorList))
{
System.Windows.Forms.MessageBox.Show("Model verification failed for Meta-Link and it may not work properly for this model.", "Warning", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
foreach (string s in errorList)
GMEConsole.Warning.WriteLine(s);
}
SyncedComponentData syncedCompData;
if (!syncedComponents.TryGetValue(assembly.Guid.ToString(), out syncedCompData))
{
throw new Exception("Internal error in GenerateCADAssemblyXml, can't find data for guid " + assembly.Guid);
}
HashSet<CyPhyML.Component> comps = CyphyMetaLinkUtils.CollectComponentsRecursive(assembly);
// Prepare Meta-Link specific data based on the original model
CyPhy2CAD_CSharp.MetaLinkData metaLinkData = new CyPhy2CAD_CSharp.MetaLinkData();
try
{
PrepareMetaLinkData(metaLinkData, assembly, "");
}
catch (Exception ex)
{
throw new Exception("Error during collecting metalink data." + ex.Message);
}
DateTime t1 = DateTime.Now;
// call elaborator and expand the references
// Please note that elaborator will change "currentobj"'s internal structure
Type t = Type.GetTypeFromProgID("MGA.Interpreter.CyPhyElaborateCS");
if (t == null)
{
throw new NullReferenceException("Cannot find MGA.Interpreter.CyPhyElaborate. Is it registered?");
}
IMgaComponentEx elaborator = Activator.CreateInstance(t) as IMgaComponentEx;
elaborator.Initialize(project);
elaborator.ComponentParameter["automated_expand"] = "true";
elaborator.ComponentParameter["console_messages"] = "off";
elaborator.InvokeEx(project, currentobj, (MgaFCOs)Activator.CreateInstance(Type.GetTypeFromProgID("Mga.MgaFCOs")), param);
TimeSpan ts = DateTime.Now - t1;
GMEConsole.Info.WriteLine("Elaborator was running for " + ts.TotalMilliseconds + "ms");
CyPhy2CAD_CSharp.CyPhy2CADSettings cadSettings = new CyPhy2CAD_CSharp.CyPhy2CADSettings();
cadSettings.AuxiliaryDirectory = syncedCompData.AuxDir;
cadSettings.OutputDirectory = syncedCompData.WorkingDir;
cadSettings.MetaLink = true;
CyPhy2CAD_CSharp.Logger.Instance.Reset();
CyPhy2CAD_CSharp.CADFlatDataCreator datacreator = new CyPhy2CAD_CSharp.CADFlatDataCreator(cadSettings.OutputDirectory, GetProjectDir(), metalink: true);
datacreator.CreateFlatData(assembly);
CyPhy2CAD_CSharp.DataRep.CADContainer cadcontainer = datacreator.CreateCADDataContainer(assembly.Guid.ToString(), CyPhy2CAD_CSharp.UtilityHelpers.CleanString2(assembly.Name));
cadcontainer.MergeAssemblies();
// IF this is an empty design, add a root component
if (cadcontainer.assemblies.Count == 0)
{
cadcontainer.AddRootComponent(assembly);
}
cadcontainer.InjectMetaLinkData(assembly, metaLinkData);
CyPhy2CAD_CSharp.TestBenchModel.TestBenchBase testbenchbase = new CyPhy2CAD_CSharp.TestBenchModel.TestBenchBase(cadSettings, cadSettings.OutputDirectory, GetProjectDir());
testbenchbase.cadDataContainer = cadcontainer;
testbenchbase.CollectDirectories();
testbenchbase.GenerateCADXMLOutput();
testbenchbase.GenerateScriptFiles();
bool stop = CyPhy2CAD_CSharp.Logger.Instance.ErrorCnt > 0;
CyPhy2CAD_CSharp.Logger.Instance.DumpLog(GMEConsole, "");
if (stop)
{
throw new Exception("There were errors during processing the model. Please look at the console log and fix these.");
}
string CADAssembly = File.ReadAllText(Path.Combine(cadSettings.OutputDirectory, CyPhy2CAD_CSharp.TestBenchModel.TestBenchBase.CADAssemblyFile));
string designId = new Guid(currentobj.GetGuidDisp()).ToString("D");
SendInterest(null, syncedCompData.InstanceId);
foreach (var comp in comps)
{
// SendInterest(null, ComponentTopic, comp.Attributes.AVMID);
}
SaveCadAssemblyXml(CADAssembly, designId);
}
finally
{
project.Preferences = origPrefs;
}
}