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!
understand, learn* , thank you for sharing