public static string InsertDevice(this Page page, string lib, string symbol, string part, string DT, PointD location,
                                          string functionT, string characteristic, string engravingT, string mountingT,
                                          string[] connections = null, string[] connectionDes = null)
        {
            var deviceP = new EplDeviceProperties
            {
                SymbolLibraryName = lib,
                SymbolName        = symbol,
                SymbolVariant     = 0,
                PartName          = part,
                Characteristics   = characteristic,
                FunctionText      = functionT,
                EngravingText     = engravingT,
                MountingSite      = mountingT,
                DisplayText       = DT,
                Location          = location,
            };

            if (connections != null)
            {
                deviceP.ConnectionDesignations = connections;
            }

            if (connectionDes != null)
            {
                deviceP.ConnectionPointDescription = connectionDes;
            }

            return(EplExtension.InsertDevice(ref page, deviceP));
        }
        public static string InsertConnectingPoint(this Page page, string lib, string symbolname, PointD location)
        {
            string msg = EplDefinition.EPL_INSERT_CONNECTING_POINT.ToString();

            try
            {
                using (LockingStep oLS = new LockingStep())
                {
                    page.Project.LockAllObjects();
                    SymbolLibrary symboLib       = new SymbolLibrary(page.Project, lib);
                    Symbol        symbol         = new Symbol(symboLib, symbolname);
                    SymbolVariant oSymbolVariant = new SymbolVariant();
                    oSymbolVariant.Initialize(symbol, 0);
                    Function function = new Function();
                    function.Create(page, oSymbolVariant);
                    function.Location = location;
                    function.Properties.FUNC_CONNECTIONDESIGNATION[1] = "1";
                }
            }
            catch (Exception ex)
            {
                EplExtension.EplException("Insert symbol error.", ex);
                msg = EplError.EPL_ERROR.ToString();
            }

            return(msg);
        }
Example #3
0
        public void Generating(ref Eplan.EplApi.DataModel.Project project)
        {
            project.Properties.PROJ_CUSTOMERTITLE       = EplProjectProperties.ProjectTitle;
            project.Properties.PROJ_INSTALLATIONNAME    = EplProjectProperties.Descriptions;
            project.Properties.PROJ_REVISION_APPROVEDBY = EplProjectProperties.ApprovedPersion;
            project.Properties.PROJ_REVISION_CHECKEDBY  = EplProjectProperties.CheckPersion;
            project.Properties.PROJ_CREATORNAME1        = EplProjectProperties.Creator;
            foreach (var item in EplPageProperties)
            {
                Eplan.EplApi.DataModel.Page page = null;
                EplExtension.CreateNewPage(ref project, ref page, new Apps.EplPageProperties
                {
                    PageName         = item.PageName,
                    PageTitle        = item.PageTitle,
                    PageDescription  = item.PageDescription,
                    DesignationPlant = item.DesignationPlant,
                    Location         = item.Location,
                    PageNumber       = item.PageNumber,
                    PlotFrame        = item.PlotFrame,
                });

                foreach (var macro in item.EplMacroProperties)
                {
                    macro.FilePath = Path.Combine(BasePath, macro.FileName);
                    EplExtension.InsertMacro(ref project, ref page, macro);
                }
            }
        }
        public static Page CreateNewPage(this Project project, ref Page page, string pageName, string title, int number, string plant, string location, string description, string[] userText = null)
        {
            EplPageProperties pageProperties = new EplPageProperties
            {
                DesignationPlant = plant,
                Location         = location,
                PageTitle        = title,
                PageNumber       = number,
                PageName         = pageName,
                PageDescription  = description,
            };

            if (userText != null)
            {
                pageProperties.UserDefinitionText = userText;
            }

            EplExtension.CreateNewPage(ref project, ref page, pageProperties);
            return(page);
        }
 public static string PlaceConnections(this Page page, string scheme, bool regenerate)
 {
     return(EplExtension.PlaceConnections(page, scheme, regenerate));
 }