HCBBS Forum (English)
Submit Chemical Projects / Find Solutions
Amplify Your Requirements on a Broader Chemical Platform *Engineering · Technology · Equipment · Solutions*
Submit Request

SP3D Development-How to find a factory object by name

2019-08-09View Original

Thread Content

A major flaw of SP3D compared to PDMS is that it does not have a simple scripting language and simple development method. For example, you can use "$!Name" in PDMS to locate a certain pipe fitting and set its properties, which is very convenient. So in S3D, how to modify attributes and batch modify attributes in the same convenient way? We first need to find this object. 1. S3D development methods There are three types of S3D development, SQL, COM and .Net. We recommend .Net here because SQL directly operates at the database level and is not very secure. ; COM is a technology developed by Microsoft thirty years ago and is no longer maintained. ; .Net has a rich development library and can develop the programs we need very efficiently and quickly. Except for one inconvenience, debugging is too troublesome. The reference library of S3D is in the...\Smart3D\Core\Container\Bin\Assemblies\Release folder. The commonly used ones are as shown in the figure below.: Generally you need to add the following file headers: using Ingr.SP3D.Common.Client; using Ingr.SP3D.Common.Client.Services ; using Ingr.SP3D.Common.Middle; using Ingr.SP3D.Common.Middle.Services ; using Ingr.SP3D.Route.Middle; 2. Calling method The calling method is as follows and will not be described in detail. 3. Introduce a tool As mentioned above, debugging .Net programs is very troublesome, so the author developed 3DBox, which allows S3D to support C#-based scripting language development. 3DBox has built-in S3D header files. You only need to write the content that needs to be operated in the file like writing a script, and then enter "run file path" in the 3DBox command line and press Enter. 4. Code and running results We can use the following code or all factory object names of the current working control: SP3DConnection oConnection = ClientServiceProvider.WorkingSet.ActiveConnection; WorkingSet oWorkingSet = ClientServiceProvider.WorkingSet; Filter oFilter = new Filter(); BOCollection oWorkingcoll = oWorkingSet.GetObjectsByFilter(oFilter, oConnection); string name = “”; foreach (BusinessObject obj in oWorkingcoll) { try { name = name + obj.GetPropertyValue("IJNamedItem", "Name").ToString() + "\r\n"; } catch { } } return name; After obtaining the name, we can find the object we want to locate through name matching or name regular expression matching, and the next step is to operate the object. The running results are shown in the figure below: Follow the WeChat public account Yuanyuan Digital Intelligence Laboratory to learn more!
Reply #22019-08-09
understand, learn* , thank you for sharing

Submit a Project

**Looking for Chemical Technology, Equipment & Solutions?** No Registration Required Broader Platform Exposure | Global Chemical Service Provider Connections

Submit Request — Free Consultation

Disclaimer

This is an automated machine translation of the original thread. Some technical terms may have inaccuracies; the original text shall prevail. Click "View Original" at the top right to access the source page, which supports IP-based automatic real-time language translation. Please watch out for contact details and sales inducements to prevent fraud. All content and translations are for reference only, representing solely the poster's personal views. For enquiries, email service@hcbbs.com.