on 10-02-2014 9:41 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's working as described
EAMExtensionPath = EvaluateNamedPath("%_EAMEXTENSIONS%\Process Maps.xem")
Set L2EAMModel = CreateModel (PdEAM.cls_Model, EvaluateNamedPath("%_MODELS%") + L1Process.Name + ".eam|Diagram=CityPlanningDiagram", omf_DontOpenView)
Set L2ProcessModelDiagram = L2EAMModel.CityPlanningDiagrams.Item(0)
L2EAMModel.ImportExtendedModelDefinition(EAMExtensionPath)
Thanks!
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.