gpt4 book ai didi

enterprise-architect - 从 javascript Enterprise Architect 添加属性说明

转载 作者:行者123 更新时间:2023-12-04 08:22:53 29 4
gpt4 key购买 nike

我有一些代码,我想创建Property Note

 var metric as EA.Element;
metric = thePackage.Elements.AddNew("", "Text");

我应该用什么代替 Text 来添加我想要的内容?

我试过:

 metric = thePackage.Elements.AddNew(text, "Property Note");

 metric = thePackage.Elements.AddNew(text, "PropertyNote");

编辑:

 metric = thePackage.Elements.AddNew(text, "Note");

不起作用:

我很期待

enter image description here在红色框中,而不是其上方的 元素

答案:

 metric = thePackage.Elements.AddNew("", "Text"); // the Note Property
metric.SubType = 18; // This will actually make a simple Text behave as Note Property

最佳答案

正如所 promise 的,这里是创建图表注释的代码。对 Perl 感到抱歉,但您可能能够将其翻译成 Javascript。

my $p = $rep->GetPackageByGUID("{157B01A5-8F9A-4458-8C7F-E48F5DA77B0A}"); # sample package
my $dnote = $p->Elements->AddNew("", "Text"); # the Note Property
$dnote->{SubType} = 18; # This will actually make a simple Text behave as Note Property
$dnote->Update(); # save in package elements
my $dia = $p->Diagrams->GetAt(0); # sample diagram
my $do = $dia->DiagramObjects->AddNew("l=10;r=110;t=-20;b=-80", ""); # place Note Property in diagram (coordinates are about top left)
$do->{ElementID} = $dnote->ElementID; # link with the Note Property
$do->Update(); # place in diagram
$rep->ReloadDiagram($dia->DiagramID); # make ir appear instantly

关于enterprise-architect - 从 javascript Enterprise Architect 添加属性说明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45982990/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com