Hello everyone,
i would like to write a code which is naming all cells in a 3D dgn according to the level which the subelements of the specific cell are placed on. I know that it may be the case that the level of the subelements are different. In this case the code should just name the cell according to any subelement level.
I already could find the below written code in the bentley forum (OPM Formula to catch Name to cell name - AutoPLANT | OpenPlant | PlantWise Forum - AutoPLANT | OpenPlant | PlantWise - Bentley Communities) which is nearly already the solution. The Problem is that this code is using a property information of the cell to name the cell. I have to get the property information from the subelements and not from the cell itself since the property "level" does not exists for cells.
So simply said, i am looking for a code simular like " GetCellProperty(Mycell, "Property") " but which allows me to reach the properties of the subelements of a cell. So something like " GetCellSubElementProperty(Mycell, "Property") ".
Does anyone know how to do it? The rest of the code i should be able to change myself (hopefully :)).
I am grateful for any tips. Thanks in advance.
Sub FillCellNameAsTag() Dim Mycell As CellElement Dim ee As ElementEnumerator Dim sc As New ElementScanCriteria sc.ExcludeAllTypes sc.IncludeType msdElementTypeCellHeader Set MyEnum = ActiveModelReference.Scan(sc) Do While MyEnum.MoveNext Set Mycell = MyEnum.Current Select Case GetCellProperty(Mycell, "SUPPORT_NAME") Case "NotAvailable" Case Else SetCellProperty Mycell, "CellName", GetCellProperty(Mycell, "NAME") End Select Loop End Sub Function GetCellProperty(CellEle As Element, PropertyNameString As String) As String Dim OPH As PropertyHandler Set OPH = CreatePropertyHandler(CellEle) On Error Resume Next GetCellProperty = "NotAvailable" OPH.SelectByAccessString (PropertyNameString) GetCellProperty = OPH.GetValue End Function Sub SetCellProperty(CellEle As Element, PropertyNameString As String, PropertyValue As String) Dim OPH As PropertyHandler Set OPH = CreatePropertyHandler(CellEle) OPH.SelectByAccessString (PropertyNameString) OPH.SetValue PropertyValue End Sub
Hello Christopher,
I will have this taken up internally to get you what you are looking for or redirect concerned people to this thread for assistance. Thank you for your patience.Regards | Soham Mhaskar.