OPM Formula to catch Name to cell name

Hi Gents

I am looking for a method in OPM, when we placed a support location, is possible to catch the support number of the support location to the cell name? e.g. in element properties, 

Cell Name = Name as shown the illustrated fig below, can you give some tips how can I make it? I know there maybe some function in class editor, it maybe can add some formula/expression.

I want the parameter "Cell Name" got the name as in OPM support location attribute automatically.

 3107.Empty.dgn

Parents Reply Children
  • 追加了一个属性, 现在都能实现了, 谢谢!谢谢!

  • 您好,现在我想在OPM里获取参考模型的相关信息然后我在DO 循环前加了一个FOR循环用来对每个Attachment进行Scan, 新的代码如下, 调试时在Set Mycell = MyEnum.Current 出现报错说是类型不匹配,麻烦您帮忙看看。

    Sub FillCellNameAsTag()
        Dim Mycell As CellElement
        Dim ee As ElementEnumerator
        Dim sc As New ElementScanCriteria
    	
    	dim oAtt as Attachment ‘新加变量
        
        sc.ExcludeAllTypes
        sc.IncludeType msdElementTypeCellHeader
    	
    	For For Each oAtt In ActiveModelReference.Attachments
    		Set MyEnum = ActiveModelReference.Scan(sc)
        
    		Do While MyEnum.MoveNext
    			Set Mycell = MyEnum.Current ’调试时这里报错说 “Type mismatch”,
    			Select Case GetCellProperty(Mycell, "SUPPORT_NAME")
    				   Case "NotAvailable"
    				   Case Else
    						ActiveModelReference.AddElement GetCellProperty(Mycell, "NAME") '此处改为放置文本
    			End Select
    		Loop
    	Next
        
    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

  • 有一些别的元素也在msdelementtypecellheader,但其又不是cell。找到这个元素,然后排除掉在赋值。