Kkula
Hi
I would like to display all pipelines, pipe sections and pipe segments with associated flags in one query.
For pipe flags no object is created in the unit tree. I can get to the pipe flags via global castings, but I don't know how to get to the associated pipe sections.
currently I have the following script. does anyone know how to proceed here?
Set GC = CreateObject("ComosROUtilities.GlobalCastings")
strFlagCDev = "@30|M00|A50|A10|A80|A10|A40"
Set objDoc = a
objDoc.Report.OpenReadOnly true
Set colRItems = objDoc.Report.ReportDocument
For i = 0 To colRItems.Itemcount-1
Set rItem = colRItems.item(i)
Set roDevice = GC.GC_GetIRODevice(rItem)
If Not roDevice Is Nothing Then
If strFlagCDev = roDevice.CDeviceFullname Then
Output "Flag found"
End If
End If
Next
objDoc.Report.close
You're on the right track using Global Castings to access pipe flags. However, to reach the associated pipe sections, you need to traverse the relationships defined within COMOS.
Here's a refined approach, building upon your script:
GlobalCastings to find flags by CDeviceFullname is valid.roDevice), utilize its relationships to find the parent pipe section. Flags are typically related to sections via a "Contains" or similar relationship. Use roDevice.Parent or explore roDevice.Relationships to find the section.pipeSection.Parent or pipeSection.Relationships).Example Snippet (Illustrative):
Set GC = CreateObject("ComosROUtilities.GlobalCastings")
strFlagCDev = "@30|M00|A50|A10|A80|A10|A40"
Set objDoc = a
objDoc.Report.OpenReadOnly True
Set colRItems = objDoc.Report.ReportDocument
For i = 0 To colRItems.Itemcount - 1
Set rItem = colRItems.item(i)
Set roDevice = GC.GC_GetIRODevice(rItem)
If Not roDevice Is Nothing Then
If strFlagCDev = roDevice.CDeviceFullname Then
Output "Flag found: " & roDevice.CDeviceFullname
'Navigate to Pipe Section (Adapt relationship name as needed)
If Not roDevice.Parent Is Nothing Then
Set roPipeSection = roDevice.Parent
Output " Pipe Section: " & roPipeSection.CDeviceFullname
'Navigate to Pipeline (Adapt relationship name as needed)
If Not roPipeSection.Parent Is Nothing Then
Set roPipeline = roPipeSection.Parent
Output " Pipeline: " & roPipeline.CDeviceFullname
End If
End If
End If
End If
Next
objDoc.Report.close
Important: Replace placeholder relationship names (e.g., "Contains") with the actual relationship names used in your COMOS project. Use the COMOS object model browser to explore relationships. Consider using more specific queries targeting the flag's object type directly for performance.
For detailed information on relationships and the COMOS object model, refer to the SiePortal: SiePortal.
Our flexible community website is a platform that allows users to connect, share information, and collaborate on various topics of interest. The website offers a range of features such as discussion forums, messaging, user profiles, event calendars, and more. Users can customize their experience by creating and joining different groups or communities based on their interests or location. The website is designed to be user-friendly and adaptable to the needs and preferences of our diverse user base. Whether you are looking to network professionally, share hobbies and interests, or simply connect with like-minded individuals, our flexible community website has something for everyone. Join us today and become a part of our thriving online community!
India
Copyright ©2025
Share this page with your family and friends.