Book a Demo

Author Topic: Creating a "Packaging Component"  (Read 3943 times)

gerry77

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Creating a "Packaging Component"
« on: October 15, 2013, 12:29:47 am »
Hi,

(how) can I create a "Packaging Component" using the Automation Interface? I manage to create classes, packages, components but that particular type I don't find. Is it a special attribute to a package?


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Creating a "Packaging Component"
« Reply #1 on: October 15, 2013, 01:53:07 am »
Here's a Perl code snippet:
Code: [Select]
my $pk = $rep->GetTreeSelectedObject();
my $pc = $pk->Packages->AddNew("temp", "");
$pc->Update();
$pc->Element->{SubType} = 20;
$pc->Update();
You will additionally need to call RefreshModelView for the containing package.

q.

gerry77

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Creating a "Packaging Component"
« Reply #2 on: October 21, 2013, 02:36:39 am »
Hello,

thanks a lot, that works great.
Just want to mention that the expected symbol appears only if the Packaging Component is inserted into a Package of a Model, not if attempted directly in the Model.


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Creating a "Packaging Component"
« Reply #3 on: October 21, 2013, 04:05:43 am »
That's (more or less) intentional. Via GUI you can create only View packages on root level, none else. The API is a bit less fuzzy with those constraints (you can do quite a number of things which are not possible via GUI). But then you can not handle those "wrongly" created things in the right way. One gets used to it with the time...

q.