Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Suplanus committed May 6, 2019
1 parent cebb17c commit d8ceebe
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions Suplanus.Sepla/Helper/ProjectUtility.cs
Expand Up @@ -199,56 +199,6 @@ public static Project OpenProject(string projectLinkFilePath, ProjectManager.Ope
}
}

/// <summary>
/// Generates a project with the given GenerateablePageMacros

This comment has been minimized.

Copy link
@saieffattoum1

saieffattoum1 Apr 12, 2023

Könnten Sie mir bitte diese Klasse schicken(GeneratablePageMacro) ?

This comment has been minimized.

Copy link
@Suplanus

Suplanus Apr 12, 2023

Author Owner

Finds Sie nicht im Repo. Aber sollte ganz einfach sein mit den Properties LocationIdentifier und dem Pfad zum Macro :)

new GeneratablePageMacro(
    @"\\Mac\Home\Documents\GitHub\ibKastl.MechatronicsConfigurator\DemoData\Macros\PageMacro_Supply.emp",
    new LocationIdentifierIdentifier
    {
        FunctionAssignment = "TEST2",
        Plant = "TEST22",
        PlaceOfInstallation = "TEST222",
        Location = "TEST2222",
        UserDefinied = "TEST22222",
    }));

This comment has been minimized.

Copy link
@saieffattoum1

saieffattoum1 Apr 12, 2023

public class GeneratablePageMacro
{
public string MacroPath { get; set; }
public LocationIdentifier LocationIdentifier { get; set; }

public GeneratablePageMacro(string macroPath, LocationIdentifier locationIdentifier)
{
    MacroPath = macroPath;
    LocationIdentifier = locationIdentifier;
}

public LocationIdentifier LocationIdentifierIdentifier(string functionAssignment, string location, string placeOfInstallation, string plant, string userDefinied)
{
    return new LocationIdentifier
    {
        FunctionAssignment = functionAssignment,
        Location = location,
        PlaceOfInstallation = placeOfInstallation,
        Plant = plant,
        UserDefinied = userDefinied
    };
}

}

Immer noch Fehler und das ist nicht genug, weil Keine Definition für "Filename" in ProjectUtility enthält :'( ! Könnten Sie mir damit helfen ? Ich bin hauptberuflich kein Programmierer und komme damit nicht mehr weiter ...

This comment has been minimized.

Copy link
@Suplanus

Suplanus Apr 12, 2023

Author Owner

MacroPath sollte Filename heißen.

Weiterführenden Support bitte dann über ibKastl.de anfragen.

/// </summary>
/// <param name="projectLinkFilePath">EPLAN project file (*.elk)</param>
/// <param name="projectTemplateFilePath">EPLAN template project (*.zw9)</param>
/// <param name="generatablePageMacros">List of GeneratablePageMaros</param>
public static void Generate(string projectLinkFilePath, string projectTemplateFilePath,
List<GeneratablePageMacro> generatablePageMacros)
{
var project = Create(projectLinkFilePath, projectTemplateFilePath, false);
project.RemoveAllPages();

Insert insert = new Insert();
var pageCount = project.Pages.Length; // needed cause of overwrite
foreach (var generatablePageMacro in generatablePageMacros)
{
// Load pages from macro
PageMacro pageMacro = new PageMacro();
pageMacro.Open(generatablePageMacro.Filename, project);
foreach (var page in pageMacro.Pages)
{
// Rename
pageCount++;

PagePropertyList pagePropertyList = page.NameParts;
if (generatablePageMacro.LocationIdentifierIdentifier != null)
{
pagePropertyList[Properties.Page.DESIGNATION_FUNCTIONALASSIGNMENT] =
generatablePageMacro.LocationIdentifierIdentifier.FunctionAssignment;
pagePropertyList[Properties.Page.DESIGNATION_PLANT] =
generatablePageMacro.LocationIdentifierIdentifier.Plant;
pagePropertyList[Properties.Page.DESIGNATION_PLACEOFINSTALLATION] =
generatablePageMacro.LocationIdentifierIdentifier.PlaceOfInstallation;
pagePropertyList[Properties.Page.DESIGNATION_LOCATION] =
generatablePageMacro.LocationIdentifierIdentifier.Location;
pagePropertyList[Properties.Page.DESIGNATION_USERDEFINED] =
generatablePageMacro.LocationIdentifierIdentifier.UserDefinied;
}

pagePropertyList[Properties.Page.PAGE_COUNTER] = pageCount;
page.NameParts = pagePropertyList;

new NameService(page).EvaluateAndSetAllNames();
}

// Insert pagemacro
insert.PageMacro(pageMacro, project, null, PageMacro.Enums.NumerationMode.Number);
}
}

/// <summary>
/// Returns true if there is a multi user conflict in project
/// </summary>
Expand Down

0 comments on commit d8ceebe

Please sign in to comment.