Skip to Content

Createing a model containing an extension

Hi,

quick question to one of the PD gurus:

How to create a model by script and add an existing extension to it.

I'm able to create a model using the CreateModelFromTemplate function based on a template the extension is already attached to, but how to do the same using CreateModel? Is there a parameter wich allows to add an extension?

I was trying with CreateModel (PdEAM.cls_Model, EvaluateNamedPath("%_MODELS%") + L1Process.Name + ".eam|Diagram=CityPlanningDiagram|ExtendedModelDefinitions=" + EAMExtensionPath, omf_DontOpenView) since there is nothing about it in the documentation. Of course I failed ...

Any ideas?

Regards,

Rafal

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Oct 02, 2014 at 08:48 AM

    Hi,

    Not a parameter (the parameter only applies to language or dbms) but you can add extension right after the model creation.

    You use the ImportExtendedModelDefinition method on the model:

    <<

    ImportExtendedModelDefinition(ByVal Filename As String, ByVal Copy As Boolean = False) As BaseObject

    Imports and uses an external ExtendeModelDefinition.

    >>

    the boolean parameter specify whether extension is embedded in the model.

    Regards,

    Marc

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 02, 2014 at 09:22 AM


    Here some code in context:

    Sub CreatePDImportModel (ImportFileName)

    Dim ModelOptions

    Dim stg,c, Pos, NewName

    Dim fsoMdl

    Set fsoMdl = CreateObject("Scripting.FileSystemObject")

    stg = "Source: "

    if InNodeName = "target" then stg = "Target: " end if

    Set importModel = CreateModel(PdPDM.cls_Model, ImportFileName & "|DBMS=ANSI Level 2")

    LogMsg "CreatePDImportModel ok. Importmodel " & ImportFileName & " erstellt."

    importModel.Name = ImportFileName

    importModel.Code = ImportFileName

    importModel.ImportExtendedModelDefinition ("G:\PowerDesigner\Resource Files\Extended Model Definitions\EMD_PDM_Helaba.xem")

    Set ModelOptions = importModel.GetModelOptions

    For each c in ModelOptions.CodeNamingConventions

    c.AllCharactersValid = TRUE

    c.MaxLength = 254

    Next

    importModel.Comment = "Modell re-engineered aus Informatica am " & Now & " von " & objNet.UserName & vbcrlf & stg & ImportFileName

    importModel.DefaultDiagram.Name = "Main"

    If fsoMdl.FileExists (MdlDir & NewName & "." & "PDM") Then

    importModel.Save MdlDir & NewName & "_" & dd & "." & "PDM", TRUE

    Else

    importModel.Save MdlDir & NewName & "." & "PDM", TRUE

    End If

    Set fsoMdl = Nothing

    CreateTable

    BuildDiagramSymbols

    End Sub

    dj

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.