Skip to content

Commit

Permalink
* select first plugin in SM
Browse files Browse the repository at this point in the history
   for scripting
  • Loading branch information
festo-i40 committed Aug 29, 2024
1 parent 2ca1bd6 commit 14ed54a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/AasxPackageExplorer/debug.MIHO.script
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
// Tool("sammaspectimport", "File", "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\Batch-MM-2_0_0.ttl");
Tool("editkey");
Select("Submodel", "First");
Select("Submodel", "Next");
Select("Plugin", "First");
// Select("Submodel", "Next");
// Select("SME", "First");
// Tool("aas-elem-copy");
// Tool("aas-elem-paste-below");
Expand Down
3 changes: 2 additions & 1 deletion src/AasxPackageExplorer/options-debug.MIHO.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\SMT_ProductChangeNotification\\IDTA_02036-1-0_SMT_ProductChangeNotification_Draft_v22.aasx",
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\SMT_ProductChangeNotification\\IDTA_02036-1-0_SMT_ProductChangeNotification_Examples_v08.aasx",
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\SMT_ProductChangeNotification\\SMT_ProductChangeNotification_Draft_v20_spiel.aasx",
"AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\aaspe-testing\\210_Copy_Paste\\Sample_AAS.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\aaspe-testing\\210_Copy_Paste\\Sample_AAS.aasx",
"AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\aaspe-testing\\310_Plugin_DNP\\Sample_AAS.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\aaspe-testing\\200_Find_Replace\\Sample_SMT.aasx",
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\SMT_ProductChangeNotification\\IDTA_02036-1-0_SMT_ProductChangeNotification_Examples_v08.aasx",
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\tmp\\Syn2tecMachine_P2518_AAS__V3_DL2.aasx",
Expand Down
17 changes: 15 additions & 2 deletions src/AasxPackageLogic/MainWindowScripting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace AasxPackageLogic
/// </summary>
public class MainWindowScripting : MainWindowAnyUiDialogs, IAasxScriptRemoteInterface
{
public enum ScriptSelectRefType { None = 0, This, AAS, SM, SME, CD };
public enum ScriptSelectRefType { None = 0, This, AAS, SM, SME, CD, Plugin };

public enum ScriptSelectAdressMode { None = 0, First, Next, Prev, idShort, semanticId };
protected static string[] _allowedSelectAdressMode = {
Expand Down Expand Up @@ -153,6 +153,16 @@ public enum ScriptSelectAdressMode { None = 0, First, Next, Prev, idShort, seman
}
}

if (refType == ScriptSelectRefType.Plugin)
{
// search the first plugin
var siPE = siSM?.Members?.FirstOrDefault((si) => si is VisualElementPluginExtension);
if (siPE != null && siPE is VisualElementPluginExtension siPEPE)
{
return new Tuple<Aas.IReferable, object>(siPEPE.theReferable, siPEPE.GetMainDataObject());
}
}

if (refType == ScriptSelectRefType.CD)
{
if (firstCd == null)
Expand Down Expand Up @@ -325,6 +335,9 @@ protected ScriptSelectRefType GetScriptRefType(string refTypeName)
case "conceptdescription":
res = ScriptSelectRefType.CD;
break;
case "plugin":
res = ScriptSelectRefType.Plugin;
break;
}

return res;
Expand Down Expand Up @@ -357,7 +370,7 @@ Aas.IReferable IAasxScriptRemoteInterface.Select(object[] args)
if (args.Length < 2
|| !(args[1] is string adrModeName))
{
Log.Singleton.Error("Script: Select: Adfress mode missing!");
Log.Singleton.Error("Script: Select: Address mode missing!");
return null;
}

Expand Down

0 comments on commit 14ed54a

Please sign in to comment.