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); }
public static string InsertDevice(ref Page refPage, EplDeviceProperties deviceProperties) { string msg = EplDefinition.EPL_INSERT_DEVICE.ToString(); try { using (LockingStep oLS = new LockingStep()) { refPage.Project.LockAllObjects(); BoxedDevice oBoxedDevice = new BoxedDevice(); string slib = string.IsNullOrEmpty(deviceProperties.SymbolLibraryName) ? "GB_symbol" : deviceProperties.SymbolLibraryName; SymbolLibrary sLibrary = new SymbolLibrary(refPage.Project, slib); Symbol s = new Symbol(sLibrary, deviceProperties.SymbolName); SymbolVariant sv = new SymbolVariant(); sv.Initialize(s, 0); oBoxedDevice.Create(refPage); oBoxedDevice.SymbolVariant = sv; //oBoxedDevice.Properties.FUNC_DES = deviceProperties.SymbolDescription; if (!string.IsNullOrEmpty(deviceProperties.PartName)) { oBoxedDevice.AddArticleReference(deviceProperties.PartName); } oBoxedDevice.VisibleName = deviceProperties.DisplayText; oBoxedDevice.Properties.FUNC_TEXT = deviceProperties.FunctionText; oBoxedDevice.Location = deviceProperties.Location; oBoxedDevice.Properties.FUNC_GRAVINGTEXT = deviceProperties.EngravingText; oBoxedDevice.Properties.FUNC_TECHNICAL_CHARACTERISTIC = deviceProperties.Characteristics; if (deviceProperties.ConnectionDesignations != null) { for (int i = 0; i < deviceProperties.ConnectionDesignations.Length; i++) { oBoxedDevice.Properties.FUNC_CONNECTIONDESIGNATION[i + 1] = deviceProperties.ConnectionDesignations[i]; if (deviceProperties.ConnectionPointDescription != null) { if (deviceProperties.ConnectionPointDescription.Length > i) { oBoxedDevice.Properties.FUNC_CONNECTIONDESCRIPTION[i + 1] = deviceProperties.ConnectionPointDescription[i]; } } } } oBoxedDevice.Properties.FUNC_MOUNTINGLOCATION = deviceProperties.MountingSite; } } catch (Exception ex) { EplException("Insert device error.", ex); msg = EplError.EPL_ERROR.ToString(); } return(msg); }
public static string InsertSymbol(ref Page refPage, EplSymbolProperties symbolProperties) { string msg = EplDefinition.EPL_INSERT_SYMBOL_MCR.ToString(); try { using (LockingStep oLS = new LockingStep()) { refPage.Project.LockAllObjects(); SymbolLibrary symboLib = new SymbolLibrary(refPage.Project, symbolProperties.SymbolLibraryName); Symbol symbol = new Symbol(symboLib, symbolProperties.SymbolName); SymbolVariant oSymbolVariant = new SymbolVariant(); oSymbolVariant.Initialize(symbol, symbolProperties.SymbolVariant); Function function = new Function(); function.Create(refPage, oSymbolVariant); //function.Properties.FUNC_SYMB_DESC = symbolProperties.SymbolDescription; if (!string.IsNullOrEmpty(symbolProperties.PartName)) { function.AddArticleReference(symbolProperties.PartName); } function.VisibleName = symbolProperties.DisplayText; function.Properties.FUNC_TEXT = symbolProperties.FunctionText; function.Location = symbolProperties.Location; function.Properties.FUNC_GRAVINGTEXT = symbolProperties.EngravingText; function.Properties.FUNC_TECHNICAL_CHARACTERISTIC = symbolProperties.Characteristics; if (symbolProperties.ConnectionDesignations != null) { for (int i = 0; i < symbolProperties.ConnectionDesignations.Length; i++) { function.Properties.FUNC_CONNECTIONDESIGNATION[i + 1] = symbolProperties.ConnectionDesignations[i]; if (symbolProperties.ConnectionPointDescription != null) { if (symbolProperties.ConnectionPointDescription.Length > i) { function.Properties.FUNC_CONNECTIONDESCRIPTION[i + 1] = symbolProperties.ConnectionPointDescription[i]; } } } } function.Properties.FUNC_MOUNTINGLOCATION = symbolProperties.MountingSite; } } catch (Exception ex) { EplException("Insert symbol error.", ex); msg = EplError.EPL_ERROR.ToString(); } return(msg); }